Epok Engine

PSYQO SDK

psyqo::SPU::dmaWrite

Method · 2 overloads

Declarations are extracted from the pinned headers. Examples and general guidance are generated sketches, not verified complete programs; consult the linked source and guides for the actual contract.

Method

Synchronously uploads data to the SPU's sound RAM.

Belongs to
psyqo::SPU
Header
spu.hh
Overloads
2

Declaration 1 of 2

static
Declaration
static void dmaWrite(uint32_t spuAddress, const void* ramAddress, size_t dataSize, size_t blockSize = 0)

Synchronously uploads data to the SPU's sound RAM.

ParameterTypeMeaning
spuAddressuint32_tThe destination address in sound RAM. Must be 8 byte aligned, and the transfer has to fit within `SOUND_RAM_SIZE`.
ramAddressconst void *The source address in main RAM. Must be 4 byte aligned.
dataSizesize_tThe number of bytes to transfer. Must be a non-zero multiple of `ADPCM_BLOCK_SIZE`.
blockSizesize_tThe DMA block size in bytes, or 0 to pick the largest one dividing `dataSize`. Must be a multiple of 4 and no larger than `MAX_DMA_BLOCK_SIZE`.

Returns: Nothing (void).

Example sketch

C++ example
#include "psyqo/spu.hh"

// Assume these named values have been initialized with valid data:
// uint32_t spuAddress
// const void * ramAddress
// size_t dataSize
// size_t blockSize

psyqo::SPU::dmaWrite(spuAddress, ramAddress, dataSize, blockSize);

Trade-offs and warnings

Consult the linked header for this operation’s ownership, lifetime and failure behavior.

Declared in https://github.com/epokengine/nugget/blob/4a01183295182b8e7702c908e1efaaa8f4538ffd/psyqo/spu.hh:101

Declaration 2 of 2

Declaration
void dmaWrite(uint32_t spuAddress, const void* ramAddress, size_t dataSize, eastl::function<void()>&& callback, DMA::DmaCallback dmaCallback = DMA::FROM_MAIN_LOOP)

Asynchronously uploads data to the SPU's sound RAM.

ParameterTypeMeaning
spuAddressuint32_tThe destination address in sound RAM. Must be 8 byte aligned, and the transfer has to fit within `SOUND_RAM_SIZE`.
ramAddressconst void *The source address in main RAM. Must be 4 byte aligned, and has to stay alive until the callback fires.
dataSizesize_tThe number of bytes to transfer. Must be a non-zero multiple of `ADPCM_BLOCK_SIZE`.
callbackeastl::function<void ()> &&The function to call once the transfer has completed.
dmaCallbackDMA::DmaCallbackWhether to call it from the interrupt handler, or from the main loop.

Returns: Nothing (void).

Example sketch

C++ example
#include "psyqo/spu.hh"

// Assume these named values have been initialized with valid data:
// uint32_t spuAddress
// const void * ramAddress
// size_t dataSize
// eastl::function<void ()> && callback
// DMA::DmaCallback dmaCallback

psyqo::SPU& object = /* obtain a valid instance */;

object.dmaWrite(spuAddress, ramAddress, dataSize, callback, dmaCallback);

Trade-offs and warnings

Consult the linked header for this operation’s ownership, lifetime and failure behavior.

Declared in https://github.com/epokengine/nugget/blob/4a01183295182b8e7702c908e1efaaa8f4538ffd/psyqo/spu.hh:120

Related members