summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/dsp_dsp.cpp131
-rw-r--r--src/core/hle/service/dsp_dsp.h2
2 files changed, 107 insertions, 26 deletions
diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp
index bbcf26f61..a2b68cac8 100644
--- a/src/core/hle/service/dsp_dsp.cpp
+++ b/src/core/hle/service/dsp_dsp.cpp
@@ -4,6 +4,7 @@
4 4
5#include "common/log.h" 5#include "common/log.h"
6#include "core/hle/hle.h" 6#include "core/hle/hle.h"
7#include "core/hle/kernel/event.h"
7#include "core/hle/service/dsp_dsp.h" 8#include "core/hle/service/dsp_dsp.h"
8 9
9//////////////////////////////////////////////////////////////////////////////////////////////////// 10////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -11,38 +12,118 @@
11 12
12namespace DSP_DSP { 13namespace DSP_DSP {
13 14
15static Handle semaphore_event;
16static Handle interrupt_event;
17
18/**
19 * DSP_DSP::LoadComponent service function
20 * Inputs:
21 * 1 : Size
22 * 2 : Unknown (observed only half word used)
23 * 3 : Unknown (observed only half word used)
24 * 4 : (size << 4) | 0xA
25 * 5 : Buffer address
26 * Outputs:
27 * 1 : Result of function, 0 on success, otherwise error code
28 * 2 : Component loaded, 0 on not loaded, 1 on loaded
29 */
30void LoadComponent(Service::Interface* self) {
31 u32* cmd_buff = Service::GetCommandBuffer();
32
33 cmd_buff[1] = 0; // No error
34 cmd_buff[2] = 1; // Pretend that we actually loaded the DSP firmware
35
36 // TODO(bunnei): Implement real DSP firmware loading
37
38 DEBUG_LOG(KERNEL, "(STUBBED) called");
39}
40
41/**
42 * DSP_DSP::GetSemaphoreEventHandle service function
43 * Outputs:
44 * 1 : Result of function, 0 on success, otherwise error code
45 * 3 : Semaphore event handle
46 */
47void GetSemaphoreEventHandle(Service::Interface* self) {
48 u32* cmd_buff = Service::GetCommandBuffer();
49
50 cmd_buff[1] = 0; // No error
51 cmd_buff[3] = semaphore_event; // Event handle
52
53 DEBUG_LOG(KERNEL, "(STUBBED) called");
54}
55
56/**
57 * DSP_DSP::RegisterInterruptEvents service function
58 * Inputs:
59 * 1 : Parameter 0 (purpose unknown)
60 * 2 : Parameter 1 (purpose unknown)
61 * 4 : Interrupt event handle
62 * Outputs:
63 * 1 : Result of function, 0 on success, otherwise error code
64 */
65void RegisterInterruptEvents(Service::Interface* self) {
66 u32* cmd_buff = Service::GetCommandBuffer();
67
68 interrupt_event = static_cast<Handle>(cmd_buff[4]);
69
70 cmd_buff[1] = 0; // No error
71
72 DEBUG_LOG(KERNEL, "(STUBBED) called");
73}
74
75/**
76 * DSP_DSP::WriteReg0x10 service function
77 * Inputs:
78 * 1 : Unknown (observed only half word used)
79 * Outputs:
80 * 1 : Result of function, 0 on success, otherwise error code
81 */
82void WriteReg0x10(Service::Interface* self) {
83 u32* cmd_buff = Service::GetCommandBuffer();
84
85 Kernel::SignalEvent(interrupt_event);
86
87 cmd_buff[1] = 0; // No error
88
89 DEBUG_LOG(KERNEL, "(STUBBED) called");
90}
91
14const Interface::FunctionInfo FunctionTable[] = { 92const Interface::FunctionInfo FunctionTable[] = {
15 {0x00010040, nullptr, "RecvData"}, 93 {0x00010040, nullptr, "RecvData"},
16 {0x00020040, nullptr, "RecvDataIsReady"}, 94 {0x00020040, nullptr, "RecvDataIsReady"},
17 {0x00030080, nullptr, "SendData"}, 95 {0x00030080, nullptr, "SendData"},
18 {0x00040040, nullptr, "SendDataIsEmpty"}, 96 {0x00040040, nullptr, "SendDataIsEmpty"},
19 {0x00070040, nullptr, "WriteReg0x10"}, 97 {0x00070040, WriteReg0x10, "WriteReg0x10"},
20 {0x00080000, nullptr, "GetSemaphore"}, 98 {0x00080000, nullptr, "GetSemaphore"},
21 {0x00090040, nullptr, "ClearSemaphore"}, 99 {0x00090040, nullptr, "ClearSemaphore"},
22 {0x000B0000, nullptr, "CheckSemaphoreRequest"}, 100 {0x000B0000, nullptr, "CheckSemaphoreRequest"},
23 {0x000C0040, nullptr, "ConvertProcessAddressFromDspDram"}, 101 {0x000C0040, nullptr, "ConvertProcessAddressFromDspDram"},
24 {0x000D0082, nullptr, "WriteProcessPipe"}, 102 {0x000D0082, nullptr, "WriteProcessPipe"},
25 {0x001000C0, nullptr, "ReadPipeIfPossible"}, 103 {0x001000C0, nullptr, "ReadPipeIfPossible"},
26 {0x001100C2, nullptr, "LoadComponent"}, 104 {0x001100C2, LoadComponent, "LoadComponent"},
27 {0x00120000, nullptr, "UnloadComponent"}, 105 {0x00120000, nullptr, "UnloadComponent"},
28 {0x00130082, nullptr, "FlushDataCache"}, 106 {0x00130082, nullptr, "FlushDataCache"},
29 {0x00140082, nullptr, "InvalidateDCache"}, 107 {0x00140082, nullptr, "InvalidateDCache"},
30 {0x00150082, nullptr, "RegisterInterruptEvents"}, 108 {0x00150082, RegisterInterruptEvents, "RegisterInterruptEvents"},
31 {0x00160000, nullptr, "GetSemaphoreEventHandle"}, 109 {0x00160000, GetSemaphoreEventHandle, "GetSemaphoreEventHandle"},
32 {0x00170040, nullptr, "SetSemaphoreMask"}, 110 {0x00170040, nullptr, "SetSemaphoreMask"},
33 {0x00180040, nullptr, "GetPhysicalAddress"}, 111 {0x00180040, nullptr, "GetPhysicalAddress"},
34 {0x00190040, nullptr, "GetVirtualAddress"}, 112 {0x00190040, nullptr, "GetVirtualAddress"},
35 {0x001A0042, nullptr, "SetIirFilterI2S1_cmd1"}, 113 {0x001A0042, nullptr, "SetIirFilterI2S1_cmd1"},
36 {0x001B0042, nullptr, "SetIirFilterI2S1_cmd2"}, 114 {0x001B0042, nullptr, "SetIirFilterI2S1_cmd2"},
37 {0x001C0082, nullptr, "SetIirFilterEQ"}, 115 {0x001C0082, nullptr, "SetIirFilterEQ"},
38 {0x001F0000, nullptr, "GetHeadphoneStatus"}, 116 {0x001F0000, nullptr, "GetHeadphoneStatus"},
39 {0x00210000, nullptr, "GetIsDspOccupied"}, 117 {0x00210000, nullptr, "GetIsDspOccupied"},
40}; 118};
41 119
42//////////////////////////////////////////////////////////////////////////////////////////////////// 120////////////////////////////////////////////////////////////////////////////////////////////////////
43// Interface class 121// Interface class
44 122
45Interface::Interface() { 123Interface::Interface() {
124 semaphore_event = Kernel::CreateEvent(RESETTYPE_ONESHOT, "DSP_DSP::semaphore_event");
125 interrupt_event = 0;
126
46 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 127 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
47} 128}
48 129
diff --git a/src/core/hle/service/dsp_dsp.h b/src/core/hle/service/dsp_dsp.h
index c4ce44245..9431b62f6 100644
--- a/src/core/hle/service/dsp_dsp.h
+++ b/src/core/hle/service/dsp_dsp.h
@@ -20,7 +20,7 @@ public:
20 * @return Port name of service 20 * @return Port name of service
21 */ 21 */
22 std::string GetPortName() const override { 22 std::string GetPortName() const override {
23 return "dsp:DSP"; 23 return "dsp::DSP";
24 } 24 }
25}; 25};
26 26