1
0
Fork 0

audio_core/hle,lle: implement SetSemaphore

This commit is contained in:
Weiyi Wang 2018-12-06 07:35:07 -05:00
parent 4671ccf416
commit c9736b3300
6 changed files with 18 additions and 0 deletions

View File

@ -47,6 +47,12 @@ public:
*/
virtual bool RecvDataIsReady(u32 register_number) const = 0;
/**
* Sets the DSP semaphore register
* @param semaphore_value the value set to the semaphore register
*/
virtual void SetSemaphore(u16 semaphore_value) = 0;
/**
* Reads `length` bytes from the DSP pipe identified with `pipe_number`.
* @note Can read up to the maximum value of a u16 in bytes (65,535).

View File

@ -375,6 +375,10 @@ bool DspHle::RecvDataIsReady(u32 register_number) const {
return impl->RecvDataIsReady(register_number);
}
void DspHle::SetSemaphore(u16 semaphore_value) {
// Do nothing in HLE
}
std::vector<u8> DspHle::PipeRead(DspPipe pipe_number, u32 length) {
return impl->PipeRead(pipe_number, length);
}

View File

@ -26,6 +26,7 @@ public:
u16 RecvData(u32 register_number) override;
bool RecvDataIsReady(u32 register_number) const override;
void SetSemaphore(u16 semaphore_value) override;
std::vector<u8> PipeRead(DspPipe pipe_number, u32 length) override;
std::size_t GetPipeReadableSize(DspPipe pipe_number) const override;
void PipeWrite(DspPipe pipe_number, const std::vector<u8>& buffer) override;

View File

@ -27,6 +27,10 @@ bool DspLle::RecvDataIsReady(u32 register_number) const {
return impl->teakra.RecvDataIsReady(register_number);
}
void DspLle::SetSemaphore(u16 semaphore_value) {
impl->teakra.SetSemaphore(semaphore_value);
}
DspLle::DspLle() : impl(std::make_unique<Impl>()) {}
DspLle::~DspLle() = default;

View File

@ -15,6 +15,7 @@ public:
u16 RecvData(u32 register_number) override;
bool RecvDataIsReady(u32 register_number) const override;
void SetSemaphore(u16 semaphore_value) override;
private:
struct Impl;

View File

@ -46,6 +46,8 @@ void DSP_DSP::SetSemaphore(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x07, 1, 0);
const u16 semaphore_value = rp.Pop<u16>();
system.DSP().SetSemaphore(semaphore_value);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS);