SOEM  v1.4.0
Data Structures | Macros | Functions
ethercatsoe.c File Reference

Servo over EtherCAT (SoE) Module. More...

#include <stdio.h>
#include <string.h>
#include "osal.h"
#include "oshw.h"
#include "ethercattype.h"
#include "ethercatbase.h"
#include "ethercatmain.h"
#include "ethercatsoe.h"

Data Structures

struct  ec_SoEt
 

Macros

#define EC_SOE_MAX_DRIVES   8
 

Functions

PACKED_END void ecx_SoEerror (ecx_contextt *context, uint16 Slave, uint16 idn, uint16 Error)
 
int ecx_SoEread (ecx_contextt *context, uint16 slave, uint8 driveNo, uint8 elementflags, uint16 idn, int *psize, void *p, int timeout)
 
int ecx_SoEwrite (ecx_contextt *context, uint16 slave, uint8 driveNo, uint8 elementflags, uint16 idn, int psize, void *p, int timeout)
 
int ecx_readIDNmap (ecx_contextt *context, uint16 slave, int *Osize, int *Isize)
 
int ec_SoEread (uint16 slave, uint8 driveNo, uint8 elementflags, uint16 idn, int *psize, void *p, int timeout)
 
int ec_SoEwrite (uint16 slave, uint8 driveNo, uint8 elementflags, uint16 idn, int psize, void *p, int timeout)
 
int ec_readIDNmap (uint16 slave, int *Osize, int *Isize)
 

Detailed Description

Servo over EtherCAT (SoE) Module.

Macro Definition Documentation

◆ EC_SOE_MAX_DRIVES

#define EC_SOE_MAX_DRIVES   8

Function Documentation

◆ ec_readIDNmap()

int ec_readIDNmap ( uint16  slave,
int *  Osize,
int *  Isize 
)

◆ ec_SoEread()

int ec_SoEread ( uint16  slave,
uint8  driveNo,
uint8  elementflags,
uint16  idn,
int *  psize,
void *  p,
int  timeout 
)

◆ ec_SoEwrite()

int ec_SoEwrite ( uint16  slave,
uint8  driveNo,
uint8  elementflags,
uint16  idn,
int  psize,
void *  p,
int  timeout 
)

◆ ecx_readIDNmap()

int ecx_readIDNmap ( ecx_contextt *  context,
uint16  slave,
int *  Osize,
int *  Isize 
)

SoE read AT and MTD mapping.

SoE has standard indexes defined for mapping. This function tries to read them and collect a full input and output mapping size of designated slave.

Parameters
[in]context= context struct
[in]slave= Slave number
[out]Osize= Size in bits of output mapping (MTD) found
[out]Isize= Size in bits of input mapping (AT) found
Returns
>0 if mapping successful.

◆ ecx_SoEerror()

PACKED_END void ecx_SoEerror ( ecx_contextt *  context,
uint16  Slave,
uint16  idn,
uint16  Error 
)

Report SoE error.

Parameters
[in]context= context struct
[in]Slave= Slave number
[in]idn= IDN that generated error
[in]Error= Error code, see EtherCAT documentation for list

◆ ecx_SoEread()

int ecx_SoEread ( ecx_contextt *  context,
uint16  slave,
uint8  driveNo,
uint8  elementflags,
uint16  idn,
int *  psize,
void *  p,
int  timeout 
)

SoE read, blocking.

The IDN object of the selected slave and DriveNo is read. If a response is larger than the mailbox size then the response is segmented. The function will combine all segments and copy them to the parameter buffer.

Parameters
[in]context= context struct
[in]slave= Slave number
[in]driveNo= Drive number in slave
[in]elementflags= Flags to select what properties of IDN are to be transferred.
[in]idn= IDN.
[in,out]psize= Size in bytes of parameter buffer, returns bytes read from SoE.
[out]p= Pointer to parameter buffer
[in]timeout= Timeout in us, standard is EC_TIMEOUTRXM
Returns
Workcounter from last slave response

◆ ecx_SoEwrite()

int ecx_SoEwrite ( ecx_contextt *  context,
uint16  slave,
uint8  driveNo,
uint8  elementflags,
uint16  idn,
int  psize,
void *  p,
int  timeout 
)

SoE write, blocking.

The IDN object of the selected slave and DriveNo is written. If a response is larger than the mailbox size then the response is segmented.

Parameters
[in]context= context struct
[in]slave= Slave number
[in]driveNo= Drive number in slave
[in]elementflags= Flags to select what properties of IDN are to be transferred.
[in]idn= IDN.
[in]psize= Size in bytes of parameter buffer.
[out]p= Pointer to parameter buffer
[in]timeout= Timeout in us, standard is EC_TIMEOUTRXM
Returns
Workcounter from last slave response