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

ethercat datagram More...

#include <libosal/types.h>
#include <libosal/mutex.h>
#include "libethercat/common.h"
#include "libethercat/pool.h"
#include "libethercat/idx.h"

Go to the source code of this file.

Data Structures

struct  ec_frame
 
struct  ec_datagram
 
struct  ec_cyclic_datagram
 

Macros

#define EC_WKC_SIZE   (2u)
 Working counter byte length.
 
#define ec_frame_hdr_length   (sizeof(ec_frame_t))
 EtherCAT frame header length.
 
#define ec_frame_length(f)   ((f)->len)
 EtherCAT frame length.
 
#define ec_frame_end(pframe)   (&((osal_uint8_t *)(pframe))[(pframe)->len])
 Pointer to EtherCAT frame end.
 
#define ec_datagram_hdr_length   (sizeof(ec_datagram_t))
 EtherCAT datagram header length.
 
#define ec_datagram_length(pdg)   (ec_datagram_hdr_length + (pdg)->len + EC_WKC_SIZE)
 EtherCAT datagram length.
 

Typedefs

typedef struct ec_frame ec_frame_t
 EtherCAT frame type.
 
typedef struct ec_datagram ec_datagram_t
 EtherCAT datagram type.
 
typedef struct ec_cyclic_datagram ec_cyclic_datagram_t
 EtherCAT cyclic datagram type.
 

Functions

int ec_cyclic_datagram_init (ec_cyclic_datagram_t *cdg, osal_uint64_t recv_timeout)
 Initialize cyclic datagram structure.
 
int ec_cyclic_datagram_destroy (ec_cyclic_datagram_t *cdg)
 Destroy cyclic datagram structure.
 
int ec_frame_init (ec_frame_t *frame)
 Initialize empty frame.
 
void ec_frame_add_datagram_phys (ec_frame_t *frame, osal_uint8_t cmd, osal_uint8_t idx, osal_uint16_t adp, osal_uint16_t ado, osal_uint8_t *payload, osal_size_t payload_len)
 Add datagram at the end of frame.
 
void ec_frame_add_datagram_log (ec_frame_t *frame, osal_uint8_t cmd, osal_uint8_t idx, osal_uint32_t adr, osal_uint8_t *payload, osal_size_t payload_len)
 Add datagram at the end of frame.
 
static ec_datagram_tec_datagram_cast (osal_uint8_t *p)
 Cast pointer to ec_datagram_t type.
 
static void ec_datagram_mark_next (ec_datagram_t *pdg)
 Marking next field in datagram.
 
static ec_datagram_tec_datagram_first (ec_frame_t *pf)
 Get pointer to first datagram in frame.
 
static ec_datagram_tec_datagram_next (ec_datagram_t *pdg)
 Get pointer to next datagram in frame.
 
static osal_uint8_t * ec_datagram_payload (ec_datagram_t *pdg)
 Get pointer to datagram payload.
 
static osal_uint16_t ec_datagram_wkc (ec_datagram_t *pdg)
 Get working counter of datagram.
 

Detailed Description

ethercat datagram

Author
Robert Burger rober.nosp@m.t.bu.nosp@m.rger@.nosp@m.dlr..nosp@m.de
Date
24 Nov 2016

These are EtherCAT datagram specific configuration functions.