Data Structures | Typedefs | Functions
cpsw_dma.h File Reference

This file contains the structure definitions and function prototypes of the CPSW Data/DMA path set up. More...

#include <ti/drv/cpsw/include/cpsw_queue.h>
#include <ti/drv/cpsw/include/cpsw_dma_psi.h>

Data Structures

struct  CpswDma_CbFxnStats_s
 Stats for packets submitted/retrieved in the DMA event callbacks functions. More...
 
struct  CpswDma_DmaDescStats_s
 DMA descriptor stats for the flow and channel. More...
 
struct  CpswDma_RxFlowStats_s
 Rx flow statistics. More...
 
struct  CpswDma_TxChStats_s
 TX channel statistics. More...
 
struct  CpswDma_PktInfo_s
 CPPI Buffer info. More...
 
struct  CpswDma_cpswUdmaDesc_s
 CPSW DMA UDMA descriptor format. More...
 
struct  CpswDma_DmaDesc_s
 CPPI DMA descriptor. More...
 
struct  CpswDma_RingMonCfg
 UDMA ring monitor config parameters. More...
 
struct  CpswDma_UdmaRingPrms
 CPSW DMA channel ring parameters. More...
 
struct  CpswDma_UdmaChPrms
 CPSW DMA Rx flow/TX channel ring configuration parameters. More...
 
struct  CpswDma_UdmaFlowPrms
 UDMA RX channel flow parameters. More...
 
struct  CpswDma_UdmaChTxPrms
 CPSW DDMA TX channel parameters. More...
 
struct  CpswDma_OpenRxFlowPrms_s
 Param struct for the get default flowId open parameters. More...
 
struct  CpswDma_OpenTxChPrms_s
 Param struct for the Tx channel open function. More...
 
struct  CpswDma_RxChInitPrms_s
 Param struct for the Rx channel open. More...
 
struct  CpswDma_Config_s
 Config structure for CPSW DMA. More...
 
struct  CpswDma_DataPathConfig_s
 Config structure for CPSW DMA Data Path initialization. More...
 

Macros

CPSW DMA Instance configuration

Configuration macros for CPSW DMA module

#define CPSW_DMA_MAX_TX_CH   (8U)
 
#define CPSW_DMA_MAX_RX_FLOW   (64U)
 
#define CPSW_DMA_MAX_RX_FREE_QUEUE   (4U)
 
#define CPSW_DMA_HPD_SIZE   (128U)
 
#define CPSW_DMA_EXTENDED_PKT_INFO_BLOCK_SIZE   (16U)
 
#define CPSW_DMA_PROTOCOL_SPECIFIC_INFO_BLOCK_SIZE   (16U)
 
#define CPSW_DMA_PKT_DESC_RESERVED_SIZE
 
#define CPSW_DMA_RING_MEM_SIZE   (sizeof(uint64_t))
 
#define CPSW_DMA_RXFLOWIDX_INVALID   (0xABCDABCDU)
 
#define CPSW_DMA_RXMTU_ALIGN   (1U << 5U)
 CPSW DMA RX MTU alignment. The RxFlow Mtu must be aligned to this value. More...
 
CPSW DMA Statistics configuration

No. of latest entries kept in the statistics

#define CPSW_DMA_STATS_HISTORY_CNT   ((uint32_t)32U)
 

Typedefs

typedef struct CpswDma_CbFxnStats_s CpswDma_CbFxnStats
 Stats for packets submitted/retrieved in the DMA event callbacks functions.
 
typedef struct
CpswDma_DmaDescStats_s 
CpswDma_DmaDescStats
 DMA descriptor stats for the flow and channel.
 
typedef struct
CpswDma_RxFlowStats_s 
CpswDma_RxFlowStats
 Rx flow statistics.
 
typedef struct CpswDma_TxChStats_s CpswDma_TxChStats
 TX channel statistics.
 
typedef struct CpswDma_PktInfo_s CpswDma_PktInfo
 CPPI Buffer info. More...
 
typedef struct
CpswDma_cpswUdmaDesc_s 
CpswDma_CpswHpdDesc
 CPSW DMA UDMA descriptor format. More...
 
typedef struct CpswDma_DmaDesc_s CpswDma_DmaDesc
 CPPI DMA descriptor. More...
 
typedef CpswDma_PktInfo *(* CpswDma_AllocEthPktFxn )(void *appPriv, uint32_t pktSize, uint32_t alignSize)
 Function pointer type for Ethernet packet allocation function.
 
typedef void(* CpswDma_FreeEthPktFxn )(CpswDma_PktInfo *pPktInfo)
 Function pointer type for Ethernet packet free function.
 
typedef queue_t CpswDma_PktInfoQ
 Packet Queue. More...
 
typedef struct
CpswDma_OpenRxFlowPrms_s 
CpswDma_OpenRxFlowPrms
 Param struct for the get default flowId open parameters. More...
 
typedef struct
CpswDma_OpenTxChPrms_s 
CpswDma_OpenTxChPrms
 Param struct for the Tx channel open function. More...
 
typedef struct
CpswDma_RxChInitPrms_s 
CpswDma_RxChInitPrms
 Param struct for the Rx channel open. More...
 
typedef struct CpswDma_Config_s CpswDma_Config
 Config structure for CPSW DMA. More...
 
typedef struct
CpswDma_DataPathConfig_s 
CpswDma_DataPathConfig
 Config structure for CPSW DMA Data Path initialization. More...
 
typedef struct CpswDma_DrvObj_s * CpswDma_Handle
 Opaque handle for CPSW DMA driver object. More...
 
CPSW DMA driver opaque handles

Opaque handle typedefs for CPSW DMA driver objects.

typedef struct
CpswDma_RxFlowObj_s * 
CpswDma_RxFlowHandle
 Opaque structure to hold software state for CPSW DMA RX flow.
 
typedef struct CpswDma_TxChObj_s * CpswDma_TxChHandle
 Opaque structure to hold software state for CPSW TX DMA channel.
 
typedef struct CpswDma_PktInfo_sCpswDma_PktHandle
 Opaque structure to hold software state for CPSW Packet Info.
 
CPSW DMA driver Callback function types

Callback function typedefs so that the CpswDma layer can call into the app layer and let it translate between the hardware packet descriptors and packets and the stack/translation layer's buffers and packets.

typedef uint8_t *(* CpswDma_AllocRingMemFxn )(void *appPriv, uint32_t numRingEle, uint32_t alignSize)
 
typedef void(* CpswDma_FreeRingMemFxn )(void *appPriv, void *pRingMem, uint32_t numRingEle)
 
typedef struct
CpswDma_DmaDesc_s *(* 
CpswDma_AllocDmaDesccFxn )(void *appPriv, uint32_t alignSize)
 
typedef void(* CpswDma_FreeDmaDescFxn )(void *appPriv, struct CpswDma_DmaDesc_s *dmaDescPtr)
 
typedef void(* CpswDma_PktNotifyCb )(void *hCbArg)
 

Functions

void CpswDma_initRxFlowParams (CpswDma_OpenRxFlowPrms *pRxFlowPrm)
 Initialize RX flow open parameters. More...
 
void CpswDma_initTxChParams (CpswDma_OpenTxChPrms *pTxChCfg)
 Initialize TX channel open parameters. More...
 
void CpswDma_pktInfoInit (CpswDma_PktInfo *pktInfo)
 Initialize packet information structure. More...
 
CpswDma_RxFlowHandle CpswDma_openRxFlow (CpswDma_OpenRxFlowPrms *pRxFlowPrms)
 CPSW DMA open Rx flow. More...
 
int32_t CpswDma_closeRxFlow (CpswDma_RxFlowHandle hRxFlow, CpswDma_PktInfoQ *pFqPktInfoQ, CpswDma_PktInfoQ *pCqPktInfoQ)
 CPSW DMA close Rx flow. More...
 
CpswDma_TxChHandle CpswDma_openTxCh (CpswDma_OpenTxChPrms *pTxChCfg)
 CPSW DMA open TX channel. More...
 
int32_t CpswDma_closeTxCh (CpswDma_TxChHandle txChHandle, CpswDma_PktInfoQ *pFqPktInfoQ, CpswDma_PktInfoQ *pCqPktInfoQ)
 CPSW DMA close TX channel! More...
 
int32_t CpswDma_enableTxEvent (CpswDma_TxChHandle txChHandle)
 Enable TX channel ring event. More...
 
int32_t CpswDma_disableTxEvent (CpswDma_TxChHandle txChHandle)
 Disable TX channel ring event. More...
 
int32_t CpswDma_enableRxEvent (CpswDma_RxFlowHandle hRxFlow)
 Enable RX flow ring event. More...
 
int32_t CpswDma_disableRxEvent (CpswDma_RxFlowHandle hRxFlow)
 Disable RX flow ring event. More...
 
int32_t CpswDma_retrieveRxPackets (CpswDma_RxFlowHandle hRxFlow, CpswDma_PktInfoQ *pFromFlowQueue)
 Retrieve Rx ready (full) packet queue from Rx flow. More...
 
int32_t CpswDma_submitRxPackets (CpswDma_RxFlowHandle hRxFlow, CpswDma_PktInfoQ *pToFlowQueue, CpswDma_PktInfoQ *pUnUsedPktQueue)
 Submit a queue of free packets for reception from RX flow. More...
 
int32_t CpswDma_retrieveTxDonePackets (CpswDma_TxChHandle hTxCh, CpswDma_PktInfoQ *pFromTxChQueue)
 Retrieve Tx ready (empty) packet queue from Tx channel. More...
 
int32_t CpswDma_submitTxReadyPackets (CpswDma_TxChHandle hTxCh, CpswDma_PktInfoQ *pToTxChQueue, CpswDma_PktInfoQ *pUnUsedPktQueue)
 Submit a queue of ready (full) packet queue to TX channel. More...
 
int32_t CpswDma_checkRxFlowSanity (CpswDma_RxFlowHandle hRxFlow, uint32_t margin)
 Check if any packet loss in RX flow FQ and CQ rings. More...
 
int32_t CpswDma_checkTxChSanity (CpswDma_TxChHandle hTxCh, uint32_t margin)
 Check if any packet loss in TX Channel FQ and CQ rings. More...
 
int32_t CpswDma_getRxFlowStats (CpswDma_RxFlowHandle hRxFlow, CpswDma_RxFlowStats *rxFlowStats)
 Get RX flow statistics. More...
 
int32_t CpswDma_getTxChStats (CpswDma_TxChHandle hTxCh, CpswDma_TxChStats *txChStats)
 Get TX channel statistics. More...
 
int32_t CpswDma_resetRxFlowStats (CpswDma_RxFlowHandle hRxFlow)
 Reset RX flow statistics. More...
 
int32_t CpswDma_resetTxChStats (CpswDma_TxChHandle hTxCh)
 Reset TX channel statistics. More...
 
void CpswDma_initDataPathParams (CpswDma_DataPathConfig *pDmaConfig)
 Set default data path parameters. More...
 
CpswDma_Handle CpswDma_initDataPath (Cpsw_Type cpswType, const CpswDma_DataPathConfig *pCpswDmaDataPathConfig)
 Initialize data path. More...
 
int32_t CpswDma_deInitDataPath (CpswDma_Handle hCpswDma)
 De-initialize data path. More...
 

Detailed Description

This file contains the structure definitions and function prototypes of the CPSW Data/DMA path set up.


Copyright 2020, Texas Instruments Incorporated