# CPPI Low Level Driver Functions
[CPPI]

## Functions

static void | Cppi_setDescType (Cppi_Desc *descAddr, Cppi_DescType descType)
static Cppi_DescType | Cppi_getDescType (Cppi_Desc *descAddr)
static uint32_t | Cppi_getDescError (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_setData (Cppi_DescType descType, Cppi_Desc *descAddr, uint8_t *buffAddr, uint32_t buffLen)
static void | Cppi_getData (Cppi_DescType descType, Cppi_Desc *descAddr, uint8_t **buffAddr, uint32_t *buffLen)
static void | Cppi_setDataLen (Cppi_DescType descType, Cppi_Desc *descAddr, uint32_t buffLen)
static uint32_t | Cppi_getDataLen (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_linkNextBD (Cppi_DescType descType, Cppi_Desc *descAddr, Cppi_Desc *nextBD)
static Cppi_Desc * | Cppi_getNextBD (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_setOriginalBufInfo (Cppi_DescType descType, Cppi_Desc *descAddr, uint8_t *buffAddr, uint32_t buffLen)
static void | Cppi_getOriginalBufInfo (Cppi_DescType descType, Cppi_Desc *descAddr, uint8_t **buffAddr, uint32_t *buffLen)
static void | Cppi_setPacketType (Cppi_DescType descType, Cppi_Desc *descAddr, uint8_t packetType)
static uint8_t | Cppi_getPacketType (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_setTimeStamp (Cppi_DescType descType, Cppi_Desc *descAddr, uint32_t timeStamp)
static Cppi_Result | Cppi_getTimeStamp (Cppi_DescType descType, Cppi_Desc *descAddr, uint32_t *timeStamp)
static void | Cppi_setSoftwareInfo (Cppi_DescType descType, Cppi_Desc *descAddr, uint8_t *infoAddr)
static Cppi_Result | Cppi_getSoftwareInfo (Cppi_DescType descType, Cppi_Desc *descAddr, uint8_t **infoAddr)
static void | Cppi_setSoftwareInfo0 (Cppi_DescType descType, Cppi_Desc *descAddr, uint32_t value)
static uint32_t | Cppi_getSoftwareInfo0 (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_setSoftwareInfo1 (Cppi_DescType descType, Cppi_Desc *descAddr, uint32_t value)
static uint32_t | Cppi_getSoftwareInfo1 (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_setSoftwareInfo2 (Cppi_DescType descType, Cppi_Desc *descAddr, uint32_t value)
static uint32_t | Cppi_getSoftwareInfo2 (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_setPSData (Cppi_DescType descType, Cppi_Desc *descAddr, uint8_t *dataAddr, uint32_t dataLen)
static Cppi_Result | Cppi_getPSData (Cppi_DescType descType, Cppi_PSLoc location, Cppi_Desc *descAddr, uint8_t **dataAddr, uint32_t *dataLen)
static void | Cppi_setPSLen (Cppi_DescType descType, Cppi_Desc *descAddr, uint32_t dataLen)
static uint32_t | Cppi_getPSLen (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_setPacketLen (Cppi_DescType descType, Cppi_Desc *descAddr, uint32_t packetLen)
static uint32_t | Cppi_getPacketLen (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_setPSLocation (Cppi_DescType descType, Cppi_Desc *descAddr, Cppi_PSLoc location)
static Cppi_PSLoc | Cppi_getPSLocation (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_setPSFlags (Cppi_DescType descType, Cppi_Desc *descAddr, uint8_t psFlags)
static uint8_t | Cppi_getPSFlags (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_setOrigBufferpooIndex (Cppi_DescType descType, Cppi_Desc *descAddr, uint8_t poolIndex)
static uint8_t | Cppi_getOrigBufferpooIndex (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_incrementRefCount (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_decrementRefCount (Cppi_DescType descType, Cppi_Desc *descAddr)
static uint8_t | Cppi_getRefCount (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_setDataOffset (Cppi_DescType descType, Cppi_Desc *descAddr, uint32_t dataOffset)
static uint32_t | Cppi_getDataOffset (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_setReturnPolicy (Cppi_DescType descType, Cppi_Desc *descAddr, Cppi_ReturnPolicy returnPolicy)
static Cppi_ReturnPolicy | Cppi_getReturnPolicy (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_setReturnPushPolicy (Cppi_DescType descType, Cppi_Desc *descAddr, Qmss_Location returnPushPolicy)
static Qmss_Location | Cppi_getReturnPushPolicy (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_setReturnQueue (Cppi_DescType descType, Cppi_Desc *descAddr, Qmss_Queue queue)
static Qmss_Queue | Cppi_getReturnQueue (Cppi_DescType descType, Cppi_Desc *descAddr)
static void | Cppi_setTag (Cppi_DescType descType, Cppi_Desc *descAddr, Cppi_DescTag *tag)
static Cppi_DescTag | Cppi_getTag (Cppi_DescType descType, Cppi_Desc *descAddr)
Qmss_QueueHnd | Cppi_initDescriptor (Cppi_DescCfg *descCfg, uint32_t *numAllocated)
Cppi_Result | Cppi_initCfg (Cppi_GlobalConfigParams *cppiGblCfgParams, Cppi_InitCfg *initCfg)
Cppi_Result | Cppi_init (Cppi_GlobalConfigParams *cppiGblCfgParams)
Cppi_Result | Cppi_getHeapReq (Cppi_GlobalConfigParams *cppiGblCfgParams, uint32_t *size)
void | Cppi_startCfg (Cppi_StartCfg *startCfg)
Cppi_Result | Cppi_exit (void)
Cppi_Handle | Cppi_open (Cppi_CpDmaInitCfg *initCfg)
Cppi_Result | Cppi_close (Cppi_Handle hnd)
Cppi_ChHnd | Cppi_txChannelOpen (Cppi_Handle hnd, Cppi_TxChInitCfg *cfg, uint8_t *isAllocated)
Cppi_ChHnd | Cppi_rxChannelOpen (Cppi_Handle hnd, Cppi_RxChInitCfg *cfg, uint8_t *isAllocated)
Cppi_Result | Cppi_channelEnable (Cppi_ChHnd hnd)
Cppi_Result | Cppi_channelDisable (Cppi_ChHnd hnd)
Cppi_Result | Cppi_channelTeardown (Cppi_ChHnd hnd, Cppi_Wait wait)
Cppi_Result | Cppi_channelClose (Cppi_ChHnd hnd)
Cppi_Result | Cppi_channelPause (Cppi_ChHnd hnd)
Cppi_Result | Cppi_channelStatus (Cppi_ChHnd hnd)
Cppi_FlowHnd | Cppi_configureRxFlow (Cppi_Handle hnd, Cppi_RxFlowCfg *cfg, uint8_t *isAllocated)
Cppi_Result | Cppi_closeRxFlow (Cppi_FlowHnd hnd)
uint32_t | Cppi_getChannelNumber (Cppi_ChHnd hnd)
uint32_t | Cppi_getFlowId (Cppi_FlowHnd hnd)
Cppi_Result | Cppi_setCpdmaLoopback (Cppi_Handle hnd, uint8_t loopback)
Cppi_Result | Cppi_getCpdmaLoopback (Cppi_Handle hnd)
uint32_t | Cppi_getVersion (void)
const char * | Cppi_getVersionStr (void)

## Function Documentation

Cppi_Result Cppi_channelClose | ( | Cppi_ChHnd | hnd | ) |

Description
This function closes a transmit or a receive channel. The channel reference count is decremented. The channel is freed only if the reference count is zero.

Parameters:

  `[in]` | hnd | Channel handle.

Precondition:
  Cppi_rxChannelOpen or Cppi_txChannelOpen function should be called before calling this function.

Postcondition:
  Channel is freed if the reference count is zero and available for reallocation.

Return values:

  | Success | - Current reference count.
  | Failure | - CPPI_INVALID_PARAM
  | Failure | - CPPI_CHANNEL_NOT_OPEN

Cppi_Result Cppi_channelDisable | ( | Cppi_ChHnd | hnd | ) |

Description
This function disables a transmit or a receive channel.

Parameters:

  `[in]` | hnd | Channel handle.

Precondition:
  Cppi_rxChannelOpen or Cppi_txChannelOpen function should be called before calling this function.

Return values:

  | Success | - CPPI_SOK
  | Failure | - CPPI_INVALID_PARAM

Cppi_Result Cppi_channelEnable | ( | Cppi_ChHnd | hnd | ) |

Description
This function enables a transmit or a receive channel.

Parameters:

  `[in]` | hnd | Channel handle.

Precondition:
  Cppi_rxChannelOpen or Cppi_txChannelOpen function should be called before calling this function.

Return values:

  | Success | - CPPI_SOK
  | Failure | - CPPI_INVALID_PARAM

Cppi_Result Cppi_channelPause | ( | Cppi_ChHnd | hnd | ) |

Description
This function pauses a transmit or a receive channel.

Parameters:

  `[in]` | hnd | Channel handle.

Precondition:
  Cppi_rxChannelOpen or Cppi_txChannelOpen function should be called before calling this function.

Return values:

  | Success | - CPPI_SOK
  | Failure | - CPPI_INVALID_PARAM

Cppi_Result Cppi_channelStatus | ( | Cppi_ChHnd | hnd | ) |

Description
This function returns the enable or disable channel status.

Parameters:

  `[in]` | hnd | Channel handle.

Precondition:
  Cppi_rxChannelOpen or Cppi_txChannelOpen function should be called before calling this function.

Return values:

  | Success | - Channel Status
  | Failure | - CPPI_INVALID_PARAM

Cppi_Result Cppi_channelTeardown | ( | Cppi_ChHnd | hnd,
|  | Cppi_Wait | wait |
| ) |  |  |

Description
This function tears down a transmit or a receive channel by writing to the channel teardown bit. This function can do a blocking wait for the teardown to complete OR return immediately and it is up to the callee to check for channel teardown status. The behavior is based on the "wait" input parameter

Parameters:

  `[in]` | hnd | Channel handle.
  `[in]` | wait | Specifies Wait or No Wait for teardown complete.

Precondition:
  Cppi_rxChannelOpen or Cppi_txChannelOpen function should be called before calling this function.

Return values:

  | Success | - CPPI_SOK
  | Failure | - CPPI_INVALID_PARAM

Cppi_Result Cppi_close | ( | Cppi_Handle | hnd | ) |

Description
This function closes the CPPI CPDMA instance. The instance reference count is decremented. CPPI CPDMA instance is closed only if the reference count is zero. CPPI CPDMA instance is closed only if all the Rx, Tx channels and Rx flows are closed. This function should be called to close all instances before re-opening the CPPI CPDMA instance.

Parameters:

  `[in]` | hnd | handle returned by Cppi_open API.

Precondition:
  Cppi_open function should be called before calling this function.

Postcondition:
  CPPI CPDMA object is freed if the reference count is zero.

Return values:

  | Success | - Current reference count.
  | Failure | - CPPI_INVALID_PARAM
  | Failure | - CPPI_CPDMA_NOT_INITIALIZED
  | Failure | - CPPI_TX_CHANNELS_NOT_CLOSED
  | Failure | - CPPI_RX_CHANNELS_NOT_CLOSED
  | Failure | - CPPI_RX_FLOWS_NOT_CLOSED

Cppi_Result Cppi_closeRxFlow | ( | Cppi_FlowHnd | hnd | ) |

Description
This function closes a receive flow. The flow reference count is decremented. The flow is freed only if the reference count is zero.

Parameters:

  `[in]` | hnd | flow handle.

Precondition:
  Cppi_configureRxFlowfunction should be called before calling this function.

Postcondition:
  Flow is freed if the reference count is zero and available for reallocation.

Return values:

  | Success | - Current reference count.
  | Failure | - CPPI_INVALID_PARAM
  | Failure | - CPPI_FLOW_NOT_OPEN

Cppi_FlowHnd Cppi_configureRxFlow | ( | Cppi_Handle | hnd,
|  | Cppi_RxFlowCfg * | cfg,
|  | uint8_t * | isAllocated |
| ) |  |  |

Description
This function configures a receive flow. The flow can be configured in two ways: 1) If flow ID number in cfg structure is set to CPPI_PARAM_NOT_SPECIFIED, then a new available flow is allocated. 2) If flow ID number is cfg structure is a valid flow i.e., >= 0, then the flow is allocated if free else a handle to a previously opened flow is returned.

The flow is configured only if it is a new flow allocation.

Parameters:

  `[in]` | hnd | handle returned by Cppi_open API.
  `[in]` | cfg | Rx flow configuration
  `[out]` | isAllocated | Indicates whether the requested flow is a new flow allocation(1). or was already allocated. If the flow was previously allocated this parameter returns the reference count.

Precondition:
  Cppi_open function should be called before calling this function.

Postcondition:
  Rx flow is allocated and configured.

Return values:

  | Success | - Flow Handle.
  | Failure | - NULL

static void Cppi_decrementRefCount | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to decrement the number of references that have been made to the attached buffer by different descriptors. Multiple buffer references are commonly used to implement broadcast and multicast packet forwarding when zero packet data copies are desired.

**No validation is done on the input parameters**. **No check is made to prevent overflow **.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  Word 6 (Bit 22 to 27) of host descriptor is updated.

Return values:

  | None |

Cppi_Result Cppi_exit | ( | void |  | ) |

Description
This function deinitializes the CPPI low level driver. The LLD is deinitialized only if all the CPDMA instances are closed. This function should be called before re-initializing the CPPI low level driver.

Precondition:
  Cppi_init function should be called before calling this function.

Postcondition:
  CPPI instance is closed.

Return values:

  | Success | - CPPI_SOK
  | Failure | - CPPI_CPDMA_NOT_CLOSED

uint32_t Cppi_getChannelNumber | ( | Cppi_ChHnd | hnd | ) |

Description
Given the channel handle the function returns the channel number corresponding to the handle

Parameters:

  `[in]` | hnd | Channel handle

Precondition:
  Cppi_rxChannelOpen or Cppi_txChannelOpen function should be called before calling this function.

Return values:

  | Channel | number

Cppi_Result Cppi_getCpdmaLoopback | ( | Cppi_Handle | hnd | ) |

Description
This function returns the CPDMA loopback configuration

Parameters:

  `[in]` | hnd | handle returned by Cppi_open API.

Precondition:
  Cppi_open function should be called before calling this function.

Return values:

  | Success | 0 - loopback is disabled 1 - loopback is enabled
  | Failure | - CPPI_INVALID_PARAM
  | Failure | - CPPI_CPDMA_NOT_INITIALIZED

static void Cppi_getData | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint8_t ** | buffAddr,
|  | uint32_t * | buffLen |
| ) |  |  | `[inline, static]`

Description
This function is used to retrieve the data buffer pointer from the host descriptor and payload from monolithic descriptor. Note that if PS data is present in SOP buffer, the offset to data must calculated by the caller

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[out]` | buffAddr | Memory address of data buffer.
  `[out]` | buffLen | Size of the data buffer.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  In case of host descriptor Word 3 and Word 4 are returned In case of monolithic descriptor Word 0 (bits 0 to 15) and payload are returned.

Return values:

  | None. |

static uint32_t Cppi_getDataLen | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to retrieve the data length from host or monolithic descriptor

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Return values:

  | In | case of host descriptor Word 3 is returned In case of monolithic descriptor Word 0 (bits 0 to 15) is returned.

static uint32_t Cppi_getDataOffset | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to get the payload data offset from the monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Return values:

  | 9 | bit data offset. Valid range is 0 to 511 bytes

static uint32_t Cppi_getDescError | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to retrieve the error flags (Word 2 bits 20:23) from the host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Return values:

  | 4 | bit Error flag value from descriptor.

static Cppi_DescType Cppi_getDescType | ( | Cppi_Desc * | descAddr | ) | `[inline, static]`

Description
This function is used to get the type of descriptor. Call this function if the descriptor type is not known so it can be passed to the remaining descriptor manipulation functions.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Return values:

  | Word | 0(bits 30 to 31) are returned

0 - Host descriptor 2 - Monolithic descriptor

uint32_t Cppi_getFlowId | ( | Cppi_FlowHnd | hnd | ) |

Description
Given the flow handle the function returns the flow ID corresponding to the handle

Parameters:

  `[in]` | hnd | Flow handle

Precondition:
  Cppi_configureRxFlowfunction should be called before calling this function.

Return values:

  | Flow | ID

Cppi_Result Cppi_getHeapReq | ( | Cppi_GlobalConfigParams * | cppiGblCfgParams,
|  | uint32_t * | size |
| ) |  |  |

Description
This function returns the worst-case heap requirements for the CPPI LLD given a cppiGblCfgParams set of managed resources.

This can be used to optionally statically allocate all of the heap memory, which is then passed in trhough Cppi_initCfg. As long as the static heap is at least the size returned by this function then no dynamic allocations via Cppi_osalMalloc will ever be made.

Use of this API is completely optional. A static heap can be used of any size. If it is too small then dynamic allocation will occur. The system can also be used with only dynamic allocation, where no static memory is provided through Cppi_initCfg.

Parameters:

  `[in]` | cppiGblCfgParams | Initialization structure that contains the CPPI device specific information.
  `[out]` | size | Total bytes of memory that would be used if all flows and channels specified in cppiGblCfgParams are actually used.

Return values:

  | Success | - CPPI_SOK Failure - CPPI_INVALID_PARAM: NULL passsed for cppiGblCfgParmas or size

static Cppi_Desc* Cppi_getNextBD | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to get the next buffer descriptor pointer from a host packet. If the value is zero, then the current buffer is the last buffer in the packet.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Return values:

  | Word | 5 of host descriptor 32 bit word aligned memory address - if current buffer is not the last buffer in packet. 0 - if current buffer is the last buffer in packet.

static uint8_t Cppi_getOrigBufferpooIndex | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to set the original buffer pool index from which the attached buffer was originally allocated from. This is different from the descriptor pool/queue index since a single buffer may be referenced by more than one descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Return values:

  | Word | 6 (bit 28 to 31) of host descriptor

static void Cppi_getOriginalBufInfo | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint8_t ** | buffAddr,
|  | uint32_t * | buffLen |
| ) |  |  | `[inline, static]`

Description
This function is used to retrieve the original buffer information from host descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST
  `[in]` | descAddr | Memory address of descriptor.
  `[out]` | buffAddr | Memory address of data buffer pointer.
  `[out]` | buffLen | Size of the original data buffer.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  In case of host descriptor Word 6(bits 0 to 21) and Word 7 are returned

Return values:

  | None. |

static uint32_t Cppi_getPacketLen | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to get the packet length from host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Return values:

  | Size | of packet in bytes

static uint8_t Cppi_getPacketType | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to get the packet type from host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Return values:

  | 5 | bit packet type field. Valid range is 0 to 31.

static Cppi_Result Cppi_getPSData | ( | Cppi_DescType | descType,
|  | Cppi_PSLoc | location,
|  | Cppi_Desc * | descAddr,
|  | uint8_t ** | dataAddr,
|  | uint32_t * | dataLen |
| ) |  |  | `[inline, static]`

Description
This function is used to retrieve the protocol specific data from the host or monolithic descriptor. In case of host descriptor the PS data is read from descriptor or SOP buffer based on the PS location.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | location | PS region location CPPI_PS_DESC - PS words are located in the descriptor CPPI_PS_SOP - PS words are located inthe SOP buffer immediately prior to data.
  `[in]` | descAddr | Memory address of descriptor.
  `[out]` | dataAddr | Pointer to the first word of protocol specific data.
  `[out]` | dataLen | Size of the PS data.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  For host descriptor, Pointer to Word 0 of PS data block or SOP buffer is returned. For monolithic descriptor, Pointer to Word 0 of PS data block is returned.

Return values:

  | Success | - CPPI_SOK
  | Failure | - CPPI_PSDATA_NOT_PRESENT if PS length is zero in the descriptor.

static uint8_t Cppi_getPSFlags | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to get the protocol specific flags from host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Return values:

  | 4 | bit PS flags value from descriptor.

static uint32_t Cppi_getPSLen | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to get the protocol specific data length from host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Return values:

  | Size | of PS data in bytes. Valid range is 0 to 128 bytes

static Cppi_PSLoc Cppi_getPSLocation | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to get the protocol specific region location from host descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Return values:

  | CPPI_PS_DESC | - PS words are located in the descriptor
  | CPPI_PS_SOP | - PS words are located inthe SOP buffer immediately prior to data.

static uint8_t Cppi_getRefCount | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to get the number of references that have been made to the attached buffer by different descriptors. Multiple buffer references are commonly used to implement broadcast and multicast packet forwarding when zero packet data copies are desired.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Return values:

  | Word | 6 (bit 22 to 27) of host descriptor

static Cppi_ReturnPolicy Cppi_getReturnPolicy | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to get the return policy for the packet from host descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Return values:

  | RETURN_ENTIRE_PACKET | - Entire packet (linked with MOP and EOP BDs and data buffers) should be returned to the return queue specified in SOP descriptor.
  | RETURN_BUFFER | - Each buffer in this packet should be returned to the queue specified in its respective SOP, MOP or EOP descriptor.

static Qmss_Location Cppi_getReturnPushPolicy | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to get the return push policy for the packet from host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Return values:

  | TAIL | - Descriptor must be returned to tail of queue.
  | HEAD | - Descriptor must be returned to head of queue.

static Qmss_Queue Cppi_getReturnQueue | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to get the return queue manager and queue number from host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Return values:

  | Queue | Manager - 0 or 1.
  | Queue | Number - 0 to 4094 with in queue manager 0 or 1.

static Cppi_Result Cppi_getSoftwareInfo | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint8_t ** | infoAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to retrieve the 3 words of software info field from the host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[out]` | infoAddr | Pointer to the first word of software information block.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  Pointer to Word 1 of Extended Packet Info Block is returned. EPIB block must be allocated and EPIB bit must be set in the descriptor

Return values:

  | Success | - CPPI_SOK
  | Failure | - CPPI_EPIB_NOT_PRESENT if EPIB bit is not set in the descriptor.

static uint32_t Cppi_getSoftwareInfo0 | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to retrieve the 1st word of software info field from the host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid. EPIB block must be allocated and EPIB bit must be set in the descriptor

Return values:

  | 4 | bytes of software info word 1

static uint32_t Cppi_getSoftwareInfo1 | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to retrieve the 2nd word of software info field from the host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid. EPIB block must be allocated and EPIB bit must be set in the descriptor

Return values:

  | 4 | bytes of software info word 2
  | Failure | - CPPI_EPIB_NOT_PRESENT if EPIB bit is not set in the descriptor.

static uint32_t Cppi_getSoftwareInfo2 | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to retrieve the 3rd word of software info field from the host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid. EPIB block must be allocated and EPIB bit must be set in the descriptor

Return values:

  | 4 | bytes of software info word 3
  | Failure | - CPPI_EPIB_NOT_PRESENT if EPIB bit is not set in the descriptor.

static Cppi_DescTag Cppi_getTag | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to get the source and destination tags from host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Return values:

  | 8 | bit destination low tag value.
  | 8 | bit destination high tag value.
  | 8 | bit source low tag value.
  | 8 | bit source high tag value.

static Cppi_Result Cppi_getTimeStamp | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint32_t * | timeStamp |
| ) |  |  | `[inline, static]`

Description
This function is used to retrieve the timestamp field from the host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[out]` | timeStamp | Timestamp value.

Precondition:
  Descriptor must be allocated and be valid. EPIB block must be allocated and EPIB bit must be set in the descriptor

Postcondition:
  Word 0 of Extended Packet Info Block is returned.

Return values:

  | Success | - CPPI_SOK
  | Failure | - CPPI_EPIB_NOT_PRESENT if EPIB bit is not set in the descriptor.

uint32_t Cppi_getVersion | ( | void |  | ) |

Description
The function is used to get the version information of the CPPI LLD.

Return values:

  | Version | Information.

const char* Cppi_getVersionStr | ( | void |  | ) |

Description
The function is used to get the version string for the CPPI LLD.

Return values:

  | Version | String.

static void Cppi_incrementRefCount | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr |
| ) |  |  | `[inline, static]`

Description
This function is used to increment the number of references that have been made to the attached buffer by different descriptors. Multiple buffer references are commonly used to implement broadcast and multicast packet forwarding when zero packet data copies are desired.

**No validation is done on the input parameters**. **No check is made to prevent overflow **.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST
  `[in]` | descAddr | Memory address of descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  Word 6 (Bit 22 to 27) of host descriptor is updated.

Return values:

  | None |

Cppi_Result Cppi_init | ( | Cppi_GlobalConfigParams * | cppiGblCfgParams | ) |

Description
This function initializes the CPPI low level driver This function is called once in the system to setup the CPPI low level driver with information pertaining to maximum supported Rx priority, Tx priority, Rx channels, Tx channels, Rx flows and memory mapped address for each CPPI CPDMA.

This works by calling Cppi_initCfg with initCfg = NULL.

Parameters:

  `[in]` | cppiGblCfgParams | Initialization structure that contains the CPPI device specific information.

Postcondition:
  CPPI instance is created.

Return values:

  | Success | - CPPI_SOK

Cppi_Result Cppi_initCfg | ( | Cppi_GlobalConfigParams * | cppiGblCfgParams,
|  | Cppi_InitCfg * | initCfg |
| ) |  |  |

Description
This function initializes the CPPI low level driver This function is called once in the system to setup the CPPI low level driver with information pertaining to maximum supported Rx priority, Tx priority, Rx channels, Tx channels, Rx flows and memory mapped address for each CPPI CPDMA.

Parameters:

  `[in]` | cppiGblCfgParams | Initialization structure that contains the CPPI device specific information.
  `[in]` | initCfg | Initialization structure that contains the heap config information which can be NULL.

Postcondition:
  CPPI instance is created.

Return values:

  | Success | - CPPI_SOK

Qmss_QueueHnd Cppi_initDescriptor | ( | Cppi_DescCfg * | descCfg,
|  | uint32_t * | numAllocated |
| ) |  |  |

Description
This function is used to obtain previously allocated descriptors. The function opens an destination queue as specified in the input parameters and pushes the requested number of descriptors from specified memory region, if available onto it. The host and monolithic descriptors are configured with values specified in "descCfg" before pushing them to the destination queue. The configuration for host descriptors are return policy, return push policy, return queue. The configuration for monolithic descriptors is the return queue. If the return queue is set to QMSS_PARAM_NOT_SPECIFIED then the destination queue specified in input parameter is configured to as return queue.

Parameters:

  `[in]` | descCfg | Specifies the number of descriptors, memory region from where it should be allocated and the destination queue to push to.
  `[out]` | numAllocated | Number of descriptors actually allocated.

Precondition:
  Qmss_init function should be called before calling this function.

Return values:

  | Success | - Destination queue handle on which the allocated descriptors are stored. The queue must be closed by the caller using Qmss_queueClose() when done.
  | Failure | - CPPI_INVALID_PARAM
  | Failure | - CPPI_QMSS_MEMREGION_NOT_INITIALIZED
  | Failure | - CPPI_QUEUE_OPEN_ERROR

static void Cppi_linkNextBD | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | Cppi_Desc * | nextBD |
| ) |  |  | `[inline, static]`

Description
This function is used to link a host descriptor with the next buffer descriptor.

**No validation is done on the input parameters**. **Does not update packet length**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | nextBD | Memory address of buffer descriptor that should be linked.

Precondition:
  Both descriptors must be allocated and be valid.

Postcondition:
  Word5 is updated

Return values:

  | None. |

Cppi_Handle Cppi_open | ( | Cppi_CpDmaInitCfg * | initCfg | ) |

Description
This function opens the CPPI CPDMA instance. This function is called by the CPPI CPDMA driver, application to initialize the global configuration pertaining to CPPI CPDMA that includes rx priority, tx priority, write arbitration FIFO depth, receive starvation timeout and QM base addresses. The registers are configured only once when the function is called for the first time. Any future calls to this function returns the CPDMA object handle created during the first call.

Parameters:

  `[in]` | initCfg | Initialization structure that contains the global configuration parameters pertaining to CPPI CPDMA.

Precondition:
  Cppi_init function should be called before calling this function.

Postcondition:
  Global configuration registers are configured with input parameters

Return values:

  | Success | - Handle to CPPI CPDMA object. Used as an input parameter to all other CPPI LLD APIs.
  | Failure | - NULL

Cppi_ChHnd Cppi_rxChannelOpen | ( | Cppi_Handle | hnd,
|  | Cppi_RxChInitCfg * | cfg,
|  | uint8_t * | isAllocated |
| ) |  |  |

Description
This function opens a CPPI receive channel. The channel can be opened in two ways: 1) If channel number in cfg structure is set to CPPI_PARAM_NOT_SPECIFIED, then a new available channel is allocated. 2) If channel number in cfg structure is a valid channel i.e., >= 0, then the channel is allocated if free else a handle to a previously opened channel is returned. The channel is configured only if it is a new channel allocation.

Parameters:

  `[in]` | hnd | handle returned by Cppi_open API.
  `[in]` | cfg | Rx channel configuration specifying channel number, channel enable.
  `[out]` | isAllocated | Indicates whether the requested channel number is a new channel allocation(1). or was already allocated. If the channel was previously allocated this parameter returns the reference count.

Precondition:
  Cppi_open function should be called before calling this function.

Postcondition:
  Receive channel is allocated and configured.

Return values:

  | Success | - Channel Handle. Used as a input parameter in all other channel related APIs.
  | Failure | - NULL

Cppi_Result Cppi_setCpdmaLoopback | ( | Cppi_Handle | hnd,
|  | uint8_t | loopback |
| ) |  |  |

Description
This function enables or disables CPDMA loopback

Parameters:

  `[in]` | hnd | handle returned by Cppi_open API.
  `[in]` | loopback | 0 - To disable loopback 1 - To enable loopback

Precondition:
  Cppi_open function should be called before calling this function.

Return values:

  | Success | - CPPI_SOK
  | Failure | - CPPI_INVALID_PARAM
  | Failure | - CPPI_CPDMA_NOT_INITIALIZED

static void Cppi_setData | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint8_t * | buffAddr,
|  | uint32_t | buffLen |
| ) |  |  | `[inline, static]`

Description
This function copies the data buffer to the host or monolithic descriptor. It is assumed that enough words are available to store the payload in case of monolithic descriptor.

**No validation is done on the input parameters**. **Does not update packet length**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | buffAddr | Memory address of data buffer.
  `[in]` | buffLen | Size of the data buffer.

Precondition:
  Descriptor and data buffer must be allocated and be valid.

Postcondition:
  In case of host descriptor Word 3 and Word 4 are updated

In case of monolithic descriptor Word 0 (bits 0 to 15) and payload are updated.

Return values:

  | None. |

static void Cppi_setDataLen | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint32_t | buffLen |
| ) |  |  | `[inline, static]`

Description
This function sets the data length in host or monolithic descriptor.

**No validation is done on the input parameters**. **Does not update packet length**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | buffLen | Size of the data.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  In case of host descriptor Word 3 is updated

In case of monolithic descriptor Word 0 (bits 0 to 15) is updated.

Return values:

  | None. |

static void Cppi_setDataOffset | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint32_t | dataOffset |
| ) |  |  | `[inline, static]`

Description
This function is used to set the payload data offset in the monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | dataOffset | Data offset from byte 0 of word 0 of the descriptor to the location where valid data begins. Valid range is 0 to 511 bytes.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  Word 0 (bits 16 to 24) of monolithic descriptor are updated.

Return values:

  | None |

static void Cppi_setDescType | ( | Cppi_Desc * | descAddr,
|  | Cppi_DescType | descType |
| ) |  |  | `[inline, static]`

Description
This function is used to set the type of descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC, Cppi_DescType_TEARDOWN

Precondition:
  Descriptor must be allocated and be valid.

Return values:

  | None. |

static void Cppi_setOrigBufferpooIndex | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint8_t | poolIndex |
| ) |  |  | `[inline, static]`

Description
This function is used to set the original buffer pool index from which the attached buffer was originally allocated from. This is different from the descriptor pool/queue index since a single buffer may be referenced by more than one descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | poolIndex | index of buffer pool.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  Word 6 (Bit 28 to 31) of host descriptor is updated.

Return values:

  | None |

static void Cppi_setOriginalBufInfo | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint8_t * | buffAddr,
|  | uint32_t | buffLen |
| ) |  |  | `[inline, static]`

Description
This function is used to set the original buffer information in the host descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | buffAddr | Memory address of data buffer pointer.
  `[in]` | buffLen | Size of the original data buffer.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  In case of host descriptor Word 6(bits 0 to 21) and Word 7 are updated

Return values:

  | None. |

static void Cppi_setPacketLen | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint32_t | packetLen |
| ) |  |  | `[inline, static]`

Description
This function is used to set the packet length in host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | packetLen | Size of packet.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  Word 0 (bits 0 to 21) of host descriptor are updated. Word 0 (bits 0 to 15) of monolithic descriptor are updated.

Return values:

  | None |

static void Cppi_setPacketType | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint8_t | packetType |
| ) |  |  | `[inline, static]`

Description
This function is used to set the packet type in host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | packetType | Indicates type of packet. Valid range is 0 to 31.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  Word 0 (bits 25 to 29) of host or monolithic descriptor are updated.

Return values:

  | None |

static void Cppi_setPSData | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint8_t * | dataAddr,
|  | uint32_t | dataLen |
| ) |  |  | `[inline, static]`

Description
This function is used to copy the protocol specific data to the host or monolithic descriptor. Used when PS data is located in the descriptor. This function should not be used to copy PS data to SOP buffer.

**No validation is done on the input parameters**. **Does not update packet length**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | dataAddr | Pointer to the first word of protocol specific data.
  `[in]` | dataLen | Size of the PS data.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  Word 2 (bits 24 to 29) are updated. Word 0-N of PS data block is updated.

Return values:

  | None |

static void Cppi_setPSFlags | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint8_t | psFlags |
| ) |  |  | `[inline, static]`

Description
This function is used to set the protocol specific flags in host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | psFlags | 4 bit Protocol Specific flags value.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  Word 2 (bits 16 to 19) of descriptor are updated.

Return values:

  | None |

static void Cppi_setPSLen | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint32_t | dataLen |
| ) |  |  | `[inline, static]`

Description
This function is update protocol specific data length in host or monolithic descriptor.

**No validation is done on the input parameters**. **Does not update packet length**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | dataLen | Size of PS data.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  Word 2 (bits 24 to 29) are updated.

Return values:

  | None |

static void Cppi_setPSLocation | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | Cppi_PSLoc | location |
| ) |  |  | `[inline, static]`

Description
This function is used to set the protocol specific region location in host descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | location | PS region location CPPI_PS_DESC - PS words are located in the descriptor CPPI_PS_SOP - PS words are located inthe SOP buffer immediately prior to data.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  Word 0 (bit 22) of host descriptor is updated.

Return values:

  | None |

static void Cppi_setReturnPolicy | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | Cppi_ReturnPolicy | returnPolicy |
| ) |  |  | `[inline, static]`

Description
This function is used to set the return policy for the packet in host descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | returnPolicy | RETURN_ENTIRE_PACKET - Entire packet (linked with MOP and EOP BDs and data buffers) should be returned to the return queue specified in SOP descriptor. RETURN_BUFFER - Each buffer in this packet should be returned to the queue specified in its respective SOP, MOP or EOP descriptor.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  Word 2 (bit 15) of host descriptor is updated.

Return values:

  | None |

static void Cppi_setReturnPushPolicy | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | Qmss_Location | returnPushPolicy |
| ) |  |  | `[inline, static]`

Description
This function is used to set the return push policy in host or monolithic descriptor. Return push policy is valid only if Return Policy is set to 1 in host descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | returnPushPolicy | TAIL - Descriptor must be returned to tail of queue. HEAD - Descriptor must be returned to head of queue.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  Word 2 (bit 14) of descriptor is updated.

Return values:

  | None |

static void Cppi_setReturnQueue | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | Qmss_Queue | queue |
| ) |  |  | `[inline, static]`

Description
This function is used to set the return queue manager and queue number in host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | queue | Queue Manager - 0 or 1. Queue Number - 0 to 4094 with in queue manager 0 or 1.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  Word 2 (bit 14) of host or monolithic descriptor is updated.

Return values:

  | None |

static void Cppi_setSoftwareInfo | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint8_t * | infoAddr |
| ) |  |  | `[inline, static]`

Description
This function is used copy the optional software info field to the host or monolithic descriptor. It is assumed that enough words are available in the descriptor to store information block. The API copies 3 words of software info into the descriptor.

**No validation is done on the input parameters**. **Does not update packet length**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | infoAddr | Pointer to the first word of software information block.

Precondition:
  Descriptor must be allocated and be valid. EPIB block must be allocated.

Postcondition:
  *
  Word 2 (bit 31) is updated. Word 1 to Word 3 of Extended Packet Info Block is updated.

Return values:

  | None |

static void Cppi_setSoftwareInfo0 | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint32_t | value |
| ) |  |  | `[inline, static]`

Description
This function is used copy the 1st word of optional software info field to the host or monolithic descriptor. It is assumed that enough words are available in the descriptor to store information block.

**No validation is done on the input parameters**. **Does not update packet length**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | value | Value to write to word 1 of software information block.

Precondition:
  Descriptor must be allocated and be valid. EPIB block must be allocated.

Postcondition:
  Word 2 (bit 31) is updated. Word 1 of Extended Packet Info Block is updated.

Return values:

  | None |

static void Cppi_setSoftwareInfo1 | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint32_t | value |
| ) |  |  | `[inline, static]`

Description
This function is used copy the 2nd word of optional software info field to the host or monolithic descriptor. It is assumed that enough words are available in the descriptor to store information block.

**No validation is done on the input parameters**. **Does not update packet length**. **Does not update EPIB present bit**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | value | Value to write to word 2 of software information block.

Precondition:
  Descriptor must be allocated and be valid. EPIB block must be allocated.

Postcondition:
  Word 2 of Extended Packet Info Block is updated.

Return values:

  | None |

static void Cppi_setSoftwareInfo2 | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint32_t | value |
| ) |  |  | `[inline, static]`

Description
This function is used copy the 3rd word of optional software info field to the host or monolithic descriptor. It is assumed that enough words are available in the descriptor to store information block.

**No validation is done on the input parameters**. **Does not update packet length**. **Does not update EPIB present bit**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | value | Value to write to word 3 of software information block.

Precondition:
  Descriptor must be allocated and be valid. EPIB block must be allocated.

Postcondition:
  Word 3 of Extended Packet Info Block is updated.

Return values:

  | None |

static void Cppi_setTag | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | Cppi_DescTag * | tag |
| ) |  |  | `[inline, static]`

Description
This function is used to set source and destination tags in host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | tag | Destination and source low and High tag value.

Precondition:
  Descriptor must be allocated and be valid.

Postcondition:
  Word 1 of host or monolithic descriptor is updated.

Return values:

  | None |

static void Cppi_setTimeStamp | ( | Cppi_DescType | descType,
|  | Cppi_Desc * | descAddr,
|  | uint32_t | timeStamp |
| ) |  |  | `[inline, static]`

Description
This function is used to set the timestamp field in host or monolithic descriptor.

**No validation is done on the input parameters**.

Parameters:

  `[in]` | descType | Type of descriptor - Cppi_DescType_HOST, Cppi_DescType_MONOLITHIC
  `[in]` | descAddr | Memory address of descriptor.
  `[in]` | timeStamp | Timestamp value.

Precondition:
  Descriptor must be allocated and be valid. EPIB block must be allocated.

Postcondition:
  Word 2 (bit 31) is updated. Word 0 of Extended Packet Info Block is updated.

Return values:

  | None |

void Cppi_startCfg | ( | Cppi_StartCfg * | startCfg | ) |

Description
This function initializes any CPPI start configurations such as the Resource Manager handle

Cppi_ChHnd Cppi_txChannelOpen | ( | Cppi_Handle | hnd,
|  | Cppi_TxChInitCfg * | cfg,
|  | uint8_t * | isAllocated |
| ) |  |  |

Description
This function opens a CPPI transmit channel. The channel can be opened in two ways: 1) If channel number in cfg structure is set to CPPI_PARAM_NOT_SPECIFIED, then a new available channel is allocated. 2) If channel number in cfg structure is a valid channel i.e., >= 0, then the channel is allocated if free else a handle to a previously opened channel is returned. The channel is configured only if it is a new channel allocation.

Parameters:

  `[in]` | hnd | handle returned by Cppi_open API.
  `[in]` | cfg | Tx channel configuration specifying scheduler priority for the channel, channel number, channel enable, PS and EPIB filtering control, special AIF Monolithic Mode.
  `[out]` | isAllocated | Indicates whether the requested channel number is a new channel allocation(1). or was already allocated. If the channel was previously allocated this parameter returns the reference count.

Precondition:
  Cppi_open function should be called before calling this function.

Postcondition:
  Transmit channel is allocated and configured.

Return values:

  | Success | - Channel Handle. Used as a input parameter in all other channel related APIs.
  | Failure | - NULL

Copyright 2012, Texas Instruments Incorporated