SOEM  v1.3.0
Data Structures | Macros | Functions
ethercatsoe.h File Reference

Headerfile for ethercatsoe.c. More...

Data Structures

struct  ec_SoEnamet
 
struct  ec_SoElistt
 
struct  ec_SoEmappingt
 
struct  ec_SoEattributet
 

Macros

#define EC_SOE_DATASTATE_B   0x01
 
#define EC_SOE_NAME_B   0x02
 
#define EC_SOE_ATTRIBUTE_B   0x04
 
#define EC_SOE_UNIT_B   0x08
 
#define EC_SOE_MIN_B   0x10
 
#define EC_SOE_MAX_B   0x20
 
#define EC_SOE_VALUE_B   0x40
 
#define EC_SOE_DEFAULT_B   0x80
 
#define EC_SOE_MAXNAME   60
 
#define EC_SOE_MAXMAPPING   64
 
#define EC_IDN_MDTCONFIG   24
 
#define EC_IDN_ATCONFIG   16
 
#define EC_SOE_LENGTH_1   0x00
 
#define EC_SOE_LENGTH_2   0x01
 
#define EC_SOE_LENGTH_4   0x02
 
#define EC_SOE_LENGTH_8   0x03
 
#define EC_SOE_TYPE_BINARY   0x00
 
#define EC_SOE_TYPE_UINT   0x01
 
#define EC_SOE_TYPE_INT   0x02
 
#define EC_SOE_TYPE_HEX   0x03
 
#define EC_SOE_TYPE_STRING   0x04
 
#define EC_SOE_TYPE_IDN   0x05
 
#define EC_SOE_TYPE_FLOAT   0x06
 
#define EC_SOE_TYPE_PARAMETER   0x07
 

Functions

PACKED_END 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)
 

Detailed Description

Headerfile for ethercatsoe.c.

Macro Definition Documentation

#define EC_IDN_ATCONFIG   16
#define EC_IDN_MDTCONFIG   24
#define EC_SOE_ATTRIBUTE_B   0x04
#define EC_SOE_DATASTATE_B   0x01
#define EC_SOE_DEFAULT_B   0x80
#define EC_SOE_LENGTH_1   0x00
#define EC_SOE_LENGTH_2   0x01
#define EC_SOE_LENGTH_4   0x02
#define EC_SOE_LENGTH_8   0x03
#define EC_SOE_MAX_B   0x20
#define EC_SOE_MAXMAPPING   64
#define EC_SOE_MAXNAME   60
#define EC_SOE_MIN_B   0x10
#define EC_SOE_NAME_B   0x02
#define EC_SOE_TYPE_BINARY   0x00
#define EC_SOE_TYPE_FLOAT   0x06
#define EC_SOE_TYPE_HEX   0x03
#define EC_SOE_TYPE_IDN   0x05
#define EC_SOE_TYPE_INT   0x02
#define EC_SOE_TYPE_PARAMETER   0x07
#define EC_SOE_TYPE_STRING   0x04
#define EC_SOE_TYPE_UINT   0x01
#define EC_SOE_UNIT_B   0x08
#define EC_SOE_VALUE_B   0x40

Function Documentation

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 succesful.
PACKED_END 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 transfered.
[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
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 transfered.
[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