Files | |
file | lldtsync.h |
TI Timesync Low Level Driver abstract APIs. | |
file | lldtype.h |
Data types and macros for TI Enet LLD abstract APIs. | |
file | lldenet.h |
TI Ethernet Low Level Driver abstract APIs. | |
Data Structures | |
struct | LLDTSyncCfg_t |
Configuration structure for LLDTSync. More... | |
struct | LLDEnetCfg_t |
Configuration structure for LLDEnet. More... | |
struct | LLDEnetFrame_t |
Structure representing an Ethernet frame. More... | |
struct | LLDEnetFrameScatter_t |
Structure representing an Ethernet frame. More... | |
Functions | |
void | LLDTSyncCfgInit (LLDTSyncCfg_t *cfg) |
Initializes the LLDTSyncCfg_t configuration structure. More... | |
LLDTSync_t * | LLDTSyncOpen (LLDTSyncCfg_t *cfg) |
Opens a new LLDTSync instance to access the PTP clock. More... | |
void | LLDTSyncClose (LLDTSync_t *hTSync) |
Closes the LLDTSync instance. More... | |
int | LLDTSyncGetRxTime (LLDTSync_t *hTSync, uint8_t rxPort, int msgType, uint16_t seqId, uint8_t domain, uint64_t *ts) |
Retrieves the PTP RX timestamp for a specific message. More... | |
int | LLDTSyncGetTxTime (LLDTSync_t *hTSync, uint8_t txPort, int msgType, uint16_t seqId, uint8_t domain, uint64_t *ts) |
Retrieves the PTP TX timestamp for a specific message. More... | |
int | LLDTSyncAdjFreq (LLDTSync_t *hTSync, int ppb) |
Adjusts the frequency of the PTP clock. More... | |
int | LLDTSyncSetTime (LLDTSync_t *hTSync, uint64_t ts) |
Sets the time for the PTP clock. More... | |
int | LLDTSyncGetTime (LLDTSync_t *hTSync, uint64_t *ts) |
Retrieves the current time from the PTP clock. More... | |
int | LLDTSyncEnableTsEvent (LLDTSync_t *hTSync, uint32_t ports[], uint32_t numPorts) |
Enables PTP timestamp events for specified ports. More... | |
int | LLDTSyncShiftTime (LLDTSync_t *hTSync, int64_t offset) |
Shift the time of the PTP clock by offset nsec. More... | |
void | LLDEnetCfgInit (LLDEnetCfg_t *cfg) |
Initializes the LLDEnetCfg_t structure. More... | |
LLDEnet_t * | LLDEnetOpen (LLDEnetCfg_t *cfg) |
Opens an instance of LLDEnet. More... | |
void | LLDEnetClose (LLDEnet_t *hLLDEnet) |
Closes an instance of LLDEnet. More... | |
int | LLDEnetFilter (LLDEnet_t *hLLDEnet, uint8_t *dstMacAddr, uint32_t vlanId, uint32_t ethType) |
Filter RX packets by using the destination MAC address and VLAN ID. More... | |
int | LLDEnetAllocMac (LLDEnet_t *hLLDEnet, uint8_t *srcMacAddr) |
Allocates a source MAC address. More... | |
void | LLDEnetFreeMac (LLDEnet_t *hLLDEnet, uint8_t *srcMacAddr) |
Frees a previously allocated MAC address. More... | |
int | LLDEnetSend (LLDEnet_t *hLLDEnet, LLDEnetFrame_t *frame) |
Sends an Ethernet frame using LLDEnet. More... | |
int | LLDEnetSendMulti (LLDEnet_t *hLLDEnet, LLDEnetFrame_t *frames, uint32_t nFrames) |
Sends multiple Ethernet frames using LLDEnet. More... | |
int | LLDEnetSendScatter (LLDEnet_t *hLLDEnet, LLDEnetFrameScatter_t *frame) |
Sends an ethernet frame of scatter buffers. More... | |
int | LLDEnetSendMultiScatter (LLDEnet_t *hLLDEnet, LLDEnetFrameScatter_t *frames, uint32_t nFrames) |
Sends multiples ethernet frames of scatter buffers. More... | |
int | LLDEnetRecv (LLDEnet_t *hLLDEnet, LLDEnetFrame_t *frame) |
Receives an Ethernet frame using LLDEnet. More... | |
int | LLDEnetRecvZeroCopy (LLDEnet_t *hLLDEnet, LLDEnetRecvCb_t LLDEnetRecvCb, void *cbArg) |
Receives an Ethernet frame using LLDEnet in the Zero-Copy way. More... | |
bool | LLDEnetIsPortUp (LLDEnet_t *hLLDEnet, uint8_t portNum) |
Checks if the specified port is up. More... | |
int | LLDEnetGetLinkInfo (LLDEnet_t *hLLDEnet, uint8_t portNum, uint32_t *speed, uint32_t *duplex) |
Retrieves the link speed and duplex information for the specified port. More... | |
int | LLDEnetSetTxNotifyCb (LLDEnet_t *hLLDEnet, void(*txNotifyCb)(void *arg), void *arg) |
Sets the transmit notification callback function for LLDEnet. More... | |
int | LLDEnetSetRxNotifyCb (LLDEnet_t *hLLDEnet, void(*rxNotifyCb)(void *arg), void *arg) |
Sets the receive notification callback function for LLDEnet. More... | |
int | LLDEnetSetDefaultRxDataCb (LLDEnet_t *hLLDEnet, void(*rxDefaultDataCb)(void *data, int size, int port, void *arg), void *arg) |
Sets the receive data callback function for LLDEnet when filter does not match. This callback is supported only when using the RX DMA shared channel. Currently, only Sitara AM273x is supported for this feature. More... | |
bool | LLDEnetIsRxTsInPkt (LLDEnet_t *hLLDEnet) |
Checks the receive packet timestamping mode. More... | |
Typedefs | |
typedef struct LLDTSync | LLDTSync_t |
Structure representing the LLDTSync instance. More... | |
typedef struct LLDEnet | LLDEnet_t |
Structure representing the LLDEnet instance. More... | |
typedef void(* | LLDEnetRecvCb_t) (LLDEnetFrame_t *frame, void *cbArg) |
Receives callback an Ethernet frame using LLDEnet in the Zero-Copy way. More... | |
Macros | |
#define | LLDENET_E_OK (0) |
#define | LLDENET_E_PARAM (-1) |
#define | LLDENET_E_NOBUF (-2) |
#define | LLDENET_E_BUFSIZE (-3) |
#define | LLDENET_E_NOAVAIL (-4) |
#define | LLDENET_E_DMA (-5) |
#define | LLDENET_E_IOCTL (-6) |
#define | LLDENET_E_NOMATCH (-7) |
#define | LLDENET_E_FAILURE (-8) |
#define | LLDENET_E_DENY (-9) |
#define | LLDENET_E_UNSUPPORT (-10) |
#define | LLDENET_MAX_PORTS 10 |
#define | MAX_NUM_RX_DMA_CH_PER_INSTANCE 2 |
#define | MAX_BUF_IN_SCATTER_FRAME 32 |
Maximum number of buffers in a scatter frame. More... | |
#define LLDENET_E_OK (0) |
no error
#define LLDENET_E_PARAM (-1) |
param invalid
#define LLDENET_E_NOBUF (-2) |
no buffer
#define LLDENET_E_BUFSIZE (-3) |
small or invalid bufsize
#define LLDENET_E_NOAVAIL (-4) |
request for a not available resource
#define LLDENET_E_DMA (-5) |
dma error
#define LLDENET_E_IOCTL (-6) |
enet ioctl error
#define LLDENET_E_NOMATCH (-7) |
does not match expectation
#define LLDENET_E_FAILURE (-8) |
general error
#define LLDENET_E_DENY (-9) |
The operation is denied
#define LLDENET_E_UNSUPPORT (-10) |
The operation is unsupported
#define LLDENET_MAX_PORTS 10 |
Maximum number of ports supported by the Enet LLD abstract layer
#define MAX_NUM_RX_DMA_CH_PER_INSTANCE 2 |
Maximum number of DMA rx channels per instance
#define MAX_BUF_IN_SCATTER_FRAME 32 |
Maximum number of buffers in a scatter frame.
typedef struct LLDTSync LLDTSync_t |
Structure representing the LLDTSync instance.
typedef struct LLDEnet LLDEnet_t |
Structure representing the LLDEnet instance.
typedef void(* LLDEnetRecvCb_t) (LLDEnetFrame_t *frame, void *cbArg) |
Receives callback an Ethernet frame using LLDEnet in the Zero-Copy way.
frame | Pointer to the LLDEnetFrame_t structure to store the received frame. |
cbArg | Callback argument |
void LLDTSyncCfgInit | ( | LLDTSyncCfg_t * | cfg | ) |
Initializes the LLDTSyncCfg_t configuration structure.
cfg | Pointer to the LLDTSyncCfg_t configuration structure. |
LLDTSync_t* LLDTSyncOpen | ( | LLDTSyncCfg_t * | cfg | ) |
Opens a new LLDTSync instance to access the PTP clock.
cfg | Pointer to the LLDTSyncCfg_t configuration structure. |
void LLDTSyncClose | ( | LLDTSync_t * | hTSync | ) |
Closes the LLDTSync instance.
hTSync | Pointer to the LLDTSync instance. |
int LLDTSyncGetRxTime | ( | LLDTSync_t * | hTSync, |
uint8_t | rxPort, | ||
int | msgType, | ||
uint16_t | seqId, | ||
uint8_t | domain, | ||
uint64_t * | ts | ||
) |
Retrieves the PTP RX timestamp for a specific message.
hTSync | Pointer to the LLDTSync instance. |
rxPort | Receive port. |
msgType | Message type. |
seqId | Sequence ID. |
domain | Domain number. |
ts | Pointer to store the PTP RX timestamp. |
int LLDTSyncGetTxTime | ( | LLDTSync_t * | hTSync, |
uint8_t | txPort, | ||
int | msgType, | ||
uint16_t | seqId, | ||
uint8_t | domain, | ||
uint64_t * | ts | ||
) |
Retrieves the PTP TX timestamp for a specific message.
hTSync | Pointer to the LLDTSync instance. |
txPort | Transmit port. |
msgType | Message type. |
seqId | Sequence ID. |
domain | Domain number. |
ts | Pointer to store the PTP TX timestamp. |
int LLDTSyncAdjFreq | ( | LLDTSync_t * | hTSync, |
int | ppb | ||
) |
Adjusts the frequency of the PTP clock.
hTSync | Pointer to the LLDTSync instance. |
ppb | Parts per billion adjustment value. |
int LLDTSyncSetTime | ( | LLDTSync_t * | hTSync, |
uint64_t | ts | ||
) |
Sets the time for the PTP clock.
hTSync | Pointer to the LLDTSync instance. |
ts | Time to set. |
int LLDTSyncGetTime | ( | LLDTSync_t * | hTSync, |
uint64_t * | ts | ||
) |
Retrieves the current time from the PTP clock.
hTSync | Pointer to the LLDTSync instance. |
ts | Pointer to store the current time. |
int LLDTSyncEnableTsEvent | ( | LLDTSync_t * | hTSync, |
uint32_t | ports[], | ||
uint32_t | numPorts | ||
) |
Enables PTP timestamp events for specified ports.
hTSync | Pointer to the LLDTSync instance. |
ports | Array of ports to enable timestamp events for. |
numPorts | Number of ports in the array. |
int LLDTSyncShiftTime | ( | LLDTSync_t * | hTSync, |
int64_t | offset | ||
) |
Shift the time of the PTP clock by offset nsec.
hTSync | Pointer to the LLDTSync instance. |
offset | Offset in nanoseconds, the value can be negative. |
void LLDEnetCfgInit | ( | LLDEnetCfg_t * | cfg | ) |
Initializes the LLDEnetCfg_t structure.
cfg | Pointer to the LLDEnetCfg_t structure to be initialized. |
LLDEnet_t* LLDEnetOpen | ( | LLDEnetCfg_t * | cfg | ) |
Opens an instance of LLDEnet.
cfg | Pointer to the LLDEnetCfg_t structure containing the configuration parameters. |
void LLDEnetClose | ( | LLDEnet_t * | hLLDEnet | ) |
Closes an instance of LLDEnet.
hLLDEnet | Pointer to the LLDEnet instance. |
int LLDEnetFilter | ( | LLDEnet_t * | hLLDEnet, |
uint8_t * | dstMacAddr, | ||
uint32_t | vlanId, | ||
uint32_t | ethType | ||
) |
Filter RX packets by using the destination MAC address and VLAN ID.
hLLDEnet | Pointer to the LLDEnet instance. |
dstMacAddr | Destination MAC address to filter. |
vlanId | VLAN ID to filter. |
ethType | Ethernet type to filter (e.g. PTP ethernet type is 0x88F7). |
int LLDEnetAllocMac | ( | LLDEnet_t * | hLLDEnet, |
uint8_t * | srcMacAddr | ||
) |
Allocates a source MAC address.
hLLDEnet | Pointer to the LLDEnet instance. |
srcMacAddr | Pointer to store the allocated MAC address. |
void LLDEnetFreeMac | ( | LLDEnet_t * | hLLDEnet, |
uint8_t * | srcMacAddr | ||
) |
Frees a previously allocated MAC address.
hLLDEnet | Pointer to the LLDEnet instance. |
srcMacAddr | MAC address to be freed. |
int LLDEnetSend | ( | LLDEnet_t * | hLLDEnet, |
LLDEnetFrame_t * | frame | ||
) |
Sends an Ethernet frame using LLDEnet.
hLLDEnet | Pointer to the LLDEnet instance. |
frame | Pointer to the LLDEnetFrame_t structure representing the frame to be sent. |
int LLDEnetSendMulti | ( | LLDEnet_t * | hLLDEnet, |
LLDEnetFrame_t * | frames, | ||
uint32_t | nFrames | ||
) |
Sends multiple Ethernet frames using LLDEnet.
hLLDEnet | Pointer to the LLDEnet instance. |
frames | Array of LLDEnetFrame_t structures representing the frames to be sent. |
nFrames | Number of frames in the array. |
int LLDEnetSendScatter | ( | LLDEnet_t * | hLLDEnet, |
LLDEnetFrameScatter_t * | frame | ||
) |
Sends an ethernet frame of scatter buffers.
hLLDEnet | Pointer to the LLDEnet instance. |
frame | Scatter frame |
int LLDEnetSendMultiScatter | ( | LLDEnet_t * | hLLDEnet, |
LLDEnetFrameScatter_t * | frames, | ||
uint32_t | nFrames | ||
) |
Sends multiples ethernet frames of scatter buffers.
hLLDEnet | Pointer to the LLDEnet instance. |
frames | Array of Scatter frames |
nFrames | Number of frames in the array. |
int LLDEnetRecv | ( | LLDEnet_t * | hLLDEnet, |
LLDEnetFrame_t * | frame | ||
) |
Receives an Ethernet frame using LLDEnet.
hLLDEnet | Pointer to the LLDEnet instance. |
frame | Pointer to the LLDEnetFrame_t structure to store the received frame. |
int LLDEnetRecvZeroCopy | ( | LLDEnet_t * | hLLDEnet, |
LLDEnetRecvCb_t | LLDEnetRecvCb, | ||
void * | cbArg | ||
) |
Receives an Ethernet frame using LLDEnet in the Zero-Copy way.
hLLDEnet | Pointer to the LLDEnet instance. |
LLDEnetRecvCb | Receive callback |
cbArg | Callback argument |
bool LLDEnetIsPortUp | ( | LLDEnet_t * | hLLDEnet, |
uint8_t | portNum | ||
) |
Checks if the specified port is up.
hLLDEnet | Pointer to the LLDEnet instance. |
portNum | Port number to check. |
int LLDEnetGetLinkInfo | ( | LLDEnet_t * | hLLDEnet, |
uint8_t | portNum, | ||
uint32_t * | speed, | ||
uint32_t * | duplex | ||
) |
Retrieves the link speed and duplex information for the specified port.
hLLDEnet | Pointer to the LLDEnet instance. |
portNum | Port number to retrieve the link information. |
speed | Pointer to store the link speed. |
duplex | Pointer to store the link duplex mode. |
int LLDEnetSetTxNotifyCb | ( | LLDEnet_t * | hLLDEnet, |
void(*)(void *arg) | txNotifyCb, | ||
void * | arg | ||
) |
Sets the transmit notification callback function for LLDEnet.
hLLDEnet | Pointer to the LLDEnet instance. |
txNotifyCb | Pointer to the transmit notification callback function. |
arg | Argument to be passed to the callback function. |
int LLDEnetSetRxNotifyCb | ( | LLDEnet_t * | hLLDEnet, |
void(*)(void *arg) | rxNotifyCb, | ||
void * | arg | ||
) |
Sets the receive notification callback function for LLDEnet.
hLLDEnet | Pointer to the LLDEnet instance. |
rxNotifyCb | Pointer to the receive notification callback function. |
arg | Argument to be passed to the callback function. |
int LLDEnetSetDefaultRxDataCb | ( | LLDEnet_t * | hLLDEnet, |
void(*)(void *data, int size, int port, void *arg) | rxDefaultDataCb, | ||
void * | arg | ||
) |
Sets the receive data callback function for LLDEnet when filter does not match. This callback is supported only when using the RX DMA shared channel. Currently, only Sitara AM273x is supported for this feature.
hLLDEnet | Pointer to the LLDEnet instance. |
rxDefaultDataCb | Pointer to the receive data callback function. |
arg | Argument to be passed to the callback function. |
bool LLDEnetIsRxTsInPkt | ( | LLDEnet_t * | hLLDEnet | ) |
Checks the receive packet timestamping mode.
hLLDEnet | Pointer to the LLDEnet instance. |