SOEM EtherCAT Master library for STM Nucleo F767ZI
Dependents: EasyCAT_LAB_simple EasyCAT_LAB_very_simple EasyCAT_LAB
ethercateoe.c File Reference
Ethernet over EtherCAT (EoE) module. More...
Go to the source code of this file.
Functions | |
static void | EOE_ip_uint32_to_byte (eoe_ip4_addr_t *ip, uint8_t *byte_ip) |
EoE utility function to convert uint32 to eoe ip bytes. | |
static void | EOE_ip_byte_to_uint32 (uint8_t *byte_ip, eoe_ip4_addr_t *ip) |
EoE utility function to convert eoe ip bytes to uint32. | |
int | ecx_EOEdefinehook (ecx_contextt *context, void *hook) |
EoE fragment data handler hook. | |
int | ecx_EOEsetIp (ecx_contextt *context, uint16 slave, uint8 port, eoe_param_t *ipparam, int timeout) |
EoE EOE set IP, blocking. | |
int | ecx_EOEgetIp (ecx_contextt *context, uint16 slave, uint8 port, eoe_param_t *ipparam, int timeout) |
EoE EOE get IP, blocking. | |
int | ecx_EOEsend (ecx_contextt *context, uint16 slave, uint8 port, int psize, void *p, int timeout) |
EoE ethernet buffer write, blocking. | |
int | ecx_EOErecv (ecx_contextt *context, uint16 slave, uint8 port, int *psize, void *p, int timeout) |
EoE ethernet buffer read, blocking. | |
int | ecx_EOEreadfragment (ec_mbxbuft *MbxIn, uint8 *rxfragmentno, uint16 *rxframesize, uint16 *rxframeoffset, uint16 *rxframeno, int *psize, void *p) |
EoE mailbox fragment read. |
Detailed Description
Ethernet over EtherCAT (EoE) module.
Set / Get IP functions Blocking send/receive Ethernet Frame Read incoming EoE fragment to Ethernet Frame
Definition in file ethercateoe.c.
Function Documentation
int ecx_EOEdefinehook | ( | ecx_contextt * | context, |
void * | hook | ||
) |
EoE fragment data handler hook.
Should not block.
- Parameters:
-
[in] context = context struct [in] hook = Pointer to hook function.
- Returns:
- 1
Definition at line 52 of file ethercateoe.c.
int ecx_EOEgetIp | ( | ecx_contextt * | context, |
uint16 | slave, | ||
uint8 | port, | ||
eoe_param_t * | ipparam, | ||
int | timeout | ||
) |
EoE EOE get IP, blocking.
Waits for response from the slave.
- Parameters:
-
[in] context = Context struct [in] slave = Slave number [in] port = Port number on slave if applicable [out] ipparam = IP parameter data retrived from slave [in] Timeout = Timeout in us, standard is EC_TIMEOUTRXM
- Returns:
- Workcounter from last slave response or returned result code
Definition at line 181 of file ethercateoe.c.
int ecx_EOEreadfragment | ( | ec_mbxbuft * | MbxIn, |
uint8 * | rxfragmentno, | ||
uint16 * | rxframesize, | ||
uint16 * | rxframeoffset, | ||
uint16 * | rxframeno, | ||
int * | psize, | ||
void * | p | ||
) |
EoE mailbox fragment read.
Will take the data in incoming mailbox buffer and copy to destination Ethernet frame buffer at given offset and update current fragment variables
- Parameters:
-
[in] MbxIn = Received mailbox containing fragment data in/out] rxfragmentno = Fragment number in/out] rxframesize = Frame size in/out] rxframeoffset = Frame offset in/out] rxframeno = Frame number in/out] psize = Size in bytes of frame buffer. [out] p = Pointer to frame buffer
- Returns:
- 0= if fragment OK, >0 if last fragment, <0 on error
Definition at line 534 of file ethercateoe.c.
int ecx_EOErecv | ( | ecx_contextt * | context, |
uint16 | slave, | ||
uint8 | port, | ||
int * | psize, | ||
void * | p, | ||
int | timeout | ||
) |
EoE ethernet buffer read, blocking.
If the buffer is larger than the mailbox size then the buffer is received by several fragments. The function will assamble the fragments into a complete Ethernet buffer.
- Parameters:
-
[in] context = context struct [in] slave = Slave number [in] port = Port number on slave if applicable in/out] psize = Size in bytes of parameter buffer. [in] p = Pointer to parameter buffer [in] timeout = Timeout in us, standard is EC_TIMEOUTRXM
- Returns:
- Workcounter from last slave response or error code
Definition at line 415 of file ethercateoe.c.
int ecx_EOEsend | ( | ecx_contextt * | context, |
uint16 | slave, | ||
uint8 | port, | ||
int | psize, | ||
void * | p, | ||
int | timeout | ||
) |
EoE ethernet buffer write, blocking.
If the buffer is larger than the mailbox size then the buffer is sent in several fragments. The function will split the buf data in fragments and send them to the slave one by one.
- Parameters:
-
[in] context = context struct [in] slave = Slave number [in] port = Port number on slave if applicable [in] psize = Size in bytes of parameter buffer. [in] p = Pointer to parameter buffer [in] Timeout = Timeout in us, standard is EC_TIMEOUTRXM
- Returns:
- Workcounter from last slave transmission
Definition at line 322 of file ethercateoe.c.
int ecx_EOEsetIp | ( | ecx_contextt * | context, |
uint16 | slave, | ||
uint8 | port, | ||
eoe_param_t * | ipparam, | ||
int | timeout | ||
) |
EoE EOE set IP, blocking.
Waits for response from the slave.
- Parameters:
-
[in] context = Context struct [in] slave = Slave number [in] port = Port number on slave if applicable [in] ipparam = IP parameter data to be sent [in] Timeout = Timeout in us, standard is EC_TIMEOUTRXM
- Returns:
- Workcounter from last slave response or returned result code
Definition at line 67 of file ethercateoe.c.
static void EOE_ip_byte_to_uint32 | ( | uint8_t * | byte_ip, |
eoe_ip4_addr_t * | ip | ||
) | [static] |
EoE utility function to convert eoe ip bytes to uint32.
- Parameters:
-
[in] byte_ip = eoe ip 4th octet, 3ed octet, 2nd octet, 1st octet [out] ip = ip in uint32
Definition at line 37 of file ethercateoe.c.
static void EOE_ip_uint32_to_byte | ( | eoe_ip4_addr_t * | ip, |
uint8_t * | byte_ip | ||
) | [static] |
EoE utility function to convert uint32 to eoe ip bytes.
- Parameters:
-
[in] ip = ip in uint32 [out] byte_ip = eoe ip 4th octet, 3ed octet, 2nd octet, 1st octet
Definition at line 25 of file ethercateoe.c.
Generated on Tue Jul 12 2022 18:21:13 by 1.7.2