KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches

PowerVR DMA driver More...

Topics

 Transfer Modes
 Transfer modes with TA/PVR DMA and Store Queues
 

Typedefs

typedef void(* pvr_dma_callback_t) (void *data)
 PVR DMA interrupt callback type.
 

Functions

int pvr_dma_transfer (const void *src, void *dest, size_t count, pvr_dma_type_t type, int block, pvr_dma_callback_t callback, void *cbdata)
 Perform a DMA transfer to/from the TA/PVR RAM.
 
int pvr_txr_load_dma (const void *src, pvr_ptr_t dest, size_t count, int block, pvr_dma_callback_t callback, void *cbdata) __depr("Use pvr_dma_ta_load_txr instead.")
 Load a texture using TA DMA.
 
int pvr_dma_ta_load_txr (const void *src, pvr_ptr_t dest, size_t count, int block, pvr_dma_callback_t callback, void *cbdata)
 Load a texture using TA DMA.
 
int pvr_dma_rb_load_txr (const void *src, pvr_ptr_t dest, size_t count, int block, pvr_dma_callback_t callback, void *cbdata)
 Load a texture using PVR DMA.
 
int pvr_dma_download_txr (const void *src, void *dest, size_t count, int block, pvr_dma_callback_t callback, void *cbdata)
 Download a texture using PVR DMA.
 
int pvr_dma_load_ta (const void *src, size_t count, int block, pvr_dma_callback_t callback, void *cbdata)
 Load vertex data to the TA using TA DMA.
 
int pvr_dma_yuv_conv (const void *src, size_t count, int block, pvr_dma_callback_t callback, void *cbdata)
 Load yuv data to the YUV converter using TA DMA.
 
int pvr_dma_ready (void) __depr("Use pvr_dma_ta_ready instead.")
 Checks if the TA DMA is inactive.
 
int pvr_dma_ta_ready (void)
 Checks if the TA DMA is inactive.
 
int pvr_dma_rb_ready (void)
 Checks if the PVR DMA is inactive.
 
void pvr_dma_init (void)
 Initialize TA/PVR DMA.
 
void pvr_dma_shutdown (void)
 Shut down TA/PVR DMA.
 
void * pvr_sq_load (void *dest, const void *src, size_t n, pvr_dma_type_t type)
 Copy a block of memory to VRAM.
 
void * pvr_sq_set16 (void *dest, uint32_t c, size_t n, pvr_dma_type_t type)
 Set a block of PVR memory to a 16-bit value.
 
void * pvr_sq_set32 (void *dest, uint32_t c, size_t n, pvr_dma_type_t type)
 Set a block of PVR memory to a 32-bit value.
 

Detailed Description

PowerVR DMA driver

Typedef Documentation

◆ pvr_dma_callback_t

typedef void(* pvr_dma_callback_t) (void *data)

PVR DMA interrupt callback type.

Functions that act as callbacks when DMA completes should be of this type. These functions will be called inside an interrupt context, so don't try to use anything that might stall.

Parameters
dataUser data passed in to the pvr_dma_transfer() function.

Function Documentation

◆ pvr_dma_download_txr()

int pvr_dma_download_txr ( const void * src,
void * dest,
size_t count,
int block,
pvr_dma_callback_t callback,
void * cbdata )

Download a texture using PVR DMA.

This is essentially a convenience wrapper for pvr_dma_transfer(), so all notes that apply to it also apply here.

Parameters
srcWhere to copy to. Must be 32-byte aligned.
destWhere to copy from. Must be 32-byte aligned.
countThe number of bytes to copy. Must be a multiple of 32.
blockNon-zero if you want the function to block until the DMA completes.
callbackA function to call upon completion of the DMA.
cbdataData to pass to the callback function.
Return values
0On success.
-1On failure. Sets errno as appropriate.
Error Conditions:
EINPROGRESS - DMA already in progress
EFAULT - src or dest is not 32-byte aligned
EIO - I/O error

◆ pvr_dma_init()

void pvr_dma_init ( void )

Initialize TA/PVR DMA.

◆ pvr_dma_load_ta()

int pvr_dma_load_ta ( const void * src,
size_t count,
int block,
pvr_dma_callback_t callback,
void * cbdata )

Load vertex data to the TA using TA DMA.

This is essentially a convenience wrapper for pvr_dma_transfer(), so all notes that apply to it also apply here.

Parameters
srcWhere to copy from. Must be 32-byte aligned.
countThe number of bytes to copy. Must be a multiple of 32.
blockNon-zero if you want the function to block until the DMA completes.
callbackA function to call upon completion of the DMA.
cbdataData to pass to the callback function.
Return values
0On success.
-1On failure. Sets errno as appropriate.
Error Conditions:
EINPROGRESS - DMA already in progress
EFAULT - src is not 32-byte aligned
EIO - I/O error

◆ pvr_dma_rb_load_txr()

int pvr_dma_rb_load_txr ( const void * src,
pvr_ptr_t dest,
size_t count,
int block,
pvr_dma_callback_t callback,
void * cbdata )

Load a texture using PVR DMA.

This is essentially a convenience wrapper for pvr_dma_transfer(), so all notes that apply to it also apply here.

Parameters
srcWhere to copy from. Must be 32-byte aligned.
destWhere to copy to. Must be 32-byte aligned.
countThe number of bytes to copy. Must be a multiple of 32.
blockNon-zero if you want the function to block until the DMA completes.
callbackA function to call upon completion of the DMA.
cbdataData to pass to the callback function.
Return values
0On success.
-1On failure. Sets errno as appropriate.
Error Conditions:
EINPROGRESS - DMA already in progress
EFAULT - src or dest is not 32-byte aligned
EIO - I/O error

◆ pvr_dma_rb_ready()

int pvr_dma_rb_ready ( void )

Checks if the PVR DMA is inactive.

Returns
Non-zero if there is no PVR DMA active, thus a DMA can begin or 0 if there is an active DMA.

◆ pvr_dma_ready()

int pvr_dma_ready ( void )

Checks if the TA DMA is inactive.

Deprecated
This function is formally deprecated, and should not be used in newly written code. Instead, please use pvr_dma_ta_ready().
Returns
Non-zero if there is no TA DMA active, thus a DMA can begin or 0 if there is an active DMA.

◆ pvr_dma_shutdown()

void pvr_dma_shutdown ( void )

Shut down TA/PVR DMA.

◆ pvr_dma_ta_load_txr()

int pvr_dma_ta_load_txr ( const void * src,
pvr_ptr_t dest,
size_t count,
int block,
pvr_dma_callback_t callback,
void * cbdata )

Load a texture using TA DMA.

This is essentially a convenience wrapper for pvr_dma_transfer(), so all notes that apply to it also apply here.

Parameters
srcWhere to copy from. Must be 32-byte aligned.
destWhere to copy to. Must be 32-byte aligned.
countThe number of bytes to copy. Must be a multiple of 32.
blockNon-zero if you want the function to block until the DMA completes.
callbackA function to call upon completion of the DMA.
cbdataData to pass to the callback function.
Return values
0On success.
-1On failure. Sets errno as appropriate.
Error Conditions:
EINPROGRESS - DMA already in progress
EFAULT - src or dest is not 32-byte aligned
EIO - I/O error

◆ pvr_dma_ta_ready()

int pvr_dma_ta_ready ( void )

Checks if the TA DMA is inactive.

Returns
Non-zero if there is no TA DMA active, thus a DMA can begin or 0 if there is an active DMA.

◆ pvr_dma_transfer()

int pvr_dma_transfer ( const void * src,
void * dest,
size_t count,
pvr_dma_type_t type,
int block,
pvr_dma_callback_t callback,
void * cbdata )

Perform a DMA transfer to/from the TA/PVR RAM.

This function copies a block of data to/from the TA/PVR or its memory via DMA. There are all kinds of constraints that must be fulfilled to actually do this, so make sure to read all the fine print with the parameter list.

If a callback is specified, it will be called in an interrupt context, so keep that in mind in writing the callback.

Parameters
srcWhere to copy from. Must be 32-byte aligned.
destWhere to copy to. Must be 32-byte aligned.
countThe number of bytes to copy. Must be a multiple of 32.
typeThe type of DMA transfer to do (see list of modes).
blockNon-zero if you want the function to block until the DMA completes.
callbackA function to call upon completion of the DMA.
cbdataData to pass to the callback function.
Return values
0On success.
-1On failure. Sets errno as appropriate.
Error Conditions:
EINPROGRESS - DMA already in progress
EFAULT - src or dest is not 32-byte aligned
EIO - I/O error
See also
pvr_dma_modes

◆ pvr_dma_yuv_conv()

int pvr_dma_yuv_conv ( const void * src,
size_t count,
int block,
pvr_dma_callback_t callback,
void * cbdata )

Load yuv data to the YUV converter using TA DMA.

This is essentially a convenience wrapper for pvr_dma_transfer(), so all notes that apply to it also apply here.

Parameters
srcWhere to copy from. Must be 32-byte aligned.
countThe number of bytes to copy. Must be a multiple of 32.
blockNon-zero if you want the function to block until the DMA completes.
callbackA function to call upon completion of the DMA.
cbdataData to pass to the callback function.
Return values
0On success.
-1On failure. Sets errno as appropriate.
Error Conditions:
EINPROGRESS - DMA already in progress
EFAULT - src is not 32-byte aligned
EIO - I/O error

◆ pvr_sq_load()

void * pvr_sq_load ( void * dest,
const void * src,
size_t n,
pvr_dma_type_t type )

Copy a block of memory to VRAM.

This function is similar to sq_cpy(), but it has been optimized for writing to a destination residing within VRAM.

Warning
This function cannot be used at the same time as a PVR DMA transfer.

The dest pointer must be at least 32-byte aligned and reside in video memory, the src pointer must be at least 8-byte aligned, and n must be a multiple of 32.

Parameters
destThe address to copy to (32-byte aligned).
srcThe address to copy from (32-bit (8-byte) aligned).
nThe number of bytes to copy (multiple of 32).
typeThe type of SQ/DMA transfer to do (see list of modes).
Returns
The original value of dest.
See also
pvr_sq_set32()

◆ pvr_sq_set16()

void * pvr_sq_set16 ( void * dest,
uint32_t c,
size_t n,
pvr_dma_type_t type )

Set a block of PVR memory to a 16-bit value.

This function is similar to sq_set16(), but it has been optimized for writing to a destination residing within VRAM.

Warning
This function cannot be used at the same time as a PVR DMA transfer.

The dest pointer must be at least 32-byte aligned and reside in video memory, n must be a multiple of 32 and only the low 16-bits are used from c.

Parameters
destThe address to begin setting at (32-byte aligned).
cThe value to set (in the low 16-bits).
nThe number of bytes to set (multiple of 32).
typeThe type of SQ/DMA transfer to do (see list of modes).
Returns
The original value of dest.
See also
pvr_sq_set32()

◆ pvr_sq_set32()

void * pvr_sq_set32 ( void * dest,
uint32_t c,
size_t n,
pvr_dma_type_t type )

Set a block of PVR memory to a 32-bit value.

This function is similar to sq_set32(), but it has been optimized for writing to a destination residing within VRAM.

Warning
This function cannot be used at the same time as a PVR DMA transfer.

The dest pointer must be at least 32-byte aligned and reside in video memory, n must be a multiple of 32.

Parameters
destThe address to begin setting at (32-byte aligned).
cThe value to set.
nThe number of bytes to set (multiple of 32).
typeThe type of SQ/DMA transfer to do (see list of modes).
Returns
The original value of dest.
See also
pvr_sq_set16

◆ pvr_txr_load_dma()

int pvr_txr_load_dma ( const void * src,
pvr_ptr_t dest,
size_t count,
int block,
pvr_dma_callback_t callback,
void * cbdata )

Load a texture using TA DMA.

This is essentially a convenience wrapper for pvr_dma_transfer(), so all notes that apply to it also apply here.

Deprecated
This function is formally deprecated and should not be used in new code. Instead you should use the pvr_dma_ta_load_txr() function.
Parameters
srcWhere to copy from. Must be 32-byte aligned.
destWhere to copy to. Must be 32-byte aligned.
countThe number of bytes to copy. Must be a multiple of 32.
blockNon-zero if you want the function to block until the DMA completes.
callbackA function to call upon completion of the DMA.
cbdataData to pass to the callback function.
Return values
0On success.
-1On failure. Sets errno as appropriate.
Error Conditions:
EINPROGRESS - DMA already in progress
EFAULT - src or dest is not 32-byte aligned
EIO - I/O error