RTEMS 6.1-rc1
Modules | Macros | Functions | Variables

Modules

 GMACD Return Codes
 

Macros

#define GCIRC_CNT(head, tail, size)   fixed_mod((head) - (tail), (size))
 
#define GCIRC_SPACE(head, tail, size)   GCIRC_CNT((tail),((head)+1),(size))
 
#define GCIRC_CNT_TO_END(head, tail, size)
 
#define GCIRC_SPACE_TO_END(head, tail, size)
 
#define GCIRC_INC(headortail, size)
 
#define GCIRC_EMPTY(head, tail)   (head == tail)
 
#define GCIRC_CLEAR(head, tail)   (head = tail = 0)
 

Functions

__STATIC_INLINE int fixed_mod (int a, int b)
 
void GMACD_TxPtpEvtMsgCBRegister (sGmacd *pGmacd, fGmacdTxPtpEvtCallBack pTxPtpEvtCb, gmacQueList_t queIdx)
 
void GMACD_Handler (sGmacd *pGmacd, gmacQueList_t queIdx)
 GMAC Interrupt handler. More...
 
void GMACD_Init (sGmacd *pGmacd, Gmac *pHw, uint8_t bID, uint8_t enableCAF, uint8_t enableNBC)
 Initialize the GMAC with the Gmac controller address. More...
 
uint8_t GMACD_InitTransfer (sGmacd *pGmacd, const sGmacInit *pInit, gmacQueList_t queIdx)
 
void GMACD_Reset (sGmacd *pGmacd)
 
uint8_t GMACD_SendSG (sGmacd *pGmacd, const sGmacSGList *sgl, fGmacdTransferCallback fTxCb, gmacQueList_t queIdx)
 Send a frame split into buffers. If the frame size is larger than transfer buffer size error returned. If frame transfer status is monitored, specify callback for each frame. More...
 
uint8_t GMACD_Send (sGmacd *pGmacd, void *pBuffer, uint32_t size, fGmacdTransferCallback fTxCb, gmacQueList_t queIdx)
 Send a packet with GMAC. If the packet size is larger than transfer buffer size error returned. If packet transfer status is monitored, specify callback for each packet. More...
 
uint32_t GMACD_TxLoad (sGmacd *pGmacd, gmacQueList_t queIdx)
 
uint8_t GMACD_Poll (sGmacd *pGmacd, uint8_t *pFrame, uint32_t frameSize, uint32_t *pRcvSize, gmacQueList_t queIdx)
 Receive a packet with GMAC. If not enough buffer for the packet, the remaining data is lost but right frame length is returned. More...
 
void GMACD_SetRxCallback (sGmacd *pGmacd, fGmacdTransferCallback fRxCb, gmacQueList_t queIdx)
 Registers pRxCb callback. Callback will be invoked after the next received frame. When GMAC_Poll() returns GMAC_RX_NO_DATA the application task call GMAC_Set_RxCb() to register pRxCb() callback and enters suspend state. The callback is in charge to resume the task once a new frame has been received. The next time GMAC_Poll() is called, it will be successful. More...
 
uint8_t GMACD_SetTxWakeupCallback (sGmacd *pGmacd, fGmacdWakeupCallback fWakeup, uint8_t bThreshold, gmacQueList_t queIdx)
 

Variables

uint8_t ptpTxQueWriteIdx = 0u
 
uint8_t ptpTxQueReadIdx = 0u
 
ptpMsgType gPtpMsgTxQue [EFRS_BUFFER_LEN]
 
uint16_t gPtpMsgTxSeqId [EFRS_BUFFER_LEN]
 
const uint32_t isrMasks []
 

Detailed Description

Macro Definition Documentation

◆ GCIRC_CLEAR

#define GCIRC_CLEAR (   head,
  tail 
)    (head = tail = 0)

Clear circular buffer

◆ GCIRC_CNT

#define GCIRC_CNT (   head,
  tail,
  size 
)    fixed_mod((head) - (tail), (size))

Return count in buffer

◆ GCIRC_CNT_TO_END

#define GCIRC_CNT_TO_END (   head,
  tail,
  size 
)
Value:
({int end = (size) - (tail); \
int n = fixed_mod((head) + end, (size)); \
n < end ? n : end;})
__STATIC_INLINE int fixed_mod(int a, int b)
Definition: gmacd.c:51
unsigned size
Definition: tte.h:1

Return count up to the end of the buffer. Carefully avoid accessing head and tail more than once, so they can change underneath us without returning inconsistent results

◆ GCIRC_EMPTY

#define GCIRC_EMPTY (   head,
  tail 
)    (head == tail)

Circular buffer is empty ?

◆ GCIRC_INC

#define GCIRC_INC (   headortail,
  size 
)
Value:
headortail++; \
if (headortail >= size) { \
headortail = 0; \
}

Increment head or tail

◆ GCIRC_SPACE

#define GCIRC_SPACE (   head,
  tail,
  size 
)    GCIRC_CNT((tail),((head)+1),(size))

Return space available, 0..size-1. always leave one free char as a completely full buffer has head == tail, which is the same as empty

◆ GCIRC_SPACE_TO_END

#define GCIRC_SPACE_TO_END (   head,
  tail,
  size 
)
Value:
({int end = (size) - 1 - (head); \
int n = fixed_mod(end + (tail), (size)); \
n <= end ? n : end+1;})

Return space available up to the end of the buffer

Function Documentation

◆ fixed_mod()

__STATIC_INLINE int fixed_mod ( int  a,
int  b 
)

ISO/IEC 14882:2003(E) - 5.6 Multiplicative operators: The binary / operator yields the quotient, and the binary % operator yields the remainder from the division of the first expression by the second. If the second operand of / or % is zero the behaviour is undefined; otherwise (a/b)*b + ab is equal to a. If both operands are non-negative then the remainder is non-negative; if not, the sign of the remainder is implementation-defined 74).

◆ GMACD_Handler()

void GMACD_Handler ( sGmacd pGmacd,
gmacQueList_t  queIdx 
)

GMAC Interrupt handler.

Parameters
pGmacdPointer to GMAC Driver instance.

◆ GMACD_Init()

void GMACD_Init ( sGmacd pGmacd,
Gmac pHw,
uint8_t  bID,
uint8_t  enableCAF,
uint8_t  enableNBC 
)

Initialize the GMAC with the Gmac controller address.

Parameters
pGmacdPointer to GMAC Driver instance.
pHwPointer to HW address for registers.
bIDHW ID for power management
enableCAFEnable/Disable CopyAllFrame.
enableNBCEnable/Disable NoBroadCast.

◆ GMACD_InitTransfer()

uint8_t GMACD_InitTransfer ( sGmacd pGmacd,
const sGmacInit pInit,
gmacQueList_t  queIdx 
)

Initialize necessary allocated buffer lists for GMAC Driver to transfer data. Must be invoked after GMACD_Init() but before RX/TX start. Replace the deprecated GMACD_InitTransfer().

Parameters
pGmacdPointer to GMAC Driver instance.
pInitPointer to sGmacInit.
pInitPointer to gmacQueList_t for different queue.
Returns
GMACD_OK or GMACD_PARAM.
Note
If input address is not 8-byte aligned the address is automatically adjusted and the list size is reduced by one.

◆ GMACD_Poll()

uint8_t GMACD_Poll ( sGmacd pGmacd,
uint8_t *  pFrame,
uint32_t  frameSize,
uint32_t *  pRcvSize,
gmacQueList_t  queIdx 
)

Receive a packet with GMAC. If not enough buffer for the packet, the remaining data is lost but right frame length is returned.

Parameters
pGmacdPointer to GMAC Driver instance.
pFrameBuffer to store the frame
frameSizeSize of the frame
pRcvSizeReceived size
Returns
OK, no data, or frame too small

◆ GMACD_Reset()

void GMACD_Reset ( sGmacd pGmacd)

Reset TX & RX queue & statistics

Parameters
pGmacdPointer to GMAC Driver instance.

◆ GMACD_Send()

uint8_t GMACD_Send ( sGmacd pGmacd,
void *  pBuffer,
uint32_t  size,
fGmacdTransferCallback  fTxCb,
gmacQueList_t  queIdx 
)

Send a packet with GMAC. If the packet size is larger than transfer buffer size error returned. If packet transfer status is monitored, specify callback for each packet.

Parameters
pGmacdPointer to GMAC Driver instance.
pBufferThe buffer to be send
sizeThe size of buffer to be send
fTxCbThreshold Wakeup callback
Returns
OK, Busy or invalid packet

◆ GMACD_SendSG()

uint8_t GMACD_SendSG ( sGmacd pGmacd,
const sGmacSGList sgl,
fGmacdTransferCallback  fTxCb,
gmacQueList_t  queIdx 
)

Send a frame split into buffers. If the frame size is larger than transfer buffer size error returned. If frame transfer status is monitored, specify callback for each frame.

Parameters
pGmacdPointer to GMAC Driver instance.
sglPointer to a scatter-gather list describing the buffers of the ethernet frame.
fTxCbPointer to callback function.

◆ GMACD_SetRxCallback()

void GMACD_SetRxCallback ( sGmacd pGmacd,
fGmacdTransferCallback  fRxCb,
gmacQueList_t  queIdx 
)

Registers pRxCb callback. Callback will be invoked after the next received frame. When GMAC_Poll() returns GMAC_RX_NO_DATA the application task call GMAC_Set_RxCb() to register pRxCb() callback and enters suspend state. The callback is in charge to resume the task once a new frame has been received. The next time GMAC_Poll() is called, it will be successful.

Parameters
pGmacdPointer to GMAC Driver instance.
fRxCbPointer to callback function
Returns
OK, no data, or frame too small

◆ GMACD_SetTxWakeupCallback()

uint8_t GMACD_SetTxWakeupCallback ( sGmacd pGmacd,
fGmacdWakeupCallback  fWakeup,
uint8_t  bThreshold,
gmacQueList_t  queIdx 
)

Register/Clear TX wakeup callback.

When GMACD_Send() returns GMACD_TX_BUSY (all TD busy) the application task calls GMACD_SetTxWakeupCallback() to register fWakeup() callback and enters suspend state. The callback is in charge to resume the task once several TD have been released. The next time GMACD_Send() will be called, it shall be successful.

This function is usually invoked with NULL callback from the TX wakeup callback itself, to unregister. Once the callback has resumed the application task, there is no need to invoke the callback again.

Parameters
pGmacdPointer to GMAC Driver instance.
fWakeupWakeup callback.
bThresholdNumber of free TD before wakeup callback invoked.
Returns
GMACD_OK, GMACD_PARAM on parameter error.

◆ GMACD_TxLoad()

uint32_t GMACD_TxLoad ( sGmacd pGmacd,
gmacQueList_t  queIdx 
)

Return current load of TX.

Parameters
pGmacdPointer to GMAC Driver instance.

Variable Documentation

◆ isrMasks

const uint32_t isrMasks[]
Initial value:
= { GMAC_IMR_SFT, GMAC_IMR_DRQFT,
GMAC_IMR_PDRQFT , GMAC_IMR_PDRSFT
}