AM243x MCU+ SDK  09.00.00
EnetLLD_network

Introduction

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

Functions

void LLDTSyncCfgInit (LLDTSyncCfg_t *cfg)
 Initializes the LLDTSyncCfg_t configuration structure. More...
 
LLDTSync_tLLDTSyncOpen (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...
 
void LLDEnetCfgInit (LLDEnetCfg_t *cfg)
 Initializes the LLDEnetCfg_t structure. More...
 
LLDEnet_tLLDEnetOpen (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)
 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 LLDEnetRecv (LLDEnet_t *hLLDEnet, LLDEnetFrame_t *frame)
 Receives an Ethernet frame using LLDEnet. 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 LLDEnetTasSetConfig (LLDEnet_t *hLLDEnet, uint8_t macPort, void *arg)
 Set parameters for schedule traffic. More...
 
int LLDEnetIETSetConfig (LLDEnet_t *hLLDEnet, uint8_t macPort, void *reqPrm, void *resPrm)
 Set frame preemption parameters for the port indicated by macPort. More...
 

Typedefs

typedef struct LLDTSync LLDTSync_t
 Structure representing the LLDTSync instance. More...
 
typedef struct LLDEnet LLDEnet_t
 Structure representing the LLDEnet instance. 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_MAX_PORTS   10
 

Macro Definition Documentation

◆ LLDENET_E_OK

#define LLDENET_E_OK   (0)

no error

◆ LLDENET_E_PARAM

#define LLDENET_E_PARAM   (-1)

param invalid

◆ LLDENET_E_NOBUF

#define LLDENET_E_NOBUF   (-2)

no buffer

◆ LLDENET_E_BUFSIZE

#define LLDENET_E_BUFSIZE   (-3)

small or invalid bufsize

◆ LLDENET_E_NOAVAIL

#define LLDENET_E_NOAVAIL   (-4)

request for a not available resource

◆ LLDENET_E_DMA

#define LLDENET_E_DMA   (-5)

dma error

◆ LLDENET_E_IOCTL

#define LLDENET_E_IOCTL   (-6)

enet ioctl error

◆ LLDENET_MAX_PORTS

#define LLDENET_MAX_PORTS   10

Maximum number of ports supported by the Enet LLD abstract layer

Typedef Documentation

◆ LLDTSync_t

typedef struct LLDTSync LLDTSync_t

Structure representing the LLDTSync instance.

◆ LLDEnet_t

typedef struct LLDEnet LLDEnet_t

Structure representing the LLDEnet instance.

Function Documentation

◆ LLDTSyncCfgInit()

void LLDTSyncCfgInit ( LLDTSyncCfg_t cfg)

Initializes the LLDTSyncCfg_t configuration structure.

Parameters
cfgPointer to the LLDTSyncCfg_t configuration structure.

◆ LLDTSyncOpen()

LLDTSync_t* LLDTSyncOpen ( LLDTSyncCfg_t cfg)

Opens a new LLDTSync instance to access the PTP clock.

Parameters
cfgPointer to the LLDTSyncCfg_t configuration structure.
Returns
Pointer to the opened LLDTSync instance.

◆ LLDTSyncClose()

void LLDTSyncClose ( LLDTSync_t hTSync)

Closes the LLDTSync instance.

Parameters
hTSyncPointer to the LLDTSync instance.

◆ LLDTSyncGetRxTime()

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.

Parameters
hTSyncPointer to the LLDTSync instance.
rxPortReceive port.
msgTypeMessage type.
seqIdSequence ID.
domainDomain number.
tsPointer to store the PTP RX timestamp.
Returns
LLDENET_E_OK if successful, an error code otherwise.

◆ LLDTSyncGetTxTime()

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.

Parameters
hTSyncPointer to the LLDTSync instance.
txPortTransmit port.
msgTypeMessage type.
seqIdSequence ID.
domainDomain number.
tsPointer to store the PTP TX timestamp.
Returns
LLDENET_E_OK if successful, an error code otherwise.

◆ LLDTSyncAdjFreq()

int LLDTSyncAdjFreq ( LLDTSync_t hTSync,
int  ppb 
)

Adjusts the frequency of the PTP clock.

Parameters
hTSyncPointer to the LLDTSync instance.
ppbParts per billion adjustment value.
Returns
LLDENET_E_OK if successful, an error code otherwise.

◆ LLDTSyncSetTime()

int LLDTSyncSetTime ( LLDTSync_t hTSync,
uint64_t  ts 
)

Sets the time for the PTP clock.

Parameters
hTSyncPointer to the LLDTSync instance.
tsTime to set.
Returns
LLDENET_E_OK if successful, an error code otherwise.

◆ LLDTSyncGetTime()

int LLDTSyncGetTime ( LLDTSync_t hTSync,
uint64_t *  ts 
)

Retrieves the current time from the PTP clock.

Parameters
hTSyncPointer to the LLDTSync instance.
tsPointer to store the current time.
Returns
LLDENET_E_OK if successful, an error code otherwise.

◆ LLDTSyncEnableTsEvent()

int LLDTSyncEnableTsEvent ( LLDTSync_t hTSync,
uint32_t  ports[],
uint32_t  numPorts 
)

Enables PTP timestamp events for specified ports.

Parameters
hTSyncPointer to the LLDTSync instance.
portsArray of ports to enable timestamp events for.
numPortsNumber of ports in the array.
Returns
LLDENET_E_OK if successful, an error code otherwise.

◆ LLDEnetCfgInit()

void LLDEnetCfgInit ( LLDEnetCfg_t cfg)

Initializes the LLDEnetCfg_t structure.

Parameters
cfgPointer to the LLDEnetCfg_t structure to be initialized.

◆ LLDEnetOpen()

LLDEnet_t* LLDEnetOpen ( LLDEnetCfg_t cfg)

Opens an instance of LLDEnet.

Parameters
cfgPointer to the LLDEnetCfg_t structure containing the configuration parameters.
Returns
Pointer to the LLDEnet instance (LLDEnet_t) if successful, NULL otherwise.

◆ LLDEnetClose()

void LLDEnetClose ( LLDEnet_t hLLDEnet)

Closes an instance of LLDEnet.

Parameters
hLLDEnetPointer to the LLDEnet instance.

◆ LLDEnetFilter()

int LLDEnetFilter ( LLDEnet_t hLLDEnet,
uint8_t *  dstMacAddr,
uint32_t  vlanId 
)

Filter RX packets by using the destination MAC address and VLAN ID.

Parameters
hLLDEnetPointer to the LLDEnet instance.
dstMacAddrDestination MAC address to filter.
vlanIdVLAN ID to filter.
Returns
LLDENET_E_OK if successful, an error code otherwise.

◆ LLDEnetAllocMac()

int LLDEnetAllocMac ( LLDEnet_t hLLDEnet,
uint8_t *  srcMacAddr 
)

Allocates a source MAC address.

Parameters
hLLDEnetPointer to the LLDEnet instance.
srcMacAddrPointer to store the allocated MAC address.
Returns
LLDENET_E_OK if successful, an error code otherwise.

◆ LLDEnetFreeMac()

void LLDEnetFreeMac ( LLDEnet_t hLLDEnet,
uint8_t *  srcMacAddr 
)

Frees a previously allocated MAC address.

Parameters
hLLDEnetPointer to the LLDEnet instance.
srcMacAddrMAC address to be freed.

◆ LLDEnetSend()

int LLDEnetSend ( LLDEnet_t hLLDEnet,
LLDEnetFrame_t frame 
)

Sends an Ethernet frame using LLDEnet.

Parameters
hLLDEnetPointer to the LLDEnet instance.
framePointer to the LLDEnetFrame_t structure representing the frame to be sent.
Returns
LLDENET_E_OK if successful, an error code otherwise.

◆ LLDEnetSendMulti()

int LLDEnetSendMulti ( LLDEnet_t hLLDEnet,
LLDEnetFrame_t frames,
uint32_t  nFrames 
)

Sends multiple Ethernet frames using LLDEnet.

Parameters
hLLDEnetPointer to the LLDEnet instance.
framesArray of LLDEnetFrame_t structures representing the frames to be sent.
nFramesNumber of frames in the array.
Returns
LLDENET_E_OK if successful, an error code otherwise.

◆ LLDEnetRecv()

int LLDEnetRecv ( LLDEnet_t hLLDEnet,
LLDEnetFrame_t frame 
)

Receives an Ethernet frame using LLDEnet.

Parameters
hLLDEnetPointer to the LLDEnet instance.
framePointer to the LLDEnetFrame_t structure to store the received frame.
Returns
LLDENET_E_OK if successful, an error code otherwise.

◆ LLDEnetIsPortUp()

bool LLDEnetIsPortUp ( LLDEnet_t hLLDEnet,
uint8_t  portNum 
)

Checks if the specified port is up.

Parameters
hLLDEnetPointer to the LLDEnet instance.
portNumPort number to check.
Returns
True if the port is up, false otherwise.

◆ LLDEnetGetLinkInfo()

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.

Parameters
hLLDEnetPointer to the LLDEnet instance.
portNumPort number to retrieve the link information.
speedPointer to store the link speed.
duplexPointer to store the link duplex mode.
Returns
LLDENET_E_OK if successful, an error code otherwise.

◆ LLDEnetSetTxNotifyCb()

int LLDEnetSetTxNotifyCb ( LLDEnet_t hLLDEnet,
void(*)(void *arg)  txNotifyCb,
void *  arg 
)

Sets the transmit notification callback function for LLDEnet.

Parameters
hLLDEnetPointer to the LLDEnet instance.
txNotifyCbPointer to the transmit notification callback function.
argArgument to be passed to the callback function.
Returns
LLDENET_E_OK if successful, an error code otherwise.

◆ LLDEnetSetRxNotifyCb()

int LLDEnetSetRxNotifyCb ( LLDEnet_t hLLDEnet,
void(*)(void *arg)  rxNotifyCb,
void *  arg 
)

Sets the receive notification callback function for LLDEnet.

Parameters
hLLDEnetPointer to the LLDEnet instance.
rxNotifyCbPointer to the receive notification callback function.
argArgument to be passed to the callback function.
Returns
LLDENET_E_OK if successful, an error code otherwise.

◆ LLDEnetTasSetConfig()

int LLDEnetTasSetConfig ( LLDEnet_t hLLDEnet,
uint8_t  macPort,
void *  arg 
)

Set parameters for schedule traffic.

Parameters
hLLDEnetPointer to the LLDEnet instance.
macPortport number of the MAC port to be configured with TAS parameters.
arginput argument to be configured. The caller shall pass an object of cbl_tas_sched_params_t via this argument.
Returns
LLDENET_E_OK: on success, an error code otherwise.

◆ LLDEnetIETSetConfig()

int LLDEnetIETSetConfig ( LLDEnet_t hLLDEnet,
uint8_t  macPort,
void *  reqPrm,
void *  resPrm 
)

Set frame preemption parameters for the port indicated by macPort.

Parameters
hLLDEnetPointer to the LLDEnet instance.
macPortport number of the MAC port to be configured with TAS parameters.
reqPrminput argument to be configured. The caller shall pass an object of cbl_preempt_params_t via this argument.
resPrmresponse parameters will be stored in this object. The caller shall pass address of an object cbl_cb_event_t to this API.
Returns
LLDENET_E_OK: on success, an error code otherwise.