libctru
v2.4.1
|
DSP Service to access the DSP processor commands (sound) More...
#include <3ds/types.h>
Go to the source code of this file.
Data Structures | |
struct | dspHookCookie |
DSP hook cookie. More... | |
Typedefs | |
typedef void(* | dspHookFn) (DSP_HookType hook) |
DSP hook function. | |
Enumerations | |
enum | DSP_InterruptType { DSP_INTERRUPT_PIPE = 2 } |
DSP interrupt types. More... | |
enum | DSP_HookType { DSPHOOK_ONSLEEP = 0 , DSPHOOK_ONWAKEUP = 1 , DSPHOOK_ONCANCEL = 2 } |
DSP hook types. More... | |
Functions | |
Result | dspInit (void) |
Initializes the dsp service. More... | |
void | dspExit (void) |
Closes the dsp service. More... | |
bool | dspIsComponentLoaded (void) |
Returns true if a component is loaded, false otherwise. | |
void | dspHook (dspHookCookie *cookie, dspHookFn callback) |
Sets up a DSP status hook. More... | |
void | dspUnhook (dspHookCookie *cookie) |
Removes a DSP status hook. More... | |
Result | DSP_GetHeadphoneStatus (bool *is_inserted) |
Checks if a headphone is inserted. More... | |
Result | DSP_FlushDataCache (const void *address, u32 size) |
Flushes the cache. More... | |
Result | DSP_InvalidateDataCache (const void *address, u32 size) |
Invalidates the cache. More... | |
Result | DSP_GetSemaphoreHandle (Handle *semaphore) |
Retrieves the handle of the DSP semaphore. More... | |
Result | DSP_SetSemaphore (u16 value) |
Sets the DSP hardware semaphore value. More... | |
Result | DSP_SetSemaphoreMask (u16 mask) |
Masks the DSP hardware semaphore value. More... | |
Result | DSP_LoadComponent (const void *component, u32 size, u16 prog_mask, u16 data_mask, bool *is_loaded) |
Loads a DSP binary and starts the DSP. More... | |
Result | DSP_UnloadComponent (void) |
Stops the DSP by unloading the binary. | |
Result | DSP_RegisterInterruptEvents (Handle handle, u32 interrupt, u32 channel) |
Registers an event handle with the DSP through IPC. More... | |
Result | DSP_ReadPipeIfPossible (u32 channel, u32 peer, void *buffer, u16 length, u16 *length_read) |
Reads a pipe if possible. More... | |
Result | DSP_WriteProcessPipe (u32 channel, const void *buffer, u32 length) |
Writes to a pipe. More... | |
Result | DSP_ConvertProcessAddressFromDspDram (u32 dsp_address, u32 *arm_address) |
Converts a DSP memory address to a virtual address usable by the process. More... | |
Result | DSP_RecvData (u16 regNo, u16 *value) |
Reads a DSP register. More... | |
Result | DSP_RecvDataIsReady (u16 regNo, bool *is_ready) |
Checks if you can read a DSP register. More... | |
Result | DSP_SendData (u16 regNo, u16 value) |
Writes to a DSP register. More... | |
Result | DSP_SendDataIsEmpty (u16 regNo, bool *is_empty) |
Checks if you can write to a DSP register ? More... | |
DSP Service to access the DSP processor commands (sound)
The DSP has access to the Linear memory region, and to the DSP memory region if allowed in the exheader.
enum DSP_HookType |
enum DSP_InterruptType |
Converts a DSP memory address to a virtual address usable by the process.
dsp_address | Address to convert. |
arm_address | Pointer to output the converted address to. |
Flushes the cache.
address | Beginning of the memory range to flush, inside the Linear or DSP memory regions |
size | Size of the memory range to flush |
Flushes the cache for the specified memory range and invalidates the cache
Result DSP_GetHeadphoneStatus | ( | bool * | is_inserted | ) |
Checks if a headphone is inserted.
is_inserted | Pointer to output the insertion status to. |
Retrieves the handle of the DSP semaphore.
semaphore | Pointer to output the semaphore to. |
Invalidates the cache.
address | Beginning of the memory range to invalidate, inside the Linear or DSP memory regions |
size | Size of the memory range to flush |
Invalidates the cache for the specified memory range
Result DSP_LoadComponent | ( | const void * | component, |
u32 | size, | ||
u16 | prog_mask, | ||
u16 | data_mask, | ||
bool * | is_loaded | ||
) |
Loads a DSP binary and starts the DSP.
component | The program file address in memory |
size | The size of the program |
prog_mask | DSP memory block related ? Default is 0xff. |
data_mask | DSP memory block related ? Default is 0xff. |
is_loaded | Indicates if the DSP was succesfully loaded. |
Result DSP_ReadPipeIfPossible | ( | u32 | channel, |
u32 | peer, | ||
void * | buffer, | ||
u16 | length, | ||
u16 * | length_read | ||
) |
Reads a pipe if possible.
channel | unknown. Usually 2 |
peer | unknown. Usually 0 |
buffer | The buffer that will store the values read from the pipe |
length | Length of the buffer |
length_read | Number of bytes read by the command |
Reads a DSP register.
regNo | Offset of the hardware register, base address is 0x1EC40000 |
value | Pointer to read the register value to. |
Checks if you can read a DSP register.
regNo | Offset of the hardware register, base address is 0x1EC40000 |
is_ready | Pointer to write the ready status to. |
Registers an event handle with the DSP through IPC.
handle | Event handle to register. |
interrupt | The type of interrupt that will trigger the event. Usual value is DSP_INTERRUPT_PIPE. |
channel | The pipe channel. Usual value is 2 |
Writes to a DSP register.
regNo | Offset of the hardware register, base address is 0x1EC40000 |
value | Value to write. |
Checks if you can write to a DSP register ?
regNo | Offset of the hardware register, base address is 0x1EC40000 |
is_empty | Pointer to write the empty status to. |
Sets the DSP hardware semaphore value.
value | Value to set. |
Masks the DSP hardware semaphore value.
mask | Mask to apply. |
Writes to a pipe.
channel | unknown. Usually 2 |
buffer | The message to send to the DSP process |
length | Length of the message |
void dspExit | ( | void | ) |
Closes the dsp service.
void dspHook | ( | dspHookCookie * | cookie, |
dspHookFn | callback | ||
) |
Sets up a DSP status hook.
cookie | Hook cookie to use. |
callback | Function to call when DSP's status changes. |
Result dspInit | ( | void | ) |
Initializes the dsp service.
Call this before calling any DSP_* function.
void dspUnhook | ( | dspHookCookie * | cookie | ) |
Removes a DSP status hook.
cookie | Hook cookie to remove. |