Software Drivers
Main Page | Data Structures | File List | Data Fields | Globals

xaxidma_bd.c File Reference


Detailed Description

Buffer descriptor (BD) management API implementation.

 MODIFICATION HISTORY:

 Ver   Who  Date     Changes
 ----- ---- -------- -------------------------------------------------------
 1.00a jz   05/18/10 First release
 2.00a jz   08/10/10 Second release, added in xaxidma_g.c, xaxidma_sinit.c,
                     updated tcl file, added xaxidma_porting_guide.h
 3.00a jz   11/22/10 Support IP core parameters change
 


Functions

int XAxiDma_BdSetLength (XAxiDma_Bd *BdPtr, u32 LenBytes)
int XAxiDma_BdSetBufAddr (XAxiDma_Bd *BdPtr, u32 Addr)
int XAxiDma_BdSetAppWord (XAxiDma_Bd *BdPtr, int Offset, u32 Word)
u32 XAxiDma_BdGetAppWord (XAxiDma_Bd *BdPtr, int Offset, int *Valid)
void XAxiDma_BdSetCtrl (XAxiDma_Bd *BdPtr, u32 Data)
void XAxiDma_DumpBd (XAxiDma_Bd *BdPtr)


Function Documentation

u32 XAxiDma_BdGetAppWord XAxiDma_Bd BdPtr,
int  Offset,
int *  Valid
 

Get the APP word at the specified APP word offset for a BD.

Parameters:
BdPtr is the BD to operate on.
Offset is the offset inside the APP word, it is valid from 0 to 4
Valid is to tell the caller whether parameters are valid
Returns:
The APP word. Passed in parameter Valid holds 0 for failure, and 1 for success.

int XAxiDma_BdSetAppWord XAxiDma_Bd BdPtr,
int  Offset,
u32  Word
 

Set the APP word at the specified APP word offset for a BD.

Parameters:
BdPtr is the BD to operate on.
Offset is the offset inside the APP word, it is valid from 0 to 4
Word is the value to set
Returns:
  • XST_SUCCESS for success
  • XST_INVALID_PARAM under following error conditions: 1) StsCntrlStrm is not built in hardware 2) Offset is not in valid range
Note:
If the hardware build has C_SG_USE_STSAPP_LENGTH set to 1, then the last APP word, XAXIDMA_LAST_APPWORD, must have non-zero value when AND with 0x7FFFFF. Not doing so will cause the hardware to stall.

int XAxiDma_BdSetBufAddr XAxiDma_Bd BdPtr,
u32  Addr
 

Set the BD's buffer address.

Parameters:
BdPtr is the BD to operate on
Addr is the address to set
Returns:
  • XST_SUCCESS if buffer address set successfully
  • XST_INVALID_PARAM if hardware has no DRE and address is not aligned

void XAxiDma_BdSetCtrl XAxiDma_Bd BdPtr,
u32  Data
 

Set the control bits for a BD.

Parameters:
BdPtr is the BD to operate on.
Data is the bit value to set
Returns:
None

int XAxiDma_BdSetLength XAxiDma_Bd BdPtr,
u32  LenBytes
 

Set the length field for the given BD.

Length has to be non-zero and less than XAXIDMA_MAX_TRANSFER_LEN.

For TX channels, the value passed in should be the number of bytes to transmit from the TX buffer associated with the given BD.

For RX channels, the value passed in should be the size of the RX buffer associated with the given BD in bytes. This is to notify the RX channel the capability of the RX buffer to avoid buffer overflow.

The actual receive length can be equal or smaller than the specified length. The actual transfer length will be updated by the hardware in the XAXIDMA_BD_STS_OFFSET word in the BD.

Parameters:
BdPtr is the BD to operate on.
LenBytes is the requested transfer length
Returns:
  • XST_SUCCESS for success
  • XST_INVALID_PARAM for invalid BD length

void XAxiDma_DumpBd XAxiDma_Bd BdPtr  ) 
 

Dump the fields of a BD.

Parameters:
BdPtr is the BD to operate on.
Returns:
None