Base EtherCAT functions. More...
#include <stdio.h>
#include <string.h>
#include "oshw.h"
#include "osal.h"
#include "ethercattype.h"
#include "ethercatbase.h"
Go to the source code of this file.
Functions | |
int | ec_adddatagram (void *frame, uint8 com, uint8 idx, boolean more, uint16 ADP, uint16 ADO, uint16 length, void *data) |
int | ec_APRD (uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout) |
uint16 | ec_APRDw (uint16 ADP, uint16 ADO, int timeout) |
int | ec_APWR (uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout) |
int | ec_APWRw (uint16 ADP, uint16 ADO, uint16 data, int timeout) |
int | ec_ARMW (uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout) |
int | ec_BRD (uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout) |
int | ec_BWR (uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout) |
int | ec_FPRD (uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout) |
uint16 | ec_FPRDw (uint16 ADP, uint16 ADO, int timeout) |
int | ec_FPWR (uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout) |
int | ec_FPWRw (uint16 ADP, uint16 ADO, uint16 data, int timeout) |
int | ec_FRMW (uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout) |
int | ec_LRD (uint32 LogAdr, uint16 length, void *data, int timeout) |
int | ec_LRW (uint32 LogAdr, uint16 length, void *data, int timeout) |
int | ec_LRWDC (uint32 LogAdr, uint16 length, void *data, uint16 DCrs, int64 *DCtime, int timeout) |
int | ec_LWR (uint32 LogAdr, uint16 length, void *data, int timeout) |
int | ec_setupdatagram (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_APRD (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_APWR (ecx_portt *port, uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout) |
int | ecx_APWRw (ecx_portt *port, uint16 ADP, uint16 ADO, uint16 data, int timeout) |
int | ecx_ARMW (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_BWR (ecx_portt *port, uint16 ADP, uint16 ADO, uint16 length, void *data, 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_FPWR (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_FRMW (ecx_portt *port, uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout) |
int | ecx_LRD (ecx_portt *port, uint32 LogAdr, uint16 length, void *data, int timeout) |
int | ecx_LRW (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) |
int | ecx_LWR (ecx_portt *port, uint32 LogAdr, uint16 length, void *data, int timeout) |
int | ecx_setupdatagram (ecx_portt *port, void *frame, uint8 com, uint8 idx, uint16 ADP, uint16 ADO, uint16 length, void *data) |
static void | ecx_writedatagramdata (void *datagramdata, ec_cmdtype com, uint16 length, const void *data) |
Base EtherCAT functions.
Setting up a datagram in an ethernet frame. EtherCAT datagram primitives, broadcast, auto increment, configured and logical addressed data transfers. All base transfers are blocking, so wait for the frame to be returned to the master or timeout. If this is not acceptable build your own datagrams and use the functions from nicdrv.c.
Definition in file ethercatbase.c.
int ec_adddatagram | ( | void * | frame, |
uint8 | com, | ||
uint8 | idx, | ||
boolean | more, | ||
uint16 | ADP, | ||
uint16 | ADO, | ||
uint16 | length, | ||
void * | data | ||
) |
Definition at line 544 of file ethercatbase.c.
Definition at line 559 of file ethercatbase.c.
Definition at line 574 of file ethercatbase.c.
Definition at line 598 of file ethercatbase.c.
Definition at line 603 of file ethercatbase.c.
Definition at line 564 of file ethercatbase.c.
Definition at line 554 of file ethercatbase.c.
Definition at line 549 of file ethercatbase.c.
Definition at line 584 of file ethercatbase.c.
Definition at line 589 of file ethercatbase.c.
Definition at line 608 of file ethercatbase.c.
Definition at line 613 of file ethercatbase.c.
Definition at line 569 of file ethercatbase.c.
Definition at line 623 of file ethercatbase.c.
Definition at line 618 of file ethercatbase.c.
int ec_LRWDC | ( | uint32 | LogAdr, |
uint16 | length, | ||
void * | data, | ||
uint16 | DCrs, | ||
int64 * | DCtime, | ||
int | timeout | ||
) |
Definition at line 633 of file ethercatbase.c.
Definition at line 628 of file ethercatbase.c.
int ec_setupdatagram | ( | void * | frame, |
uint8 | com, | ||
uint8 | idx, | ||
uint16 | ADP, | ||
uint16 | ADO, | ||
uint16 | length, | ||
void * | data | ||
) |
Definition at line 539 of file ethercatbase.c.
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).
[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 |
Definition at line 106 of file ethercatbase.c.
APRD "auto increment address read" primitive. Blocking.
[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 |
Definition at line 217 of file ethercatbase.c.
APRDw "auto increment address read" word return primitive. Blocking.
[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 |
Definition at line 298 of file ethercatbase.c.
APWR "auto increment address write" primitive. Blocking.
[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 |
Definition at line 362 of file ethercatbase.c.
APWRw "auto increment address write" word primitive. Blocking.
[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 |
Definition at line 384 of file ethercatbase.c.
APRMW "auto increment address read, multiple write" primitive. Blocking.
[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 |
Definition at line 245 of file ethercatbase.c.
BRD "broadcast read" primitive. Blocking.
[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 |
Definition at line 185 of file ethercatbase.c.
BRW "broadcast write" primitive. Blocking.
[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 |
Definition at line 158 of file ethercatbase.c.
FPRD "configured address read" primitive. Blocking.
[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 |
Definition at line 318 of file ethercatbase.c.
FPRDw "configured address read" word return primitive. Blocking.
[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 |
Definition at line 343 of file ethercatbase.c.
FPWR "configured address write" primitive. Blocking.
[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 |
Definition at line 399 of file ethercatbase.c.
FPWR "configured address write" primitive. Blocking.
[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 |
Definition at line 421 of file ethercatbase.c.
FPRMW "configured address read, multiple write" primitive. Blocking.
[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 |
Definition at line 273 of file ethercatbase.c.
LRD "logical memory read" primitive. Blocking.
[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 |
Definition at line 461 of file ethercatbase.c.
LRW "logical memory read / write" primitive. Blocking.
[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 |
Definition at line 435 of file ethercatbase.c.
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.
[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 |
Definition at line 512 of file ethercatbase.c.
LWR "logical memory write" primitive. Blocking.
[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 |
Definition at line 487 of file ethercatbase.c.
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.
[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 |
Definition at line 68 of file ethercatbase.c.
|
static |
Write data to EtherCAT datagram.
[out] | datagramdata | = data part of datagram |
[in] | com | = command |
[in] | length | = length of databuffer |
[in] | data | = databuffer to be copied into datagram |
Definition at line 31 of file ethercatbase.c.