1
0
Fork 0

audio_core/hle: move implementation of RecvDataIsReady

This commit is contained in:
Weiyi Wang 2018-12-06 07:28:47 -05:00
parent b609753fb6
commit 14eb3561de
4 changed files with 19 additions and 3 deletions

View File

@ -40,6 +40,13 @@ public:
*/ */
virtual u16 RecvData(u32 register_number) = 0; virtual u16 RecvData(u32 register_number) = 0;
/**
* Checks whether data is ready in one of three DSP registers
* @param register_number the index of the register to check
* @returns true if data is ready
*/
virtual bool RecvDataIsReady(u32 register_number) const = 0;
/** /**
* Reads `length` bytes from the DSP pipe identified with `pipe_number`. * 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). * @note Can read up to the maximum value of a u16 in bytes (65,535).

View File

@ -30,6 +30,7 @@ public:
DspState GetDspState() const; DspState GetDspState() const;
u16 RecvData(u32 register_number); u16 RecvData(u32 register_number);
bool RecvDataIsReady(u32 register_number) const;
std::vector<u8> PipeRead(DspPipe pipe_number, u32 length); std::vector<u8> PipeRead(DspPipe pipe_number, u32 length);
std::size_t GetPipeReadableSize(DspPipe pipe_number) const; std::size_t GetPipeReadableSize(DspPipe pipe_number) const;
void PipeWrite(DspPipe pipe_number, const std::vector<u8>& buffer); void PipeWrite(DspPipe pipe_number, const std::vector<u8>& buffer);
@ -112,6 +113,11 @@ u16 DspHle::Impl::RecvData(u32 register_number) {
} }
} }
bool DspHle::Impl::RecvDataIsReady(u32 register_number) const {
ASSERT_MSG(register_number == 0, "Unknown register_number {}", register_number);
return true;
}
std::vector<u8> DspHle::Impl::PipeRead(DspPipe pipe_number, u32 length) { std::vector<u8> DspHle::Impl::PipeRead(DspPipe pipe_number, u32 length) {
const std::size_t pipe_index = static_cast<std::size_t>(pipe_number); const std::size_t pipe_index = static_cast<std::size_t>(pipe_number);
@ -365,6 +371,10 @@ u16 DspHle::RecvData(u32 register_number) {
return impl->RecvData(register_number); return impl->RecvData(register_number);
} }
bool DspHle::RecvDataIsReady(u32 register_number) const {
return impl->RecvDataIsReady(register_number);
}
std::vector<u8> DspHle::PipeRead(DspPipe pipe_number, u32 length) { std::vector<u8> DspHle::PipeRead(DspPipe pipe_number, u32 length) {
return impl->PipeRead(pipe_number, length); return impl->PipeRead(pipe_number, length);
} }

View File

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

View File

@ -35,11 +35,9 @@ void DSP_DSP::RecvDataIsReady(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x02, 1, 0); IPC::RequestParser rp(ctx, 0x02, 1, 0);
const u32 register_number = rp.Pop<u32>(); const u32 register_number = rp.Pop<u32>();
ASSERT_MSG(register_number == 0, "Unknown register_number {}", register_number);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(true); /// 0 = not ready, 1 = ready to read rb.Push(system.DSP().RecvDataIsReady(register_number));
LOG_DEBUG(Service_DSP, "register_number={}", register_number); LOG_DEBUG(Service_DSP, "register_number={}", register_number);
} }