SOEM  v1.4.0
Functions
ethercatbase.h File Reference

Headerfile for ethercatbase.c. More...

Functions

int ecx_setupdatagram (ecx_portt *port, void *frame, uint8 com, uint8 idx, uint16 ADP, uint16 ADO, uint16 length, void *data)
 
int ecx_adddatagram (ecx_portt *port, void *frame, uint8 com, uint8 idx, boolean more, uint16 ADP, uint16 ADO, uint16 length, void *data)
 
int ecx_BWR (ecx_portt *port, uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout)
 
int ecx_BRD (ecx_portt *port, uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout)
 
int ecx_APRD (ecx_portt *port, uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout)
 
int ecx_ARMW (ecx_portt *port, uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout)
 
int ecx_FRMW (ecx_portt *port, uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout)
 
uint16 ecx_APRDw (ecx_portt *port, uint16 ADP, uint16 ADO, int timeout)
 
int ecx_FPRD (ecx_portt *port, uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout)
 
uint16 ecx_FPRDw (ecx_portt *port, uint16 ADP, uint16 ADO, int timeout)
 
int ecx_APWRw (ecx_portt *port, uint16 ADP, uint16 ADO, uint16 data, int timeout)
 
int ecx_APWR (ecx_portt *port, uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout)
 
int ecx_FPWRw (ecx_portt *port, uint16 ADP, uint16 ADO, uint16 data, int timeout)
 
int ecx_FPWR (ecx_portt *port, uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout)
 
int ecx_LRW (ecx_portt *port, uint32 LogAdr, uint16 length, void *data, int timeout)
 
int ecx_LRD (ecx_portt *port, uint32 LogAdr, uint16 length, void *data, int timeout)
 
int ecx_LWR (ecx_portt *port, uint32 LogAdr, uint16 length, void *data, int timeout)
 
int ecx_LRWDC (ecx_portt *port, uint32 LogAdr, uint16 length, void *data, uint16 DCrs, int64 *DCtime, int timeout)
 

Detailed Description

Headerfile for ethercatbase.c.

Function Documentation

◆ ecx_adddatagram()

int ecx_adddatagram ( ecx_portt *  port,
void *  frame,
uint8  com,
uint8  idx,
boolean  more,
uint16  ADP,
uint16  ADO,
uint16  length,
void *  data 
)

Add EtherCAT datagram to a standard ethernet frame with existing datagram(s).

Parameters
[in]port= port context struct
[out]frame= framebuffer
[in]com= command
[in]idx= index used for TX and RX buffers
[in]more= TRUE if still more datagrams to follow
[in]ADP= Address Position
[in]ADO= Address Offset
[in]length= length of datagram excluding EtherCAT header
[in]data= databuffer to be copied in datagram
Returns
Offset to data in rx frame, usefull to retrieve data after RX.

◆ ecx_APRD()

int ecx_APRD ( ecx_portt *  port,
uint16  ADP,
uint16  ADO,
uint16  length,
void *  data,
int  timeout 
)

APRD "auto increment address read" primitive. Blocking.

Parameters
[in]port= port context struct
[in]ADP= Address Position, each slave ++, slave that has 0 executes
[in]ADO= Address Offset, slave memory address
[in]length= length of databuffer
[out]data= databuffer to put slave data in
[in]timeout= timeout in us, standard is EC_TIMEOUTRET
Returns
Workcounter or EC_NOFRAME

◆ ecx_APRDw()

uint16 ecx_APRDw ( ecx_portt *  port,
uint16  ADP,
uint16  ADO,
int  timeout 
)

APRDw "auto increment address read" word return primitive. Blocking.

Parameters
[in]port= port context struct
[in]ADP= Address Position, each slave ++, slave that has 0 reads.
[in]ADO= Address Offset, slave memory address
[in]timeout= timeout in us, standard is EC_TIMEOUTRET
Returns
word data from slave

◆ ecx_APWR()

int ecx_APWR ( ecx_portt *  port,
uint16  ADP,
uint16  ADO,
uint16  length,
void *  data,
int  timeout 
)

APWR "auto increment address write" primitive. Blocking.

Parameters
[in]port= port context struct
[in]ADP= Address Position, each slave ++, slave that has 0 writes.
[in]ADO= Address Offset, slave memory address
[in]length= length of databuffer
[in]data= databuffer to write to slave.
[in]timeout= timeout in us, standard is EC_TIMEOUTRET
Returns
Workcounter or EC_NOFRAME

◆ ecx_APWRw()

int ecx_APWRw ( ecx_portt *  port,
uint16  ADP,
uint16  ADO,
uint16  data,
int  timeout 
)

APWRw "auto increment address write" word primitive. Blocking.

Parameters
[in]port= port context struct
[in]ADP= Address Position, each slave ++, slave that has 0 writes.
[in]ADO= Address Offset, slave memory address
[in]data= word data to write to slave.
[in]timeout= timeout in us, standard is EC_TIMEOUTRET
Returns
Workcounter or EC_NOFRAME

◆ ecx_ARMW()

int ecx_ARMW ( ecx_portt *  port,
uint16  ADP,
uint16  ADO,
uint16  length,
void *  data,
int  timeout 
)

APRMW "auto increment address read, multiple write" primitive. Blocking.

Parameters
[in]port= port context struct
[in]ADP= Address Position, each slave ++, slave that has 0 reads, following slaves write.
[in]ADO= Address Offset, slave memory address
[in]length= length of databuffer
[out]data= databuffer to put slave data in
[in]timeout= timeout in us, standard is EC_TIMEOUTRET
Returns
Workcounter or EC_NOFRAME

◆ ecx_BRD()

int ecx_BRD ( ecx_portt *  port,
uint16  ADP,
uint16  ADO,
uint16  length,
void *  data,
int  timeout 
)

BRD "broadcast read" primitive. Blocking.

Parameters
[in]port= port context struct
[in]ADP= Address Position, normally 0
[in]ADO= Address Offset, slave memory address
[in]length= length of databuffer
[out]data= databuffer to put slave data in
[in]timeout= timeout in us, standard is EC_TIMEOUTRET
Returns
Workcounter or EC_NOFRAME

◆ ecx_BWR()

int ecx_BWR ( ecx_portt *  port,
uint16  ADP,
uint16  ADO,
uint16  length,
void *  data,
int  timeout 
)

BRW "broadcast write" primitive. Blocking.

Parameters
[in]port= port context struct
[in]ADP= Address Position, normally 0
[in]ADO= Address Offset, slave memory address
[in]length= length of databuffer
[in]data= databuffer to be written to slaves
[in]timeout= timeout in us, standard is EC_TIMEOUTRET
Returns
Workcounter or EC_NOFRAME

◆ ecx_FPRD()

int ecx_FPRD ( ecx_portt *  port,
uint16  ADP,
uint16  ADO,
uint16  length,
void *  data,
int  timeout 
)

FPRD "configured address read" primitive. Blocking.

Parameters
[in]port= port context struct
[in]ADP= Address Position, slave that has address reads.
[in]ADO= Address Offset, slave memory address
[in]length= length of databuffer
[out]data= databuffer to put slave data in
[in]timeout= timeout in us, standard is EC_TIMEOUTRET
Returns
Workcounter or EC_NOFRAME

◆ ecx_FPRDw()

uint16 ecx_FPRDw ( ecx_portt *  port,
uint16  ADP,
uint16  ADO,
int  timeout 
)

FPRDw "configured address read" word return primitive. Blocking.

Parameters
[in]port= port context struct
[in]ADP= Address Position, slave that has address reads.
[in]ADO= Address Offset, slave memory address
[in]timeout= timeout in us, standard is EC_TIMEOUTRET
Returns
word data from slave

◆ ecx_FPWR()

int ecx_FPWR ( ecx_portt *  port,
uint16  ADP,
uint16  ADO,
uint16  length,
void *  data,
int  timeout 
)

FPWR "configured address write" primitive. Blocking.

Parameters
[in]port= port context struct
[in]ADP= Address Position, slave that has address writes.
[in]ADO= Address Offset, slave memory address
[in]length= length of databuffer
[in]data= databuffer to write to slave.
[in]timeout= timeout in us, standard is EC_TIMEOUTRET
Returns
Workcounter or EC_NOFRAME

◆ ecx_FPWRw()

int ecx_FPWRw ( ecx_portt *  port,
uint16  ADP,
uint16  ADO,
uint16  data,
int  timeout 
)

FPWR "configured address write" primitive. Blocking.

Parameters
[in]port= port context struct
[in]ADP= Address Position, slave that has address writes.
[in]ADO= Address Offset, slave memory address
[in]data= word to write to slave.
[in]timeout= timeout in us, standard is EC_TIMEOUTRET
Returns
Workcounter or EC_NOFRAME

◆ ecx_FRMW()

int ecx_FRMW ( ecx_portt *  port,
uint16  ADP,
uint16  ADO,
uint16  length,
void *  data,
int  timeout 
)

FPRMW "configured address read, multiple write" primitive. Blocking.

Parameters
[in]port= port context struct
[in]ADP= Address Position, slave that has address reads, following slaves write.
[in]ADO= Address Offset, slave memory address
[in]length= length of databuffer
[out]data= databuffer to put slave data in
[in]timeout= timeout in us, standard is EC_TIMEOUTRET
Returns
Workcounter or EC_NOFRAME

◆ ecx_LRD()

int ecx_LRD ( ecx_portt *  port,
uint32  LogAdr,
uint16  length,
void *  data,
int  timeout 
)

LRD "logical memory read" primitive. Blocking.

Parameters
[in]port= port context struct
[in]LogAdr= Logical memory address
[in]length= length of bytes to read from slave.
[out]data= databuffer to read from slave.
[in]timeout= timeout in us, standard is EC_TIMEOUTRET
Returns
Workcounter or EC_NOFRAME

◆ ecx_LRW()

int ecx_LRW ( ecx_portt *  port,
uint32  LogAdr,
uint16  length,
void *  data,
int  timeout 
)

LRW "logical memory read / write" primitive. Blocking.

Parameters
[in]port= port context struct
[in]LogAdr= Logical memory address
[in]length= length of databuffer
[in,out]data= databuffer to write to and read from slave.
[in]timeout= timeout in us, standard is EC_TIMEOUTRET
Returns
Workcounter or EC_NOFRAME

◆ ecx_LRWDC()

int ecx_LRWDC ( ecx_portt *  port,
uint32  LogAdr,
uint16  length,
void *  data,
uint16  DCrs,
int64 *  DCtime,
int  timeout 
)

LRW "logical memory read / write" primitive plus Clock Distribution. Blocking. Frame consists of two datagrams, one LRW and one FPRMW.

Parameters
[in]port= port context struct
[in]LogAdr= Logical memory address
[in]length= length of databuffer
[in,out]data= databuffer to write to and read from slave.
[in]DCrs= Distributed Clock reference slave address.
[out]DCtime= DC time read from reference slave.
[in]timeout= timeout in us, standard is EC_TIMEOUTRET
Returns
Workcounter or EC_NOFRAME

◆ ecx_LWR()

int ecx_LWR ( ecx_portt *  port,
uint32  LogAdr,
uint16  length,
void *  data,
int  timeout 
)

LWR "logical memory write" primitive. Blocking.

Parameters
[in]port= port context struct
[in]LogAdr= Logical memory address
[in]length= length of databuffer
[in]data= databuffer to write to slave.
[in]timeout= timeout in us, standard is EC_TIMEOUTRET
Returns
Workcounter or EC_NOFRAME

◆ ecx_setupdatagram()

int ecx_setupdatagram ( ecx_portt *  port,
void *  frame,
uint8  com,
uint8  idx,
uint16  ADP,
uint16  ADO,
uint16  length,
void *  data 
)

Generate and set EtherCAT datagram in a standard ethernet frame.

Parameters
[in]port= port context struct
[out]frame= framebuffer
[in]com= command
[in]idx= index used for TX and RX buffers
[in]ADP= Address Position
[in]ADO= Address Offset
[in]length= length of datagram excluding EtherCAT header
[in]data= databuffer to be copied in datagram
Returns
always 0