DSP code format cleanup
This commit is contained in:
parent
649e95cd39
commit
c9a75d6a18
@ -7,12 +7,14 @@
|
||||
#pragma once
|
||||
#include <3ds/types.h>
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
DSP_INTERRUPT_PIPE = 2
|
||||
} DSP_InterruptType;
|
||||
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
DSP_PIPE_INPUT = 0, ///< DSP to ARM
|
||||
DSP_PIPE_OUTPUT = 1 ///< ARM to DSP
|
||||
} DSP_PipeDirection;
|
||||
@ -35,7 +37,6 @@ Result dspExit(void);
|
||||
///Checks if a headphone is inserted.
|
||||
Result DSP_GetHeadphoneStatus(bool* is_inserted);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Flushes the cache
|
||||
* @param address Beginning of the memory range to flush, inside the Linear or DSP memory regions
|
||||
@ -43,7 +44,7 @@ Result DSP_GetHeadphoneStatus(bool* is_inserted);
|
||||
*
|
||||
* Flushes the cache for the specified memory range and invalidates the cache
|
||||
*/
|
||||
Result DSP_FlushDataCache(u32 address, u32 size);
|
||||
Result DSP_FlushDataCache(const void* address, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Invalidates the cache
|
||||
@ -52,7 +53,7 @@ Result DSP_FlushDataCache(u32 address, u32 size);
|
||||
*
|
||||
* Invalidates the cache for the specified memory range
|
||||
*/
|
||||
Result DSP_InvalidateDataCache(u32 address, u32 size);
|
||||
Result DSP_InvalidateDataCache(const void* address, u32 size);
|
||||
|
||||
///Retrieves the handle of the DSP semaphore
|
||||
Result DSP_GetSemaphoreHandle(Handle* semaphore);
|
||||
@ -74,7 +75,7 @@ Result DSP_SetSemaphoreMask(u16 mask);
|
||||
* @note The binary must be signed (http://3dbrew.org/wiki/DSP_Binary)
|
||||
* @note Seems to be called when the 3ds leaves the Sleep mode
|
||||
*/
|
||||
Result DSP_LoadComponent(u8 const* component,u32 size,u16 prog_mask,u16 data_mask,bool * is_loaded);
|
||||
Result DSP_LoadComponent(const void* component, u32 size, u16 prog_mask, u16 data_mask, bool* is_loaded);
|
||||
|
||||
///Stops the DSP by unloading the binary
|
||||
Result DSP_UnloadComponent(void);
|
||||
@ -88,7 +89,6 @@ Result DSP_UnloadComponent(void);
|
||||
*/
|
||||
Result DSP_RegisterInterruptEvents(Handle handle, u32 interrupt, u32 channel);
|
||||
|
||||
|
||||
/**
|
||||
* @param channel unknown. Usually 2
|
||||
* @param peer unknown. Usually 0
|
||||
@ -96,15 +96,14 @@ Result DSP_RegisterInterruptEvents(Handle handle,u32 interrupt,u32 channel);
|
||||
* @param length Length of the buffer
|
||||
* @param length_read Number of bytes read by the command
|
||||
*/
|
||||
Result DSP_ReadPipeIfPossible(u32 channel,u32 peer, u8 const *buffer, u16 length, u16* length_read);
|
||||
Result DSP_ReadPipeIfPossible(u32 channel, u32 peer, void* buffer, u16 length, u16* length_read);
|
||||
|
||||
/**
|
||||
* @param channel unknown. Usually 2
|
||||
* @param buffer The message to send to the DSP process
|
||||
* @param length Length of the message
|
||||
*/
|
||||
Result DSP_WriteProcessPipe(u32 channel,u8 const* buffer,u32 length);
|
||||
|
||||
Result DSP_WriteProcessPipe(u32 channel, const void* buffer, u32 length);
|
||||
|
||||
///Converts a DSP memory to a virtual address usable by the process
|
||||
Result DSP_ConvertProcessAddressFromDspDram(u32 dsp_address, u32* arm_address);
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
static Handle dspHandle = 0;
|
||||
|
||||
|
||||
Result dspInit(void)
|
||||
{
|
||||
Result ret = 0;
|
||||
@ -33,7 +32,6 @@ Result dspExit(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Result DSP_GetHeadphoneStatus(bool* is_inserted)
|
||||
{
|
||||
Result ret = 0;
|
||||
@ -44,13 +42,12 @@ Result DSP_GetHeadphoneStatus(bool* is_inserted)
|
||||
return cmdbuf[1];
|
||||
}
|
||||
|
||||
|
||||
Result DSP_FlushDataCache(u32 address, u32 size)
|
||||
Result DSP_FlushDataCache(const void* address, u32 size)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32* cmdbuf = getThreadCommandBuffer();
|
||||
cmdbuf[0] = IPC_MakeHeader(0x13,2,2);
|
||||
cmdbuf[1] = address;
|
||||
cmdbuf[1] = (u32)address;
|
||||
cmdbuf[2] = size;
|
||||
cmdbuf[3] = IPC_Desc_SharedHandles(1);
|
||||
cmdbuf[4] = CUR_PROCESS_HANDLE;
|
||||
@ -58,13 +55,12 @@ Result DSP_FlushDataCache(u32 address, u32 size)
|
||||
return cmdbuf[1];
|
||||
}
|
||||
|
||||
|
||||
Result DSP_InvalidateDataCache(u32 address, u32 size)
|
||||
Result DSP_InvalidateDataCache(const void* address, u32 size)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32* cmdbuf = getThreadCommandBuffer();
|
||||
cmdbuf[0] = IPC_MakeHeader(0x14,2,2);
|
||||
cmdbuf[1] = address;
|
||||
cmdbuf[1] = (u32)address;
|
||||
cmdbuf[2] = size;
|
||||
cmdbuf[3] = IPC_Desc_SharedHandles(1);
|
||||
cmdbuf[4] = CUR_PROCESS_HANDLE;
|
||||
@ -72,8 +68,6 @@ Result DSP_InvalidateDataCache(u32 address, u32 size)
|
||||
return cmdbuf[1];
|
||||
}
|
||||
|
||||
|
||||
|
||||
Result DSP_SetSemaphore(u16 value)
|
||||
{
|
||||
Result ret = 0;
|
||||
@ -84,8 +78,6 @@ Result DSP_SetSemaphore(u16 value)
|
||||
return cmdbuf[1];
|
||||
}
|
||||
|
||||
|
||||
|
||||
Result DSP_SetSemaphoreMask(u16 mask)
|
||||
{
|
||||
Result ret = 0;
|
||||
@ -106,7 +98,7 @@ Result DSP_GetSemaphoreHandle(Handle* semaphore)
|
||||
return cmdbuf[1];
|
||||
}
|
||||
|
||||
Result DSP_LoadComponent(u8 const* component,u32 size,u16 prog_mask,u16 data_mask,bool * is_loaded)
|
||||
Result DSP_LoadComponent(const void* component, u32 size, u16 prog_mask, u16 data_mask, bool* is_loaded)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32* cmdbuf = getThreadCommandBuffer();
|
||||
@ -121,8 +113,6 @@ Result DSP_LoadComponent(u8 const* component,u32 size,u16 prog_mask,u16 data_mas
|
||||
return cmdbuf[1];
|
||||
}
|
||||
|
||||
|
||||
|
||||
Result DSP_UnloadComponent(void)
|
||||
{
|
||||
Result ret = 0;
|
||||
@ -145,8 +135,7 @@ Result DSP_RegisterInterruptEvents(Handle handle, u32 interrupt, u32 channel)
|
||||
return cmdbuf[1];
|
||||
}
|
||||
|
||||
|
||||
Result DSP_ReadPipeIfPossible(u32 channel,u32 peer, u8 const *buffer, u16 length, u16* length_read)
|
||||
Result DSP_ReadPipeIfPossible(u32 channel, u32 peer, void* buffer, u16 length, u16* length_read)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32* cmdbuf = getThreadCommandBuffer();
|
||||
@ -168,11 +157,12 @@ Result DSP_ReadPipeIfPossible(u32 channel,u32 peer, u8 const *buffer, u16 length
|
||||
staticbufs[0] = saved1;
|
||||
staticbufs[1] = saved2;
|
||||
|
||||
if (length_read)
|
||||
*length_read = cmdbuf[2] & 0xFFFF;
|
||||
return cmdbuf[1];
|
||||
}
|
||||
|
||||
Result DSP_WriteProcessPipe(u32 channel, u8 const *buffer, u32 length)
|
||||
Result DSP_WriteProcessPipe(u32 channel, const void* buffer, u32 length)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32* cmdbuf = getThreadCommandBuffer();
|
||||
@ -218,7 +208,6 @@ Result DSP_RecvDataIsReady(u16 regNo, bool * is_ready)
|
||||
return cmdbuf[1];
|
||||
}
|
||||
|
||||
|
||||
// Writes data to the reg regNo
|
||||
// *(_WORD *)(8 * regNo + 0x1ED03024) = value
|
||||
Result DSP_SendData(u16 regNo, u16 value)
|
||||
@ -242,4 +231,3 @@ Result DSP_SendDataIsEmpty(u16 regNo, bool * is_empty)
|
||||
*is_empty = cmdbuf[2] & 0xFF;
|
||||
return cmdbuf[1];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user