AB&T / SOEM

Dependents:   EasyCAT_LAB_simple EasyCAT_LAB_very_simple EasyCAT_LAB

Embed: (wiki syntax)

« Back to documentation index

ethercateoe.h File Reference

ethercateoe.h File Reference

Headerfile for ethercatfoe.c. More...

Go to the source code of this file.

Data Structures

struct  eoe_ip4_addr
 EOE ip4 address in network order. More...
struct  eoe_ethaddr
 EOE ethernet address. More...
struct  eoe_param
 EoE IP request structure, storage only, no need to pack. More...

Typedefs

typedef struct eoe_ip4_addr eoe_ip4_addr_t
 EOE ip4 address in network order.
typedef PACKED_BEGIN struct
PACKED eoe_ethaddr 
eoe_ethaddr_t
 EOE ethernet address.
typedef PACKED_END struct eoe_param eoe_param_t
 EoE IP request structure, storage only, no need to pack.
typedef PACKED_BEGIN struct PACKED ec_EOEt
 EOE structure.

Functions

PACKED_END 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

Headerfile for ethercatfoe.c.

Definition in file ethercateoe.h.


Typedef Documentation

typedef PACKED_BEGIN struct PACKED ec_EOEt

EOE structure.

Used to interpret EoE mailbox packets.

typedef PACKED_BEGIN struct PACKED eoe_ethaddr eoe_ethaddr_t

EOE ethernet address.

typedef struct eoe_ip4_addr eoe_ip4_addr_t

EOE ip4 address in network order.

typedef PACKED_END struct eoe_param eoe_param_t

EoE IP request structure, storage only, no need to pack.


Function Documentation

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