Epok Engine

EPOK RUNTIME

epok::spu::upload

Function template · 1 overload

Function template

Main-thread DMA only.

Belongs to
epok::spu
Header
spu_transfer.hpp
Overloads
1

Declaration

template
Declaration
template<class H=Hardware> bool upload(const void* data,uint32_t address,uint32_t bytes,uint32_t budget=10000000)

Main-thread DMA only.

ParameterTypeMeaning
dataconst void *Value supplied for data. Keep referenced or pointed-to data valid for the complete call.
addressuint32_tValue supplied for address. Keep referenced or pointed-to data valid for the complete call.
bytesuint32_tValue supplied for bytes. Keep referenced or pointed-to data valid for the complete call.
budgetuint32_tValue supplied for budget. Keep referenced or pointed-to data valid for the complete call.

Returns: bool. Check the value before continuing when it represents success, availability or a resource handle.

Example

C++ example
#include "spu_transfer.hpp"

// Replace these template arguments with types or values accepted by the declaration:
// H

// Assume these named values have been initialized with valid data:
// const void * data
// uint32_t address
// uint32_t bytes
// uint32_t budget

epok::spu& object = /* obtain a valid instance */;

auto result = object.upload<H>(data, address, bytes, budget);

Why use it

Template dispatch is resolved at compile time and normally adds no runtime indirection. The boolean result makes success, availability or state explicit without exceptions. The API exposes the hardware service without hiding latency or bounded memory.

Trade-offs and warnings

Every instantiated type must satisfy the header's compile-time requirements; extra instantiations can increase code size. Check the return value; `false` is part of normal control flow for many PSX resource operations. Treat device absence, busy state and I/O failure as expected outcomes; do not block the frame loop waiting for hardware. Pointer/reference arguments are borrowed unless the source contract says otherwise; keep them valid for the complete operation and never assume null is accepted.

Declared in runtime/spu_transfer.hpp:23

Related members