aiengine: xaieio.h File Reference

| aiengine Xilinx SDK Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List

xaieio.h File Reference

## Overview

This file contains the generic definitions for the AIE simulator interface.

    MODIFICATION HISTORY:

    Ver   Who     Date     Changes

    1.0  Hyun    07/12/2018  Initial creation
    1.1  Nishad  12/05/2018  Renamed ME attributes to AIE

void | XAieIO_Finish (void)
| This is the memory IO function to free the global IO instance. More...
void | XAieIO_Init (void)
| This is the memory IO function to initialize the global IO instance. More...
void | XAieIO_IntrUnregisterIsr (int Offset)
| This function unregisters the interrupt handler for given irq offset. More...
int | XAieIO_IntrRegisterIsr (int Offset, int(*Handler)(void *Data), void *Data)
| This function registers the interrupt handler for given irq offset. More...
void * | _XAieIO_GetIO (void)
| This is the memory IO function to get a low level IO instance. More...
uint32 | XAieIO_Read32 (uint64_t Addr)
| This is the memory IO function to read 32bit data from the specified address. More...
void | XAieIO_MemFinish (XAieIO_Mem *IO_MemInstPtr)
| This is the IO memory function to free the memory instance. More...
void | XAieIO_MemDetach (XAieIO_Mem *IO_MemInstPtr)
| This is the IO memory function to detach the memory from device. More...
XAieIO_Mem * | XAieIO_MemAttach (uint64_t Vaddr, uint64_t Paddr, uint64_t Size, uint64_t MemHandle)
| This is the IO memory function to attach the external memory to device. More...
void | XAieIO_MemFree (XAieIO_Mem *IO_MemInstPtr)
| This is the IO memory function to free the memory. More...
uint8 | XAieIO_MemSyncForCPU (XAieIO_Mem *IO_MemInstPtr)
| This is the IO memory function to sync the memory for CPU. More...
uint8 | XAieIO_MemSyncForDev (XAieIO_Mem *IO_MemInstPtr)
| This is the IO memory function to sync the memory for device. More...
uint64_t | XAieIO_MemGetSize (XAieIO_Mem *IO_MemInstPtr)
| This is the IO memory function to return the size of the memory instance. More...
uint64_t | XAieIO_MemGetVaddr (XAieIO_Mem *IO_MemInstPtr)
| This is the IO memory function to return the mapped virtual address of the memory instance. More...
uint64_t | XAieIO_MemGetPaddr (XAieIO_Mem *IO_MemInstPtr)
| This is the IO memory function to return the physical address of the memory instance. More...
uint32 | XAieIO_MemRead32 (XAieIO_Mem *IO_MemInstPtr, uint64_t Addr)
| This is the IO memory function to read from the physical address. More...
uint32 | XAieIO_NPIRead32 (uint64_t Addr)
| This is the NPI IO function to read 32bit data from the specified address. More...

## Function Documentation

void* _XAieIO_GetIO | ( | void |  | ) |

This is the memory IO function to get a low level IO instance.

Parameters

  None. |

Returns
  A void pointer that points to the low level IO instance.

Note
  This function is for internal use only, and not meant to be used by applications.

void XAieIO_Finish | ( | void |  | ) |

This is the memory IO function to free the global IO instance.

Parameters

  None. |

Returns
  None.

Note
  The global IO instance is a singleton and freed when the reference count reaches a zero.

Referenced by XAieIO_IntrRegisterIsr(), XAieIO_IntrUnregisterIsr(), XAieIO_MemAllocate(), XAieIO_MemAttach(), XAieIO_MemDetach(), XAieIO_MemFinish(), and XAieIO_MemFree().

void XAieIO_Init | ( | void |  | ) |

This is the memory IO function to initialize the global IO instance.

Parameters

  None. |

Returns
  None.

Note
  The global IO instance is a singleton and any further attempt to initialize just increments the reference count.

Referenced by XAieIO_IntrRegisterIsr(), XAieIO_MemAllocate(), XAieIO_MemAttach(), XAieIO_MemInit(), and XAieLib_InitDev().

int XAieIO_IntrRegisterIsr | ( | int | Offset,
|  | int(*)(void *Data) | Handler,
|  | void * | Data
| ) |  |

This function registers the interrupt handler for given irq offset.

Parameters

  Offset,: | The value should one of 1 - 3. Current it's not used.
  Handler,: | the callback to be called upon interrupt.
  Data,: | the data to be used with the handler.

Returns
  XAIELIB_SUCCESS for success, XAIELIB_FAILURE otherwise.

Note
  The driver doesn't support all 4 interrupts yet, so the offset is not used. The handler is registerd as global one, so it isn't allowed to register more than one handlers.

References XAieIO_Finish(), and XAieIO_Init().

Referenced by XAieLib_InterruptRegisterIsr().

void XAieIO_IntrUnregisterIsr | ( | int | Offset | ) |

This function unregisters the interrupt handler for given irq offset.

Parameters

  Offset,: | The value should one of 1 - 3. Current it's not used.

Returns
  None.

Note
  The driver doesn't support all 4 interrupts yet, so the offset is not used.

References XAieIO_Finish().

Referenced by XAieLib_InterruptUnregisterIsr().

XAieIO_Mem* XAieIO_MemAttach | ( | uint64_t | Vaddr,
|  | uint64_t | Paddr,
|  | uint64_t | Size,
|  | uint64_t | MemHandle
| ) |  |

This is the IO memory function to attach the external memory to device.

Parameters

  Vaddr,: | Optional. Vaddr of the memory
  Paddr,: | Optional. Paddr of the memory
  Size,: | Required. Size of the memory
  MemHandle,: | Required. Handle of the memory. For linux, dmabuf fd

Returns
  Pointer to the attached IO memory instance.

Note
  None.

References XAieIO_Finish(), and XAieIO_Init().

Referenced by XAieLib_MemAttach().

void XAieIO_MemDetach | ( | XAieIO_Mem * | IO_MemInstPtr | ) |

This is the IO memory function to detach the memory from device.

Parameters

  IO_MemInstPtr,: | IO Memory instance pointer.

Returns
  None.

Note
  None.

References XAieIO_Finish().

Referenced by XAieLib_MemDetach().

void XAieIO_MemFinish | ( | XAieIO_Mem * | IO_MemInstPtr | ) |

This is the IO memory function to free the memory instance.

Parameters

  IO_MemInstPtr,: | IO Memory instance pointer.

Returns
  None.

Note
  is freed and invalid after this function.

References XAieIO_Finish().

Referenced by XAieLib_MemFinish().

void XAieIO_MemFree | ( | XAieIO_Mem * | IO_MemInstPtr | ) |

This is the IO memory function to free the memory.

Parameters

  IO_MemInstPtr,: | IO Memory instance pointer.

Returns
  None.

Note
  None.

References XAieIO_Finish().

Referenced by XAieLib_MemFree().

uint64_t XAieIO_MemGetPaddr | ( | XAieIO_Mem * | IO_MemInstPtr | ) |

This is the IO memory function to return the physical address of the memory instance.

Parameters

  IO_MemInstPtr,: | IO Memory instance pointer.

Returns
  Physical address of the memory instance

Note
  None.

Referenced by XAieLib_MemGetPaddr().

uint64_t XAieIO_MemGetSize | ( | XAieIO_Mem * | IO_MemInstPtr | ) |

This is the IO memory function to return the size of the memory instance.

Parameters

  IO_MemInstPtr,: | IO Memory instance pointer.

Returns
  size of the memory instance

Note
  None.

Referenced by XAieLib_MemGetSize().

uint64_t XAieIO_MemGetVaddr | ( | XAieIO_Mem * | IO_MemInstPtr | ) |

This is the IO memory function to return the mapped virtual address of the memory instance.

Parameters

  IO_MemInstPtr,: | IO Memory instance pointer.

Returns
  Mapped virtual address.

Note
  None.

Referenced by XAieLib_MemGetVaddr().

uint32 XAieIO_MemRead32 | ( | XAieIO_Mem * | IO_MemInstPtr,
|  | uint64_t | Addr
| ) |  |

This is the IO memory function to read from the physical address.

Parameters

  IO_MemInstPtr,: | IO Memory instance pointer.
  Addr,: | Absolute physical address to read from.

Returns
  A read 32 bit data.

Note
  None.

Referenced by XAieLib_MemRead32().

uint8 XAieIO_MemSyncForCPU | ( | XAieIO_Mem * | IO_MemInstPtr | ) |

This is the IO memory function to sync the memory for CPU.

Parameters

  IO_MemInstPtr,: | IO Memory instance pointer.

Returns
  None.

Note
  This only works with imported or allocated memory. This doesn't do anything with memory from the own memory pool, ex XAieIO_MemInit().

Referenced by XAieLib_MemSyncForCPU().

uint8 XAieIO_MemSyncForDev | ( | XAieIO_Mem * | IO_MemInstPtr | ) |

This is the IO memory function to sync the memory for device.

Parameters

  IO_MemInstPtr,: | IO Memory instance pointer.

Returns
  None.

Note
  This only works with imported or allocated memory. This doesn't do anything with memory from the own memory pool, ex XAieIO_MemInit().

Referenced by XAieLib_MemSyncForDev().

uint32 XAieIO_NPIRead32 | ( | u64 | Addr | ) |

This is the NPI IO function to read 32bit data from the specified address.

Parameters

  Addr,: | Address to read from.

Returns
  32-bit read value.

Note
  This only work if NPI is accessble.

Referenced by XAieLib_NPIMaskWrite32(), and XAieLib_NPIRead32().

uint32 XAieIO_Read32 | ( | u64 | Addr | ) |

This is the memory IO function to read 32bit data from the specified address.

Parameters

  Addr,: | Address to read from.

Returns
  32-bit read value.

Note
  None.

Referenced by XAieIO_Read128(), XAieLib_MaskWrite32(), XAieLib_Read128(), and XAieLib_Read32().