| aiengine Vitis Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List

xaiedma_tile.c File Reference

## Overview

This file contains the routines to initialize and configure the Tile DMA.

    MODIFICATION HISTORY:

    Ver   Who     Date     Changes

    1.0  Naresh  04/06/2018  Initial creation
    1.1  Naresh  04/12/2018  Added workaround for CRVO#1692
    1.2  Naresh  06/20/2018  Fixed CR#1005445
    1.3  Naresh  07/11/2018  Updated copyright info
    1.4  Nishad  12/05/2018  Renamed ME attributes to AIE
    1.5  Hyun    01/08/2019  Don't poll the status after control change
    1.6  Nishad  03/20/2019  Fix the use of uninitialized pointer in
                               XAieDma_TileBdSetLock function
    1.7  Hyun    06/20/2019  Remove the duplicate initialization on BD
    1.8  Hyun    06/20/2019  Add XAieDma_TileBdClearAll() that resets all sw BDs
    1.9  Hyun    06/20/2019  Added APIs for individual BD / Channel reset
    2.0  Hyun    06/20/2019  Add XAieDma_TileSoftInitialize()

## Functions
u32 | XAieDma_TileSoftInitialize (XAieGbl_Tile *TileInstPtr, XAieDma_Tile *DmaInstPtr)
| This API intializes the Tile DMA instances without programming hardware resource. More...
u32 | XAieDma_TileInitialize (XAieGbl_Tile *TileInstPtr, XAieDma_Tile *DmaInstPtr)
| This API intializes the Tile DMA BDs to their default values and followed by a reset and disable of all the 4 channels (S2MM0, S2MM1, MM2S0, MM2S1). More...
void | XAieDma_TileBdSetLock (XAieDma_Tile *DmaInstPtr, u8 BdNum, u8 AbType, u8 LockId, u8 LockRelEn, u8 LockRelVal, u8 LockAcqEn, u8 LockAcqVal)
| This API is to configure the Lock release and acquire attributes for the selected BD entry in the Tile DMA instance which is later written to the the physical BD location. More...
void | XAieDma_TileBdSetXy2d (XAieDma_Tile *DmaInstPtr, u8 BdNum, u8 XyType, u16 Incr, u16 Wrap, u16 Offset)
| This API configures the 2D X or Y attributes for the selected BD entry in the Tile DMA instance. More...
void | XAieDma_TileBdSetIntlv (XAieDma_Tile *DmaInstPtr, u8 BdNum, u8 IntlvMode, u8 IntlvDb, u8 IntlvCnt, u16 IntlvCur)
| This API configures the Interleave attributes for the selected BD entry in the Tile DMA instance. More...
void | XAieDma_TileBdSetPkt (XAieDma_Tile *DmaInstPtr, u8 BdNum, u8 PktEn, u8 PktType, u8 PktId)
| This API configures the Packet attributes of the selected BD entry in the Tile DMA instance. More...
void | XAieDma_TileBdSetAdrLenMod (XAieDma_Tile *DmaInstPtr, u8 BdNum, u16 BaseAddrA, u16 BaseAddrB, u16 Length, u8 AbMode, u8 FifoMode)
| This API configures the address, length and mode attributes for the selected BD entry in the Tile DMA instance. More...
void | XAieDma_TileBdSetNext (XAieDma_Tile *DmaInstPtr, u8 BdNum, u8 NextBd)
| This API configures the Next BD attribute for the selected BD entry in the Tile DMA instance. More...
void | XAieDma_TileBdWrite (XAieDma_Tile *DmaInstPtr, u8 BdNum)
| This API writes all the attributes of the selected BD entry in the Tile DMA instance to the actual physical BD location. More...
void | XAieDma_TileBdClear (XAieDma_Tile *DmaInstPtr, u8 BdNum)
| This API is used to clear the selected BD entry in the Tile DMA instance. More...
void | XAieDma_TileBdClearAll (XAieDma_Tile *DmaInstPtr)
| This API is used to clear all BD entries in the Tile DMA instance. More...
u32 | XAieDma_TileChControl (XAieDma_Tile *DmaInstPtr, u8 ChNum, u8 Reset, u8 Enable)
| This API is used to reset/enable the selected Tile DMA channel. More...
u32 | XAieDma_TileChReset (XAieDma_Tile *DmaInstPtr, u8 ChNum)
| This API is used to reset the selected Tile DMA channel. More...
u32 | XAieDma_TileChResetAll (XAieDma_Tile *DmaInstPtr)
| This API is used to reset all Tile DMA channel. More...

## Function Documentation

void XAieDma_TileBdClear | ( | XAieDma_Tile * | DmaInstPtr,
|  | u8 | BdNum
| ) |  |

This API is used to clear the selected BD entry in the Tile DMA instance.

Parameters

  DmaInstPtr | - Pointer to the Tile DMA instance.
  BdNum | - BD index which needs to be cleared.

Returns
  None.

Note
  This doesn't clear the values in the BD physical location.

References XAieDma_TileBd::AbMode, XAieDma_TileBd::AddrA, XAieDma_TileBd::AddrB, XAieDma_TileBdLock::BaseAddr, XAieDma_Tile::Descrs, XAieDma_TileBd::FifoMode, XAieDma_TileBdXy::Incr, XAieDma_TileBd::IntlvCnt, XAieDma_TileBd::IntlvCur, XAieDma_TileBd::IntlvDb, XAieDma_TileBd::IntlvMode, XAieDma_TileBd::Length, XAieDma_TileBdLock::LkAcqEn, XAieDma_TileBdLock::LkAcqVal, XAieDma_TileBdLock::LkAcqValEn, XAieDma_TileBdLock::LkRelEn, XAieDma_TileBdLock::LkRelVal, XAieDma_TileBdLock::LkRelValEn, XAieDma_TileBdLock::LockId, XAieDma_TileBd::NextBd, XAieDma_TileBd::NextBdEn, XAieDma_TileBdXy::Offset, XAieDma_TileBd::PktEn, XAieDma_TileBd::PktId, XAieDma_TileBd::PktType, XAieDma_TileBdXy::Wrap, XAieDma_TileBd::X2dCfg, and XAieDma_TileBd::Y2dCfg.

Referenced by XAieDma_TileBdClearAll(), and XAieDma_TileInitialize().

void XAieDma_TileBdClearAll | ( | XAieDma_Tile * | DmaInstPtr | ) |

This API is used to clear all BD entries in the Tile DMA instance.

Parameters

  DmaInstPtr | - Pointer to the Tile DMA instance.

Returns
  None.

Note
  This doesn't clear the values in the BD physical location.

References XAieDma_TileBdClear().

void XAieDma_TileBdSetAdrLenMod | ( | XAieDma_Tile * | DmaInstPtr,
|  | u8 | BdNum,
|  | u16 | BaseAddrA,
|  | u16 | BaseAddrB,
|  | u16 | Length,
|  | u8 | AbMode,
|  | u8 | FifoMode
| ) |  |

This API configures the address, length and mode attributes for the selected BD entry in the Tile DMA instance.

Parameters

  DmaInstPtr | - Pointer to the Tile DMA instance.
  BdNum | - BD index whose attributes need to be set to.
  BaseAddrA | - AddrA base address (to be in 32b words).
  BaseAddrB | - AddrB base address (to be in 32b words).
  Length | - Transfer length in bytes.
  AbMode | - Enable/disable double buffer mode(1-Enable,0-Disable).
  FifoMode | - 0 to disable. XAIEDMA_TILE_FIFO_CNT0 or XAIE_DMA_TILE_FIFO_CNT1 to enable.

Returns
  None.

Note
  This doesn't set the values in the BD physical location.

References XAieDma_TileBd::AbMode, XAieDma_TileBd::AddrA, XAieDma_TileBd::AddrB, XAieDma_TileBdLock::BaseAddr, XAieDma_Tile::Descrs, XAieDma_TileBd::FifoMode, and XAieDma_TileBd::Length.

Referenced by main().

void XAieDma_TileBdSetIntlv | ( | XAieDma_Tile * | DmaInstPtr,
|  | u8 | BdNum,
|  | u8 | IntlvMode,
|  | u8 | IntlvDb,
|  | u8 | IntlvCnt,
|  | u16 | IntlvCur
| ) |  |

This API configures the Interleave attributes for the selected BD entry in the Tile DMA instance.

Parameters

  DmaInstPtr | - Pointer to the Tile DMA instance.
  BdNum | - BD index whose attributes need to be set to.
  IntlvMode | - Enable/Disable Interleave mode(1-Enable,0-Disable).
  IntlvDb | - Double buffer to use, A or B.
  IntlvCnt | - Interleaved count to use (to be 32b word aligned).
  IntlvCur | - Interleave current pointer.

Returns
  None.

Note
  This doesn't set the values in the BD physical location.

References XAieDma_Tile::Descrs, XAieDma_TileBd::IntlvCnt, XAieDma_TileBd::IntlvCur, XAieDma_TileBd::IntlvDb, and XAieDma_TileBd::IntlvMode.

void XAieDma_TileBdSetLock | ( | XAieDma_Tile * | DmaInstPtr,
|  | u8 | BdNum,
|  | u8 | AbType,
|  | u8 | LockId,
|  | u8 | LockRelEn,
|  | u8 | LockRelVal,
|  | u8 | LockAcqEn,
|  | u8 | LockAcqVal
| ) |  |

This API is to configure the Lock release and acquire attributes for the selected BD entry in the Tile DMA instance which is later written to the the physical BD location.

Parameters

  DmaInstPtr | - Pointer to the Tile DMA instance.
  BdNum | - BD index whose attributes need to be set to.
  AbType | - A or B type in double buffering (0-AddrA, 1-AddrB).
  LockId | - Lock index value, ranging from 0-15.
  LockRelEn | - Enable/Disable lock release (1-Enable,0-Disable).
  LockRelVal | - Lock release value (Valid:0/1 & Invalid:0xFF).
  LockAcqEn | - Enable/Disable lock acquire (1-Enable,0-Disable).
  LockAcqVal | - Lock acquire value (Valid:0/1 & Invalid:0xFF).

Returns
  None.

Note
  This doesn't set the values in the BD physical location.

References XAieDma_TileBd::AddrA, XAieDma_TileBd::AddrB, XAieDma_Tile::Descrs, XAieDma_TileBdLock::LkAcqEn, XAieDma_TileBdLock::LkAcqVal, XAieDma_TileBdLock::LkAcqValEn, XAieDma_TileBdLock::LkRelEn, XAieDma_TileBdLock::LkRelVal, XAieDma_TileBdLock::LkRelValEn, and XAieDma_TileBdLock::LockId.

Referenced by main().

void XAieDma_TileBdSetNext | ( | XAieDma_Tile * | DmaInstPtr,
|  | u8 | BdNum,
|  | u8 | NextBd
| ) |  |

This API configures the Next BD attribute for the selected BD entry in the Tile DMA instance.

Parameters

  DmaInstPtr | - Pointer to the Tile DMA instance.
  BdNum | - BD index whose attributes need to be set to.
  NextBd | - Next BD to use, ranging from 0-15. If NextBd==0xFF, it is deemed invalid and UseNextBd is set to 0.

Returns
  None.

Note
  This doesn't set the values in the BD physical location.

References XAieDma_Tile::Descrs, XAieDma_TileBd::NextBd, and XAieDma_TileBd::NextBdEn.

Referenced by main().

void XAieDma_TileBdSetPkt | ( | XAieDma_Tile * | DmaInstPtr,
|  | u8 | BdNum,
|  | u8 | PktEn,
|  | u8 | PktType,
|  | u8 | PktId
| ) |  |

This API configures the Packet attributes of the selected BD entry in the Tile DMA instance.

Parameters

  DmaInstPtr | - Pointer to the Tile DMA instance.
  BdNum | - BD index whose attributes need to be set to.
  PktEn | - Enable/Disable Pkt switching mode (1-Enable,0-Disable).
  PktType | - Packet type.
  PktId | - ID value for the packet.

Returns
  None.

Note
  This doesn't set the values in the BD physical location.

References XAieDma_Tile::Descrs, XAieDma_TileBd::PktEn, XAieDma_TileBd::PktId, and XAieDma_TileBd::PktType.

void XAieDma_TileBdSetXy2d | ( | XAieDma_Tile * | DmaInstPtr,
|  | u8 | BdNum,
|  | u8 | XyType,
|  | u16 | Incr,
|  | u16 | Wrap,
|  | u16 | Offset
| ) |  |

This API configures the 2D X or Y attributes for the selected BD entry in the Tile DMA instance.

Parameters

  DmaInstPtr | - Pointer to the Tile DMA instance.
  BdNum | - BD index whose attributes need to be set to.
  XyType | - X oy Y addressing attributes (0-X, 1-Y).
  Incr | - Increment to be used for X/Y addressing.
  Wrap | - Wrap to be used for X/Y addressing.
  Offset | - Offset to be used for X/Y addressing.

Returns
  None.

Note
  This doesn't set the values in the BD physical location.

References XAieDma_Tile::Descrs, XAieDma_TileBdXy::Incr, XAieDma_TileBdXy::Offset, XAieDma_TileBdXy::Wrap, XAieDma_TileBd::X2dCfg, and XAieDma_TileBd::Y2dCfg.

void XAieDma_TileBdWrite | ( | XAieDma_Tile * | DmaInstPtr,
|  | u8 | BdNum
| ) |  |

This API writes all the attributes of the selected BD entry in the Tile DMA instance to the actual physical BD location.

Parameters

  DmaInstPtr | - Pointer to the Tile DMA instance.
  BdNum | - BD index whose attributes need to be written to the corresponding physical location.

Returns
  None.

Note
  None.

References XAieGbl_RegTileBdCtrl::Ab, XAieDma_TileBd::AbMode, XAieGbl_RegTileBdAdd::AcqEn, XAieGbl_RegTileBdAdd::AcqVal, XAieGbl_RegTileBdAdd::AcqValEn, XAieGbl_RegTileDmaBd::AddA, XAieGbl_RegTileDmaBd::AddB, XAieDma_TileBd::AddrA, XAieDma_TileBd::AddrB, XAieGbl_RegTileBdAdd::Base, XAieDma_TileBdLock::BaseAddr, XAieDma_Tile::BaseAddress, XAieGbl_RegTileBdCtrl::Cnt, XAieGbl_RegTileDmaBd::Ctrl, XAieGbl_RegTileBdInt::Curr, XAieDma_Tile::Descrs, XAieGbl_RegTileBdCtrl::Fifo, XAieDma_TileBd::FifoMode, XAieGbl_RegTileBdPkt::Id, XAieDma_TileBdXy::Incr, XAieGbl_RegTileBd2D::Incr, XAieGbl_RegTileBdCtrl::Intlv, XAieGbl_RegTileDmaBd::Intlv, XAieDma_TileBd::IntlvCnt, XAieDma_TileBd::IntlvCur, XAieDma_TileBd::IntlvDb, XAieDma_TileBd::IntlvMode, XAieGbl_RegTileBdCtrl::Len, XAieDma_TileBd::Length, XAieDma_TileBdLock::LkAcqEn, XAieDma_TileBdLock::LkAcqVal, XAieDma_TileBdLock::LkAcqValEn, XAieGbl_RegTileBdAdd::LkId, XAieDma_TileBdLock::LkRelEn, XAieDma_TileBdLock::LkRelVal, XAieDma_TileBdLock::LkRelValEn, XAieDma_TileBdLock::LockId, XAieGbl_RegFldAttr::Lsb, XAieGbl_RegFldAttr::Mask, XAieGbl_RegTileBdCtrl::NexBd, XAieGbl_RegTileBdCtrl::NexEn, XAieDma_TileBd::NextBd, XAieDma_TileBd::NextBdEn, XAieGbl_RegTileBd2D::Off, XAieDma_TileBdXy::Offset, XAieGbl_RegTileBdCtrl::Pkt, XAieGbl_RegTileDmaBd::Pkt, XAieDma_TileBd::PktEn, XAieDma_TileBd::PktId, XAieDma_TileBd::PktType, XAieGbl_RegTileDmaBd::RegOff, XAieGbl_RegTileBdAdd::RelEn, XAieGbl_RegTileBdAdd::RelVal, XAieGbl_RegTileBdAdd::RelValEn, XAieGbl_RegTileBdInt::Sts, XAieGbl_RegTileBdPkt::Type, XAieGbl_RegTileBdCtrl::Valid, XAieDma_TileBdXy::Wrap, XAieGbl_RegTileBd2D::Wrap, XAieDma_TileBd::X2dCfg, XAieGbl_RegTileDmaBd::Xinc, XAieDma_TileBd::Y2dCfg, and XAieGbl_RegTileDmaBd::Yinc.

Referenced by main().

u32 XAieDma_TileChControl | ( | XAieDma_Tile * | DmaInstPtr,
|  | u8 | ChNum,
|  | u8 | Reset,
|  | u8 | Enable
| ) |  |

This API is used to reset/enable the selected Tile DMA channel.

Parameters

  DmaInstPtr | - Pointer to the Tile DMA instance.
  ChNum | - Channel number (0-S2MM0,1-S2MM1,2-MM2S0,3-MM2S1).
  Reset | - Reset/Unreset the channel (1-Reset,0-Unreset).
  Enable | - Enable/Disable the channel (1-Enable,0-Disable).

Returns
  XAIE_SUCCESS if successful, else XAIE_FAILURE.

Note
  None.

References XAieDma_Tile::BaseAddress, XAieGbl_RegTileDmaCh::CtrlOff, XAieGbl_RegTileDmaCh::En, XAieGbl_RegFldAttr::Mask, and XAieGbl_RegTileDmaCh::Rst.

Referenced by main(), XAieDma_TileChReset(), and XAieDma_TileInitialize().

u32 XAieDma_TileChReset | ( | XAieDma_Tile * | DmaInstPtr,
|  | u8 | ChNum
| ) |  |

This API is used to reset the selected Tile DMA channel.

The channel gets reset first, and then gets out of reset as disabled. The StartBd value is cleared in the instance, but not cleared in the register.

Parameters

  DmaInstPtr | - Pointer to the Tile DMA instance.
  ChNum | - Channel number (0-S2MM0,1-S2MM1,2-MM2S0,3-MM2S1).

Returns
  XAIE_SUCCESS if successful, else XAIE_FAILURE.

Note
  None.

References XAieDma_TileChControl(), and XAieDma_TileSetStartBd.

Referenced by XAieDma_TileChResetAll().

u32 XAieDma_TileChResetAll | ( | XAieDma_Tile * | DmaInstPtr | ) |

This API is used to reset all Tile DMA channel.

The channel gets reset first, and then gets out of reset as disabled. The StartBd value is cleared in the instance, but not cleared in the register.

Parameters

  DmaInstPtr | - Pointer to the Tile DMA instance.

Returns
  XAIE_SUCCESS if successful, or XAIE_FAILURE if any fails.

Note
  None.

References XAieDma_TileChReset().

u32 XAieDma_TileInitialize | ( | XAieGbl_Tile * | TileInstPtr,
|  | XAieDma_Tile * | DmaInstPtr
| ) |  |

This API intializes the Tile DMA BDs to their default values and followed by a reset and disable of all the 4 channels (S2MM0, S2MM1, MM2S0, MM2S1).

Parameters

  TileInstPtr | - Pointer to the Tile instance.
  DmaInstPtr | - Pointer to the Tile DMA instance.

Returns
  XAIE_SUCCESS if successful, else XAIE_FAILURE.

Note
  This API is required to be invoked first in the sequence, before any of the other Tile DMA driver APIs are used.

References XAieDma_Tile::BaseAddress, XAieDma_Tile::IsReady, XAieGbl_Tile::TileAddr, XAieGbl_Tile::TileType, XAieDma_TileBdClear(), XAieDma_TileChControl(), and XAieDma_TileSetStartBd.

Referenced by main().

u32 XAieDma_TileSoftInitialize | ( | XAieGbl_Tile * | TileInstPtr,
|  | XAieDma_Tile * | DmaInstPtr
| ) |  |

This API intializes the Tile DMA instances without programming hardware resource.

This allows to control individual resources independently.

Parameters

  TileInstPtr | - Pointer to the Tile instance.
  DmaInstPtr | - Pointer to the Tile DMA instance.

Returns
  XAIE_SUCCESS if successful, else XAIE_FAILURE.

Note
  This API is required to be invoked first in the sequence, before any of the other Tile DMA driver APIs are used.

References XAieDma_Tile::BaseAddress, XAieDma_Tile::IsReady, XAieGbl_Tile::TileAddr, and XAieGbl_Tile::TileType.