libethercat - an embeddable realtime EtherCAT-master library
Communicate with EtherCAT slaves attached to a Network interface.
Loading...
Searching...
No Matches
HW

Data Structures

struct  hw_common
 hardware structure More...
 

Macros

#define ETH_P_ECAT   (0x88A4)
 Ethertype for EtherCAT.
 
#define ETH_FRAME_LEN   0x1518
 

Typedefs

typedef enum pooltype pooltype_t
 Flag to distinguish the pool types during processing.
 
typedef int(* hw_device_recv_t) (struct hw_common *phw)
 Receive a frame from an EtherCAT hw device.
 
typedef int(* hw_device_send_t) (struct hw_common *phw, ec_frame_t *pframe, pooltype_t pool_type)
 Send a frame from an EtherCAT hw device.
 
typedef void(* hw_device_send_finished_t) (struct hw_common *phw)
 Doing internal stuff when finished sending frames.
 
typedef int(* hw_device_get_tx_buffer_t) (struct hw_common *phw, ec_frame_t **ppframe)
 Get a free tx buffer from underlying hw device.
 
typedef int(* hw_device_close_t) (struct hw_common *phw)
 Close hardware layer.
 
typedef struct hw_common hw_common_t
 hardware structure
 

Enumerations

enum  pooltype { POOL_HIGH , POOL_LOW }
 Flag to distinguish the pool types during processing.
 

Functions

int hw_open (struct hw_common *phw, struct ec *pec)
 open a new hw
 
int hw_close (struct hw_common *phw)
 destroys a hw
 
int hw_tx_low (struct hw_common *phw)
 start sending queued ethercat datagrams
 
int hw_tx (struct hw_common *phw)
 start sending queued ethercat datagrams
 
void hw_process_rx_frame (struct hw_common *phw, ec_frame_t *pframe)
 Process a received EtherCAT frame.
 

Detailed Description

This modules contains main EtherCAT hardware functions.

Typedef Documentation

◆ hw_common_t

typedef struct hw_common hw_common_t

hardware structure

Hardware struct type.

◆ hw_device_close_t

typedef int(* hw_device_close_t) (struct hw_common *phw)

Close hardware layer.

Parameters
[in]phwPointer to hw handle.
Returns
0 or negative error code

◆ hw_device_get_tx_buffer_t

typedef int(* hw_device_get_tx_buffer_t) (struct hw_common *phw, ec_frame_t **ppframe)

Get a free tx buffer from underlying hw device.

Parameters
[in]phwPointer to hw handle.
[in]ppframePointer to return frame buffer pointer.
Returns
0 or negative error code

◆ hw_device_recv_t

typedef int(* hw_device_recv_t) (struct hw_common *phw)

Receive a frame from an EtherCAT hw device.

Parameters
[in]phwPointer to hw handle.
Returns
0 or negative error code

◆ hw_device_send_finished_t

typedef void(* hw_device_send_finished_t) (struct hw_common *phw)

Doing internal stuff when finished sending frames.

Parameters
[in]phwPointer to hw handle.

◆ hw_device_send_t

typedef int(* hw_device_send_t) (struct hw_common *phw, ec_frame_t *pframe, pooltype_t pool_type)

Send a frame from an EtherCAT hw device.

Parameters
[in]phwPointer to hw handle.
[in]pframePointer to frame buffer.
[in]pool_typePool type to distinguish between high and low prio frames.
Returns
0 or negative error code

◆ pooltype_t

typedef enum pooltype pooltype_t

Flag to distinguish the pool types during processing.

pool type struct type.

Function Documentation

◆ hw_close()

int hw_close ( struct hw_common phw)

destroys a hw

Parameters
phwhw handle
Returns
0 or negative error code

◆ hw_open()

int hw_open ( struct hw_common phw,
struct ec pec 
)

open a new hw

Parameters
[in]phwPointer to hw structure.
[in]pecPointer to master structure.
Returns
0 or negative error code

◆ hw_process_rx_frame()

void hw_process_rx_frame ( struct hw_common phw,
ec_frame_t pframe 
)

Process a received EtherCAT frame.

Parameters
[in]phwPointer to hw handle.
[in]pframePointer to received EtherCAT frame.

◆ hw_tx()

int hw_tx ( struct hw_common phw)

start sending queued ethercat datagrams

Parameters
phwhardware handle
Returns
0 or error code

◆ hw_tx_low()

int hw_tx_low ( struct hw_common phw)

start sending queued ethercat datagrams

Parameters
phwhardware handle
Returns
0 or error code