PDK API Guide for J721E
CPSW DMA Packet Utils

Introduction

Functions

void CpswUtils_checkPktState (uint32_t *pStateVar, CpswUtils_PktStateModuleType module, uint32_t expectedState, uint32_t newState)
 Packet state check & set API for app, memory manager and dma driver. More...
 
void CpswUtils_checkDescState (uint32_t *pStateVar, CpswUtils_DescStateMemMgr expectedState, CpswUtils_DescStateMemMgr newState)
 Descriptor state check & set API for descriptor memory manager. More...
 

Enumerations

enum  CpswUtils_DescStateMemMgr { CPSW_DESCSTATE_MEMMGR_FREE = 0U, CPSW_DESCSTATE_MEMMGR_ALLOC }
 CPSW DMA Descriptor state. More...
 
enum  CpswUtils_PktStateApp { CPSW_PKTSTATE_APP_WITH_FREEQ = 0U, CPSW_PKTSTATE_APP_WITH_READYQ, CPSW_PKTSTATE_APP_WITH_DRIVER }
 App Pkt state. More...
 
enum  CpswUtils_PktStateDma { CPSW_PKTSTATE_DMA_WITH_HW = 0U, CPSW_PKTSTATE_DMA_NOT_WITH_HW }
 DMA Pkt state. More...
 
enum  CpswUtils_PktStateMemMgr { CPSW_PKTSTATE_MEMMGR_FREE = 0U, CPSW_PKTSTATE_MEMMGR_ALLOC }
 CPSW DMA Pkt state. More...
 
enum  CpswUtils_PktStateModuleType { CPSW_PKTSTATE_MODULE_APP = 0U, CPSW_PKTSTATE_MODULE_DRIVER, CPSW_PKTSTATE_MODULE_MEMUTILS }
 CPSW DMA Pkt state. More...
 

Macros

#define CPSW_UTILS_GET_STATE(state, mask, bitshift)
 
#define CPSW_UTILS_SET_STATE(state, mask, bitshift, value)
 
#define CPSW_UTILS_DRIVER_STATE_MASK   (0x000000FFU)
 
#define CPSW_UTILS_DRIVER_STATE_BIT_SHIFT   (0U)
 
#define CPSW_UTILS_MEMUTILS_STATE_MASK   (0x0000FF00U)
 
#define CPSW_UTILS_MEMUTILS_STATE_BIT_SHIFT   (8U)
 
#define CPSW_UTILS_APP_STATE_MASK   (0x00FF0000U)
 
#define CPSW_UTILS_APP_STATE_BIT_SHIFT   (16U)
 
#define CPSW_UTILS_GET_PKT_DRIVER_STATE(state)
 
#define CPSW_UTILS_SET_PKT_DRIVER_STATE(state, value)
 
#define CPSW_UTILS_GET_PKT_MEMUTILS_STATE(state)
 
#define CPSW_UTILS_SET_PKT_MEMUTILS_STATE(state, value)
 
#define CPSW_UTILS_GET_PKT_APP_STATE(state)
 
#define CPSW_UTILS_SET_PKT_APP_STATE(state, value)
 
#define CPSW_UTILS_MEMUTILS_DESCSTATE_MASK   (0x000000FFU)
 
#define CPSW_UTILS_MEMUTILS_DESCSTATE_SHIFT   (0U)
 
#define CPSW_UTILS_GET_DESC_MEMUTILS_STATE(state)
 
#define CPSW_UTILS_SET_DESC_MEMUTILS_STATE(state, value)
 

Macro Definition Documentation

#define CPSW_UTILS_GET_STATE (   state,
  mask,
  bitshift 
)
Value:
({while (false) {; } \
})
#define CPSW_UTILS_SET_STATE (   state,
  mask,
  bitshift,
  value 
)
Value:
({while (false) {; } \
})
#define CPSW_UTILS_DRIVER_STATE_MASK   (0x000000FFU)
#define CPSW_UTILS_DRIVER_STATE_BIT_SHIFT   (0U)
#define CPSW_UTILS_MEMUTILS_STATE_MASK   (0x0000FF00U)
#define CPSW_UTILS_MEMUTILS_STATE_BIT_SHIFT   (8U)
#define CPSW_UTILS_APP_STATE_MASK   (0x00FF0000U)
#define CPSW_UTILS_APP_STATE_BIT_SHIFT   (16U)
#define CPSW_UTILS_GET_PKT_DRIVER_STATE (   state)
Value:
#define CPSW_UTILS_GET_STATE(state, mask, bitshift)
Definition: cpsw_dma_pktutils.h:71
uint8_t state
Definition: tisci_pm_clock.h:130
#define CPSW_UTILS_DRIVER_STATE_BIT_SHIFT
Definition: cpsw_dma_pktutils.h:78
#define CPSW_UTILS_DRIVER_STATE_MASK
Definition: cpsw_dma_pktutils.h:77
#define CPSW_UTILS_SET_PKT_DRIVER_STATE (   state,
  value 
)
Value:
value))
uint8_t state
Definition: tisci_pm_clock.h:130
#define CPSW_UTILS_DRIVER_STATE_BIT_SHIFT
Definition: cpsw_dma_pktutils.h:78
#define CPSW_UTILS_SET_STATE(state, mask, bitshift, value)
Definition: cpsw_dma_pktutils.h:73
#define CPSW_UTILS_DRIVER_STATE_MASK
Definition: cpsw_dma_pktutils.h:77
#define CPSW_UTILS_GET_PKT_MEMUTILS_STATE (   state)
Value:
#define CPSW_UTILS_GET_STATE(state, mask, bitshift)
Definition: cpsw_dma_pktutils.h:71
uint8_t state
Definition: tisci_pm_clock.h:130
#define CPSW_UTILS_MEMUTILS_STATE_BIT_SHIFT
Definition: cpsw_dma_pktutils.h:81
#define CPSW_UTILS_MEMUTILS_STATE_MASK
Definition: cpsw_dma_pktutils.h:80
#define CPSW_UTILS_SET_PKT_MEMUTILS_STATE (   state,
  value 
)
Value:
value))
uint8_t state
Definition: tisci_pm_clock.h:130
#define CPSW_UTILS_SET_STATE(state, mask, bitshift, value)
Definition: cpsw_dma_pktutils.h:73
#define CPSW_UTILS_MEMUTILS_STATE_BIT_SHIFT
Definition: cpsw_dma_pktutils.h:81
#define CPSW_UTILS_MEMUTILS_STATE_MASK
Definition: cpsw_dma_pktutils.h:80
#define CPSW_UTILS_GET_PKT_APP_STATE (   state)
Value:
#define CPSW_UTILS_GET_STATE(state, mask, bitshift)
Definition: cpsw_dma_pktutils.h:71
#define CPSW_UTILS_APP_STATE_MASK
Definition: cpsw_dma_pktutils.h:83
uint8_t state
Definition: tisci_pm_clock.h:130
#define CPSW_UTILS_APP_STATE_BIT_SHIFT
Definition: cpsw_dma_pktutils.h:84
#define CPSW_UTILS_SET_PKT_APP_STATE (   state,
  value 
)
Value:
value))
#define CPSW_UTILS_APP_STATE_MASK
Definition: cpsw_dma_pktutils.h:83
uint8_t state
Definition: tisci_pm_clock.h:130
#define CPSW_UTILS_SET_STATE(state, mask, bitshift, value)
Definition: cpsw_dma_pktutils.h:73
#define CPSW_UTILS_APP_STATE_BIT_SHIFT
Definition: cpsw_dma_pktutils.h:84
#define CPSW_UTILS_MEMUTILS_DESCSTATE_MASK   (0x000000FFU)
#define CPSW_UTILS_MEMUTILS_DESCSTATE_SHIFT   (0U)
#define CPSW_UTILS_GET_DESC_MEMUTILS_STATE (   state)
Value:
#define CPSW_UTILS_GET_STATE(state, mask, bitshift)
Definition: cpsw_dma_pktutils.h:71
#define CPSW_UTILS_MEMUTILS_DESCSTATE_SHIFT
Definition: cpsw_dma_pktutils.h:120
uint8_t state
Definition: tisci_pm_clock.h:130
#define CPSW_UTILS_MEMUTILS_DESCSTATE_MASK
Definition: cpsw_dma_pktutils.h:119
#define CPSW_UTILS_SET_DESC_MEMUTILS_STATE (   state,
  value 
)
Value:
value))
#define CPSW_UTILS_MEMUTILS_DESCSTATE_SHIFT
Definition: cpsw_dma_pktutils.h:120
uint8_t state
Definition: tisci_pm_clock.h:130
#define CPSW_UTILS_SET_STATE(state, mask, bitshift, value)
Definition: cpsw_dma_pktutils.h:73
#define CPSW_UTILS_MEMUTILS_DESCSTATE_MASK
Definition: cpsw_dma_pktutils.h:119

Enumeration Type Documentation

CPSW DMA Descriptor state.

DMA descriptor state used by CPSW DMA driver for sanity check.

Enumerator
CPSW_DESCSTATE_MEMMGR_FREE 

Desc free

CPSW_DESCSTATE_MEMMGR_ALLOC 

Desc Allocated

App Pkt state.

Packet state for application

Enumerator
CPSW_PKTSTATE_APP_WITH_FREEQ 

Packet with APP Free Q

CPSW_PKTSTATE_APP_WITH_READYQ 

Packet with APP Ready Q

CPSW_PKTSTATE_APP_WITH_DRIVER 

Packet with Driver

DMA Pkt state.

Packet state for DMA

Enumerator
CPSW_PKTSTATE_DMA_WITH_HW 

Packet with HW

CPSW_PKTSTATE_DMA_NOT_WITH_HW 

Packet not with HW

CPSW DMA Pkt state.

Packet state for memory manager

Enumerator
CPSW_PKTSTATE_MEMMGR_FREE 

Packet free

CPSW_PKTSTATE_MEMMGR_ALLOC 

Packet Allocated

CPSW DMA Pkt state.

Type of CPSW DMA Pkt state.

Enumerator
CPSW_PKTSTATE_MODULE_APP 

Module type is app

CPSW_PKTSTATE_MODULE_DRIVER 

Module type is DMA Driver

CPSW_PKTSTATE_MODULE_MEMUTILS 

Module type is MEM Mgr

Function Documentation

void CpswUtils_checkPktState ( uint32_t *  pStateVar,
CpswUtils_PktStateModuleType  module,
uint32_t  expectedState,
uint32_t  newState 
)

Packet state check & set API for app, memory manager and dma driver.

This development time API checks expected state and sets new packet state. This is used by modules handling the packet to confirm the packet is returned and allocated in correct state. Memutils checks (free, allocated), dma driver checks (with Hw, with driver) and app checks which Q it belongs

Parameters
pStateVar[IN/OUT] Pointer to packet state variable of packet structure CpswDma_PktInfo
module[IN] Module id. Refer to CpswUtils_PktStateModuleType
expectedState[IN] State packet is expected to be.
newState[IN] New state packet is set to.
Note
- Optional for MemMgr and app. DMA driver mandatory uses when CPSW_CFG_DEV_ERROR is defined.
void CpswUtils_checkDescState ( uint32_t *  pStateVar,
CpswUtils_DescStateMemMgr  expectedState,
CpswUtils_DescStateMemMgr  newState 
)

Descriptor state check & set API for descriptor memory manager.

This development time API checks expected state and sets new descriptor state. This is used by modules handling the Desc to confirm the Desc is returned and allocated in correct state. Only memutils modules uses it now for checking if desc is free or allocated while allocating or freeing desc respectively.

Parameters
pStateVar[IN/OUT] Pointer to Desc state variable.
expectedState[IN] State Desc is expected to be.
newState[IN] New state Desc is set to.
Note
- memory manager may not allocate the descState as this is optional check for MemMgr.