MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / __DSPHandler

Function __DSPHandler

src/dolphin/src/dsp/dsp_task.c:12–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10BOOL __DSP_rude_task_pending;
11
12DECL_WEAK void __DSPHandler(__OSInterrupt, OSContext* context)
13{
14 DSPTaskInfo* tmp_task;
15 OSContext exceptionContext;
16 u16 tmp;
17 u32 mail;
18
19 tmp = __DSPRegs[5];
20 tmp = (u16)(tmp & ~0x28) | 0x80;
21 __DSPRegs[5] = tmp;
22
23 OSClearContext(&exceptionContext);
24 OSSetCurrentContext(&exceptionContext);
25
26 while (!DSPCheckMailFromDSP())
27 ;
28 mail = DSPReadMailFromDSP();
29
30 if ((__DSP_curr_task->flags & DSP_TASK_FLAG_CANCEL) && (mail == 0xDCD10002))
31 {
32 mail = 0xDCD10003;
33 }
34
35 switch (mail)
36 {
37 case 0xDCD10000:
38 __DSP_curr_task->state = DSP_TASK_STATE_RUN;
39
40 if (__DSP_curr_task->init_cb)
41 {
42 (*(__DSP_curr_task->init_cb))((void*)(__DSP_curr_task));
43 }
44 break;
45 case 0xDCD10001:
46 __DSP_curr_task->state = DSP_TASK_STATE_RUN;
47 if (__DSP_curr_task->res_cb)
48 {
49 (*(__DSP_curr_task->res_cb))((void*)(__DSP_curr_task));
50 }
51 break;
52 case 0xDCD10002:
53 if (__DSP_rude_task_pending)
54 {
55 if (__DSP_curr_task == __DSP_rude_task)
56 {
57 DSPSendMailToDSP(0xCDD10003);
58 while (DSPCheckMailToDSP())
59 {
60 }
61
62 __DSP_rude_task = NULL;
63 __DSP_rude_task_pending = FALSE;
64
65 if (__DSP_curr_task->res_cb)
66 {
67 (*(__DSP_curr_task->res_cb))((void*)(__DSP_curr_task));
68 }
69

Callers

nothing calls this directly

Calls 6

DSPCheckMailFromDSPFunction · 0.85
DSPReadMailFromDSPFunction · 0.85
DSPSendMailToDSPFunction · 0.85
DSPCheckMailToDSPFunction · 0.85
__DSP_exec_taskFunction · 0.85
__DSP_remove_taskFunction · 0.85

Tested by

no test coverage detected