System utilities#

System utilities to define entrypoint and query information which is only known at VPU runtime.

Macros#

CUPVA_VPU_MAIN

Entrypoint to CUPVA VPU code.

Functions#

uint32_t cupvaGetChannelRegAddr(int8_t channel_idx, uint16_t reg_ofst)

Return a channel register address given channel id and register offset.

uint32_t cupvaGetDmaDescBase(void)

Return base address of the DMA descriptor memory used by this VPU's DMA.

uint32_t cupvaGetHwseqRamBase(void)

Return base address of the Hwseq memory used by this VPU's DMA.

uint32_t cupvaGetL2Base(void)

Get the base address of our L2SRAM allocation.

void cupvaGetL2ExtMemPointer(ExtMemPointer *ptr, uint32_t offset)

Create an ExtMemPointer from a L2 offset.

uint32_t cupvaGetL2Size(void)

Get the size our L2SRAM allocation.

uint32_t cupvaGetVmemAddress(void *ptr)

Convert VMEM pointer to arch address.

uint32_t cupvaGetVmemBase(void)

Return base address of the VMEM owned by this VPU.

uint32_t cupvaGetVpuId(void)

Return index of the current VPU.

Data Structures#

ExtMemPointer

Structure to hold information about buffers not stored in VMEM.

VPUSurfaceData

Structure to hold surface information to be populated at runtime by host API.

VPUSurfaceMetadata

Structure to hold surface metadata to be populated at runtime by host API.

Functions#

inline uint32_t cupvaGetChannelRegAddr(
int8_t channel_idx,
uint16_t reg_ofst,
)#

Return a channel register address given channel id and register offset.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

Returns:

a channel register address

Pre:

None

inline uint32_t cupvaGetDmaDescBase(void)#

Return base address of the DMA descriptor memory used by this VPU’s DMA.

For VPU config applications, it is required to update DMA descriptors. This function can be used to get the starting base address of where those DMA descriptors are stored at runtime.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

Returns:

DMA descriptor RAM base address

Pre:

None

inline uint32_t cupvaGetHwseqRamBase(void)#

Return base address of the Hwseq memory used by this VPU’s DMA.

For VPU config applications, it is required to update Hwseq RAM. This function can be used to get the starting base address of Hwseq memory at runtime.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

Returns:

Hwseq RAM base address

Pre:

None

inline uint32_t cupvaGetL2Base(void)#

Get the base address of our L2SRAM allocation.

For VPU config applications involving L2SRAM, it is required to know the base of L2 allocation when reconfiguring DMA. Note that the application must have requested an L2 allocation for this value to be valid.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

Returns:

L2 base address which can be used to configure DMA descriptors

Pre:

None

inline void cupvaGetL2ExtMemPointer(
ExtMemPointer *ptr,
uint32_t offset,
)#

Create an ExtMemPointer from a L2 offset.

This API fills a pointer to ExtMemPointer object with proper L2 address info.

Pointers passed to this function must be valid and must not be NULL. Failure to do so will result in undefined behavior.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

Parameters:
  • ptr – The pointer to an ExtMemPointer object.

  • offset – The offset to a L2 allocation.

Pre:

None

inline uint32_t cupvaGetL2Size(void)#

Get the size our L2SRAM allocation.

Query the size of the L2 allocation provisioned for this application.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

Returns:

L2 size in bytes

Pre:

None

inline uint32_t cupvaGetVmemAddress(void *ptr)#

Convert VMEM pointer to arch address.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

Parameters:

ptr – Pointer to some VMEM address. Pointer must be valid and must not be NULL. Failure to do so will result in undefined behavior.

Returns:

DMA compatible address corresponding to the memory pointed at by ptr.

Pre:

None

inline uint32_t cupvaGetVmemBase(void)#

Return base address of the VMEM owned by this VPU.

A VPU application can query its base VMEM address for use in reconfiguring DMA.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

Returns:

DMA compatible address corresponding to the base of this VPU’s VMEM.

Pre:

None

inline uint32_t cupvaGetVpuId(void)#

Return index of the current VPU.

A VPU application can query which VPU it has been dispatched to with this function.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

Returns:

VPU index (0 or 1)

Pre:

None