zdma: xzdma.h File Reference

| zdma Xilinx SDK Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Data Structures | Macros | Typedefs | Enumerations | Functions
xzdma.h File Reference

## Data Structures
struct | XZDma_Descriptor
| This typedef contains scatter gather descriptor fields for ZDMA core. More...
struct | __attribute__
| This typedef contains scatter gather descriptor fields for ZDMA core. More...
struct | __attribute__
| This typedef contains scatter gather descriptor fields for ZDMA core. More...
struct | XZDma_DataConfig
| This typedef contains the data configurations of ZDMA core. More...
struct | XZDma_DscrConfig
| This typedef contains the descriptor configurations of ZDMA core. More...
struct | XZDma_Config
| This typedef contains configuration information for a ZDMA core Each ZDMA core should have a configuration structure associated. More...
struct | XZDma
| The XZDma driver instance data structure. More...
struct | XZDma_Transfer
| This typedef contains the fields for transfer of data. More...

## Macros
#define | XZDma_IntrGetStatus(InstancePtr) XZDma_ReadReg((InstancePtr)->Config.BaseAddress, XZDMA_CH_ISR_OFFSET)
| This function returns interrupt status read from Interrupt Status Register. More...
#define | XZDma_IntrClear(InstancePtr, Mask)
| This function clears interrupt(s). More...
#define | XZDma_GetIntrMask(InstancePtr)
| This function returns interrupt mask to know which interrupts are enabled and which of them were disabled. More...
#define | XZDma_EnableIntr(InstancePtr, Mask) (InstancePtr)->IntrMask = ((InstancePtr)->IntrMask | (Mask))
| This function enables individual interrupts of the ZDMA core by updating the Interrupt Enable register. More...
#define | XZDma_DisableIntr(InstancePtr, Mask)
| This function disables individual interrupts of the ZDMA core by updating the Interrupt Disable register. More...
#define | XZDma_SrcCurPyld(InstancePtr)
| This function returns source current payload address under process of ZDMA core. More...
#define | XZDma_DstCurPyld(InstancePtr)
| This function returns destination current payload address under process of ZDMA core. More...
#define | XZDma_SrcDscrCurPyld(InstancePtr)
| This function returns source descriptor current payload address under process of ZDMA core. More...
#define | XZDma_DstDscrCurPyld(InstancePtr)
| This function returns destination descriptor current payload address under process of ZDMA core. More...
#define | XZDma_GetTotalByte(InstancePtr)
| This function gets the count of total bytes transferred through core since last clear in ZDMA core. More...
#define | XZDma_TotalByteClear(InstancePtr)
| This function clears the count of total bytes transferred in ZDMA core. More...
#define | XZDma_GetSrcIntrCnt(InstancePtr)
| This function gets the total number of Interrupt count for source after last call of this API. More...
#define | XZDma_GetDstIntrCnt(InstancePtr)
| This function gets the total number of Interrupt count for destination after last call of this API. More...
#define | XZDma_EnableCh(InstancePtr)
| This function Enable's the ZDMA core for initiating the data transfer once the data transfer completes it will be automatically disabled. More...
#define | XZDma_DisableCh(InstancePtr)
| This function Disable's the ZDMA core. More...

## Typedefs
typedef void(* | XZDma_DoneHandler )(void *CallBackRef)
| Callback type for Completion of all data transfers. More...
typedef void(* | XZDma_ErrorHandler )(void *CallBackRef, u32 ErrorMask)
| Callback type for all error interrupts. More...

## Enumerations
enum | XZDma_Handler { XZDMA_HANDLER_DONE, XZDMA_HANDLER_ERROR }
| This typedef contains ZDMA Handler Types. More...
enum | XZDma_DscrType { XZDMA_LINEAR, XZDMA_LINKEDLIST }
| This typedef contains ZDMA Descriptors Types. More...
enum | XZDma_Mode { XZDMA_NORMAL_MODE, XZDMA_WRONLY_MODE, XZDMA_RDONLY_MODE }
| This typedef contains ZDMA Operation modes. More...
enum | XZDmaState { XZDMA_IDLE, XZDMA_PAUSE, XZDMA_BUSY }
| This typedef contains ZDMA state. More...
enum | XZDma_BurstType { XZDMA_FIXED_BURST = 0, XZDMA_INCR_BURST }
| This typedef contains ZDMA AXI Burst type definitions. More...

## Functions
XZDma_Config * | XZDma_LookupConfig (u16 DeviceId)
| XZDma_LookupConfig returns a reference to an XZDma_Config structure based on the unique device id, DeviceId. More...
s32 | XZDma_CfgInitialize (XZDma *InstancePtr, XZDma_Config *CfgPtr, u32 EffectiveAddr)
| This function initializes an ZDMA core. More...
s32 | XZDma_SetMode (XZDma *InstancePtr, u8 IsSgDma, XZDma_Mode Mode)
| This function sets the pointer type and mode in which ZDMA needs to transfer the data. More...
u32 | XZDma_CreateBDList (XZDma *InstancePtr, XZDma_DscrType TypeOfDscr, UINTPTR Dscr_MemPtr, u32 NoOfBytes)
| This function sets the descriptor type and descriptor pointer's start address of both source and destination based on the memory allocated by user and also calculates no of descriptors(BDs) can be created in the allocated memory. More...
s32 | XZDma_SetChDataConfig (XZDma *InstancePtr, XZDma_DataConfig *Configure)
| This function sets the data attributes and control configurations of a ZDMA core based on the inputs provided. More...
void | XZDma_GetChDataConfig (XZDma *InstancePtr, XZDma_DataConfig *Configure)
| This function gets the data attributes and control configurations of a ZDMA core. More...
s32 | XZDma_SetChDscrConfig (XZDma *InstancePtr, XZDma_DscrConfig *Configure)
| This function sets the descriptor attributes based on the inputs provided in the structure. More...
void | XZDma_GetChDscrConfig (XZDma *InstancePtr, XZDma_DscrConfig *Configure)
| This function gets the descriptor attributes of the channel. More...
s32 | XZDma_Start (XZDma *InstancePtr, XZDma_Transfer *Data, u32 Num)
| This function sets all the required fields for initiating data transfer. More...
void | XZDma_WOData (XZDma *InstancePtr, u32 *Buffer)
| This function preloads the buffers which will be used in write only mode. More...
void | XZDma_Resume (XZDma *InstancePtr)
| This function resume the paused state of ZDMA core and starts the transfer from where it has paused. More...
void | XZDma_Reset (XZDma *InstancePtr)
| This function resets the ZDMA core. More...
XZDmaState | XZDma_ChannelState (XZDma *InstancePtr)
| This function returns the state of ZDMA core. More...
s32 | XZDma_SelfTest (XZDma *InstancePtr)
| This file contains a diagnostic self-test function for the ZDMA driver. More...
void | XZDma_IntrHandler (void *Instance)
| This function is the interrupt handler for the ZDMA core. More...
s32 | XZDma_SetCallBack (XZDma *InstancePtr, XZDma_Handler HandlerType, void *CallBackFunc, void *CallBackRef)
| This routine installs an asynchronous callback function for the given HandlerType. More...

## Macro Definition Documentation

#define XZDma_DisableCh | ( |  | InstancePtr | ) |

Value:
XZDma_WriteReg((InstancePtr)->Config.BaseAddress,\
(XZDMA_CH_CTRL2_OFFSET), (XZDMA_CH_CTRL2_DIS_MASK))
XZDMA_CH_CTRL2_DIS_MASK
#define XZDMA_CH_CTRL2_DIS_MASK
Channel disable mask.
Definition: xzdma_hw.h:364
XZDma_WriteReg
#define XZDma_WriteReg(BaseAddress, RegOffset, Data)
This macro writes the value into the given register.
Definition: xzdma_hw.h:414

This function Disable's the ZDMA core.

Parameters

  InstancePtr | is a pointer to the XZDma instance.

Returns
  None.

Note
  None. C-style signature: void XZDma_DisableCh(XZDma *InstancePtr)

Referenced by XZDma_Reset().

#define XZDma_DisableIntr | ( |  | InstancePtr,
|  |  | Mask
| ) |  |

Value:
XZDma_WriteReg( (InstancePtr)->Config.BaseAddress, \
XZDMA_CH_IDS_OFFSET, \
((u32)XZDma_ReadReg((InstancePtr)->Config.BaseAddress, \
XZDMA_CH_IDS_OFFSET) | ((u32)(Mask) & (u32)XZDMA_IXR_ALL_INTR_MASK)))
XZDMA_IXR_ALL_INTR_MASK
#define XZDMA_IXR_ALL_INTR_MASK
IXR OR of all the interrupts mask.
Definition: xzdma_hw.h:153
XZDma_WriteReg
#define XZDma_WriteReg(BaseAddress, RegOffset, Data)
This macro writes the value into the given register.
Definition: xzdma_hw.h:414
XZDma_ReadReg
#define XZDma_ReadReg(BaseAddress, RegOffset)
This macro reads the given register.
Definition: xzdma_hw.h:396

This function disables individual interrupts of the ZDMA core by updating the Interrupt Disable register.

Parameters

  InstancePtr | is a pointer to the XZDma instance.
  Mask | is the type of the interrupts to disable. Use OR'ing of XZDMA_IXR_DMA_*_MASK constants defined in xzdma_hw.h to create this parameter value.

Returns
  None.

Note
  The existing disabled interrupt(s) will remain disabled. C-style signature: void XZDma_DisableIntr(XZDma *InstancePtr, u32 Mask)

Referenced by XZDma_IntrHandler(), XZDma_LinkedListExample(), and XZDma_Reset().

#define XZDma_DstCurPyld | ( |  | InstancePtr | ) |

Value:
((u64)(XZDma_ReadReg((InstancePtr)->Config.BaseAddress, \
XZDMA_CH_DST_CUR_PYLD_LSB_OFFSET)) | \
((u64)(XZDma_ReadReg((InstancePtr)->Config.BaseAddress, \
XZDMA_CH_DST_CUR_PYLD_MSB_OFFSET)) << XZDMA_WORD1_MSB_SHIFT))
XZDMA_WORD1_MSB_SHIFT
#define XZDMA_WORD1_MSB_SHIFT
MSB Address shift.
Definition: xzdma_hw.h:283
XZDma_ReadReg
#define XZDma_ReadReg(BaseAddress, RegOffset)
This macro reads the given register.
Definition: xzdma_hw.h:396

This function returns destination current payload address under process of ZDMA core.

Parameters

  InstancePtr | is a pointer to the XZDma instance.

Returns
  None.

Note
  This address may not be precise due to ZDMA pipeline structure C-style signature: u64 XZDma_DstCurPyld(XZDma *InstancePtr)

#define XZDma_DstDscrCurPyld | ( |  | InstancePtr | ) |

Value:
((u64)(XZDma_ReadReg((InstancePtr)->Config.BaseAddress, \
XZDMA_CH_DST_CUR_DSCR_LSB_OFFSET)) | \
((u64)(XZDma_ReadReg((InstancePtr)->Config.BaseAddress, \
XZDMA_CH_DST_CUR_DSCR_MSB_OFFSET)) << XZDMA_WORD1_MSB_SHIFT))
XZDMA_WORD1_MSB_SHIFT
#define XZDMA_WORD1_MSB_SHIFT
MSB Address shift.
Definition: xzdma_hw.h:283
XZDma_ReadReg
#define XZDma_ReadReg(BaseAddress, RegOffset)
This macro reads the given register.
Definition: xzdma_hw.h:396

This function returns destination descriptor current payload address under process of ZDMA core.

Parameters

  InstancePtr | is a pointer to the XZDma instance.

Returns
  None.

Note
  This address may not be precise due to ZDMA pipeline structure C-style signature: u64 XZDma_DstDscrCurPyld(XZDma *InstancePtr)

#define XZDma_EnableCh | ( |  | InstancePtr | ) |

Value:
XZDma_WriteReg((InstancePtr)->Config.BaseAddress, \
(XZDMA_CH_CTRL2_OFFSET), (XZDMA_CH_CTRL2_EN_MASK))
XZDma_WriteReg
#define XZDma_WriteReg(BaseAddress, RegOffset, Data)
This macro writes the value into the given register.
Definition: xzdma_hw.h:414
XZDMA_CH_CTRL2_EN_MASK
#define XZDMA_CH_CTRL2_EN_MASK
Channel enable mask.
Definition: xzdma_hw.h:361

This function Enable's the ZDMA core for initiating the data transfer once the data transfer completes it will be automatically disabled.

Parameters

  InstancePtr | is a pointer to the XZDma instance.

Returns
  None.

Note
  None. C-style signature: void XZDma_EnableCh(XZDma *InstancePtr)

#define XZDma_EnableIntr | ( |  | InstancePtr,
|  |  | Mask
| ) |  | (InstancePtr)->IntrMask = ((InstancePtr)->IntrMask | (Mask))

This function enables individual interrupts of the ZDMA core by updating the Interrupt Enable register.

Parameters

  InstancePtr | is a pointer to the XZDma instance.
  Mask | is the type of the interrupts to enable. Use OR'ing of XZDMA_IXR_DMA_*_MASK constants defined in xzdma_hw.h to create this parameter value.

Returns
  None.

Note
  The existing enabled interrupt(s) will remain enabled. C-style signature: void XZDma_EnableIntr(XZDma *InstancePtr, u32 Mask)

Referenced by XZDma_LinearExample(), XZDma_LinkedListExample(), XZDma_SimpleExample(), XZDma_SimpleReadOnlyExample(), and XZDma_WriteOnlyExample().

#define XZDma_GetDstIntrCnt | ( |  | InstancePtr | ) |

Value:
XZDma_ReadReg((InstancePtr)->Config.BaseAddress, \
XZDMA_CH_IRQ_DST_ACCT_OFFSET)
XZDma_ReadReg
#define XZDma_ReadReg(BaseAddress, RegOffset)
This macro reads the given register.
Definition: xzdma_hw.h:396

This function gets the total number of Interrupt count for destination after last call of this API.

Parameters

  InstancePtr | is a pointer to the XZDma instance.

Returns
  None.

Note
  Once this API is called then count will become zero. C-style signature: void XZDma_GetDstIntrCnt(XZDma *InstancePtr)

Referenced by XZDma_Reset().

#define XZDma_GetIntrMask | ( |  | InstancePtr | ) |

Value:
XZDma_ReadReg((InstancePtr)->Config.BaseAddress, \
(u32)(XZDMA_CH_IMR_OFFSET))
XZDma_ReadReg
#define XZDma_ReadReg(BaseAddress, RegOffset)
This macro reads the given register.
Definition: xzdma_hw.h:396

This function returns interrupt mask to know which interrupts are enabled and which of them were disabled.

Parameters

  InstancePtr | is a pointer to the XZDma instance.

Returns
  The current interrupt mask. The mask indicates which interrupts are enabled/disabled. 0 bit represents .....corresponding interrupt is enabled. 1 bit represents .....Corresponding interrupt is disabled.

Note
  C-style signature: void XZDma_GetIntrMask(XZDma *InstancePtr)

Referenced by XZDma_IntrHandler().

#define XZDma_GetSrcIntrCnt | ( |  | InstancePtr | ) |

Value:
XZDma_ReadReg((InstancePtr)->Config.BaseAddress, \
XZDMA_CH_IRQ_SRC_ACCT_OFFSET)
XZDma_ReadReg
#define XZDma_ReadReg(BaseAddress, RegOffset)
This macro reads the given register.
Definition: xzdma_hw.h:396

This function gets the total number of Interrupt count for source after last call of this API.

Parameters

  InstancePtr | is a pointer to the XZDma instance.

Returns
  None.

Note
  Once this API is called then count will become zero. C-style signature: void XZDma_GetSrcIntrCnt(XZDma *InstancePtr)

Referenced by XZDma_Reset().

#define XZDma_GetTotalByte | ( |  | InstancePtr | ) |

Value:
XZDma_ReadReg((InstancePtr)->Config.BaseAddress, \
XZDMA_CH_TOTAL_BYTE_OFFSET)
XZDma_ReadReg
#define XZDma_ReadReg(BaseAddress, RegOffset)
This macro reads the given register.
Definition: xzdma_hw.h:396

This function gets the count of total bytes transferred through core since last clear in ZDMA core.

Parameters

  InstancePtr | is a pointer to the XZDma instance.

Returns
  None.

Note
  C-style signature: void XZDma_GetTotalByte(XZDma *InstancePtr)

#define XZDma_IntrClear | ( |  | InstancePtr,
|  |  | Mask
| ) |  |

Value:
XZDma_WriteReg( (InstancePtr)->Config.BaseAddress, \
XZDMA_CH_ISR_OFFSET, ((u32)(Mask) & (u32)XZDMA_IXR_ALL_INTR_MASK))
XZDMA_IXR_ALL_INTR_MASK
#define XZDMA_IXR_ALL_INTR_MASK
IXR OR of all the interrupts mask.
Definition: xzdma_hw.h:153
XZDma_WriteReg
#define XZDma_WriteReg(BaseAddress, RegOffset, Data)
This macro writes the value into the given register.
Definition: xzdma_hw.h:414

This function clears interrupt(s).

Every bit set in Interrupt Status Register indicates that a specific type of interrupt is occurring, and this function clears one or more interrupts by writing a bit mask to Interrupt Clear Register.

Parameters

  InstancePtr | is a pointer to the XZDma instance.
  Mask | is the type of the interrupts to enable. Use OR'ing of XZDMA_IXR_DMA_*_MASK constants defined in xzdma_hw.h to create this parameter value.

Returns
  None.

Note
  C-style signature: void XZDma_IntrClear(XZDma *InstancePtr)

Referenced by XZDma_IntrHandler(), and XZDma_Reset().

#define XZDma_IntrGetStatus | ( |  | InstancePtr | ) | XZDma_ReadReg((InstancePtr)->Config.BaseAddress, XZDMA_CH_ISR_OFFSET)

This function returns interrupt status read from Interrupt Status Register.

Use the XZDMA_IXR_DMA_*_MASK constants defined in xzdma_hw.h to interpret the returned value.

Parameters

  InstancePtr | is a pointer to the XZDma instance.

Returns
  The pending interrupts of the ZDMA core. Use the masks specified in xzdma_hw.h to interpret the returned value.

Note
  C-style signature: void XZDma_IntrGetStatus(XZDma *InstancePtr)

Referenced by XZDma_IntrHandler().

#define XZDma_SrcCurPyld | ( |  | InstancePtr | ) |

Value:
((u64)(XZDma_ReadReg((InstancePtr)->Config.BaseAddress, \
XZDMA_CH_SRC_CUR_PYLD_LSB_OFFSET)) | \
((u64)(XZDma_ReadReg((InstancePtr)->Config.BaseAddress, \
XZDMA_CH_SRC_CUR_PYLD_MSB_OFFSET)) << XZDMA_WORD1_MSB_SHIFT))
XZDMA_WORD1_MSB_SHIFT
#define XZDMA_WORD1_MSB_SHIFT
MSB Address shift.
Definition: xzdma_hw.h:283
XZDma_ReadReg
#define XZDma_ReadReg(BaseAddress, RegOffset)
This macro reads the given register.
Definition: xzdma_hw.h:396

This function returns source current payload address under process of ZDMA core.

Parameters

  InstancePtr | is a pointer to the XZDma instance.

Returns
  None.

Note
  This address may not be precise due to ZDMA pipeline structure C-style signature: u64 XZDma_SrcCurPyld(XZDma *InstancePtr)

#define XZDma_SrcDscrCurPyld | ( |  | InstancePtr | ) |

Value:
((u64)(XZDma_ReadReg((InstancePtr)->Config.BaseAddress, \
XZDMA_CH_SRC_CUR_DSCR_LSB_OFFSET)) | \
((u64)(XZDma_ReadReg((InstancePtr)->Config.BaseAddress, \
XZDMA_CH_SRC_CUR_DSCR_MSB_OFFSET)) << XZDMA_WORD1_MSB_SHIFT))
XZDMA_WORD1_MSB_SHIFT
#define XZDMA_WORD1_MSB_SHIFT
MSB Address shift.
Definition: xzdma_hw.h:283
XZDma_ReadReg
#define XZDma_ReadReg(BaseAddress, RegOffset)
This macro reads the given register.
Definition: xzdma_hw.h:396

This function returns source descriptor current payload address under process of ZDMA core.

Parameters

  InstancePtr | is a pointer to the XZDma instance.

Returns
  None.

Note
  This address may not be precise due to ZDMA pipeline structure C-style signature: u64 XZDma_SrcDscrCurPyld(XZDma *InstancePtr)

#define XZDma_TotalByteClear | ( |  | InstancePtr | ) |

Value:
XZDma_WriteReg((InstancePtr)->Config.BaseAddress, \
XZDMA_CH_TOTAL_BYTE_OFFSET, \
XZDma_ReadReg((InstancePtr)->Config.BaseAddress, \
XZDMA_CH_TOTAL_BYTE_OFFSET))
XZDma_WriteReg
#define XZDma_WriteReg(BaseAddress, RegOffset, Data)
This macro writes the value into the given register.
Definition: xzdma_hw.h:414
XZDma_ReadReg
#define XZDma_ReadReg(BaseAddress, RegOffset)
This macro reads the given register.
Definition: xzdma_hw.h:396

This function clears the count of total bytes transferred in ZDMA core.

Parameters

  InstancePtr | is a pointer to the XZDma instance.

Returns
  None.

Note
  C-style signature: void XZDma_TotalByteClear(XZDma *InstancePtr)

Referenced by XZDma_Reset().

## Typedef Documentation

typedef void(* XZDma_DoneHandler)(void *CallBackRef)

Callback type for Completion of all data transfers.

Parameters

  CallBackRef | is a callback reference passed in by the upper layer when setting the callback functions, and passed back to the upper layer when the callback is invoked.

typedef void(* XZDma_ErrorHandler)(void *CallBackRef, u32 ErrorMask)

Callback type for all error interrupts.

Parameters

  CallBackRef | is a callback reference passed in by the upper layer when setting the callback functions, and passed back to the upper layer when the callback is invoked.
  ErrorMask | is a bit mask indicating the cause of the error. Its value equals 'OR'ing one or more XZDMA_IXR_* values defined in xzdma_hw.h

## Enumeration Type Documentation

enum XZDma_BurstType

This typedef contains ZDMA AXI Burst type definitions.

Enumerator
XZDMA_FIXED_BURST | Fixed burst type.
XZDMA_INCR_BURST | Increment burst type.

enum XZDma_DscrType

This typedef contains ZDMA Descriptors Types.

Enumerator
XZDMA_LINEAR | Linear descriptor.
XZDMA_LINKEDLIST | Linked list descriptor.

enum XZDma_Mode

This typedef contains ZDMA Operation modes.

Enumerator
XZDMA_NORMAL_MODE | Normal transfer from source to destination.
XZDMA_WRONLY_MODE | Write only mode.
XZDMA_RDONLY_MODE | Read only mode.

enum XZDmaState

This typedef contains ZDMA state.

Enumerator
XZDMA_IDLE | ZDMA is in Idle state.
XZDMA_PAUSE | Paused state.
XZDMA_BUSY | Busy state.