RetroArch
dsp.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------
2 
3 dsp.h -- DSP subsystem
4 
5 Copyright (C) 2004
6 Michael Wiedenbauer (shagkur)
7 Dave Murphy (WinterMute)
8 
9 This software is provided 'as-is', without any express or implied
10 warranty. In no event will the authors be held liable for any
11 damages arising from the use of this software.
12 
13 Permission is granted to anyone to use this software for any
14 purpose, including commercial applications, and to alter it and
15 redistribute it freely, subject to the following restrictions:
16 
17 1. The origin of this software must not be misrepresented; you
18 must not claim that you wrote the original software. If you use
19 this software in a product, an acknowledgment in the product
20 documentation would be appreciated but is not required.
21 
22 2. Altered source versions must be plainly marked as such, and
23 must not be misrepresented as being the original software.
24 
25 3. This notice may not be removed or altered from any source
26 distribution.
27 
28 -------------------------------------------------------------*/
29 
30 
31 #ifndef __DSP_H__
32 #define __DSP_H__
33 
39 #include <gctypes.h>
40 
47 #define DSPTASK_INIT 0
48 #define DSPTASK_RUN 1
49 #define DSPTASK_YIELD 2
50 #define DSPTASK_DONE 3
63 #define DSPTASK_CLEARALL 0x00000000
64 #define DSPTASK_ATTACH 0x00000001
65 #define DSPTASK_CANCEL 0x00000002
71 #ifdef __cplusplus
72  extern "C" {
73 #endif /* __cplusplus */
74 
75 
80 typedef struct _dsp_task dsptask_t;
81 
82 
87 typedef void (*DSPTaskCallback)(dsptask_t *task);
88 
89 
93 typedef void (*DSPCallback)(void);
94 
95 
115 struct _dsp_task {
119 
120  void *iram_maddr;
123 
124  void *dram_maddr;
127 
130 
135 
136  struct _dsp_task *next;
137  struct _dsp_task *prev;
138 };
139 
140 
146 void DSP_Init();
147 
148 
155 
156 
163 
164 
171 
172 
178 void DSP_AssertInt();
179 
180 
187 void DSP_SendMailTo(u32 mail);
188 
189 
196 
197 
205 
207 
208 void DSP_CancelTask(dsptask_t *task);
209 
210 void DSP_Reset();
211 
212 void DSP_Halt();
213 
214 void DSP_Unhalt();
215 
223 
224 #ifdef __cplusplus
225  }
226 #endif /* __cplusplus */
227 
228 #endif
void(* DSPCallback)(void)
function pointer typedef for the user's DSP interrupt callback
Definition: dsp.h:93
vu32 flags
Definition: dsp.h:118
void DSP_Unhalt()
Definition: dsp.c:400
void * iram_maddr
Definition: dsp.h:120
void(* DSPTaskCallback)(dsptask_t *task)
function pointer typedef for the user's DSP task callbacks
Definition: dsp.h:87
dsptask_t * DSP_AddTask(dsptask_t *task)
Add a DSP task to the tasklist and start executing if necessary.
Definition: dsp.c:414
u32 dram_len
Definition: dsp.h:125
Data type definitions.
DSPCallback DSP_RegisterCallback(DSPCallback usr_cb)
Register an user's interrupt callback. This may be used to handle DSP interrupts on its own....
Definition: dsp.c:328
struct _dsp_task * next
Definition: dsp.h:136
vu32 prio
Definition: dsp.h:117
void DSP_Halt()
Definition: dsp.c:390
void DSP_SendMailTo(u32 mail)
Send mail to DSP.
Definition: dsp.c:358
vu32 state
Definition: dsp.h:116
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void *pData)
void DSP_CancelTask(dsptask_t *task)
Definition: dsp.c:427
u16 init_vec
Definition: dsp.h:128
u32 DSP_ReadCPUtoDSP()
Read back CPU->DSP mailbox.
Definition: dsp.c:364
u32 dram_addr
Definition: dsp.h:126
u32 DSP_ReadMailFrom()
Read mail from DSP.
Definition: dsp.c:353
uint16_t u16
16bit unsigned integer
Definition: gctypes.h:18
DSPTaskCallback done_cb
Definition: dsp.h:133
Definition: dsp.h:115
u32 iram_addr
Definition: dsp.h:122
DSPTaskCallback init_cb
Definition: dsp.h:131
void * dram_maddr
Definition: dsp.h:124
u16 resume_vec
Definition: dsp.h:129
DSPTaskCallback res_cb
Definition: dsp.h:132
DSPTaskCallback req_cb
Definition: dsp.h:134
void DSP_Init()
Initialize DSP subsystem.
Definition: dsp.c:306
u32 DSP_CheckMailTo()
Check if mail was sent to DSP.
Definition: dsp.c:343
struct _dsp_task * prev
Definition: dsp.h:137
volatile u32 vu32
32bit unsigned volatile integer
Definition: gctypes.h:29
void DSP_Reset()
Definition: dsp.c:379
u32 iram_len
Definition: dsp.h:121
void DSP_AssertInt()
Asserts the processor interface interrupt.
Definition: dsp.c:371
uint32_t u32
32bit unsigned integer
Definition: gctypes.h:19
dsptask_t * DSP_AssertTask(dsptask_t *task)
Definition: dsp.c:436
u32 DSP_CheckMailFrom()
Check for mail from DSP.
Definition: dsp.c:348