mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-08 07:39:58 +00:00
DSP/Pipe: There are 8 pipes
This commit is contained in:
parent
913f7ee524
commit
555907ce8d
2 changed files with 19 additions and 13 deletions
|
@ -17,7 +17,7 @@ namespace HLE {
|
||||||
|
|
||||||
static DspState dsp_state = DspState::Off;
|
static DspState dsp_state = DspState::Off;
|
||||||
|
|
||||||
static std::array<std::vector<u8>, static_cast<size_t>(DspPipe::DspPipe_MAX)> pipe_data;
|
static std::array<std::vector<u8>, NUM_DSP_PIPE> pipe_data;
|
||||||
|
|
||||||
void ResetPipes() {
|
void ResetPipes() {
|
||||||
for (auto& data : pipe_data) {
|
for (auto& data : pipe_data) {
|
||||||
|
@ -27,16 +27,18 @@ void ResetPipes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<u8> PipeRead(DspPipe pipe_number, u32 length) {
|
std::vector<u8> PipeRead(DspPipe pipe_number, u32 length) {
|
||||||
if (pipe_number >= DspPipe::DspPipe_MAX) {
|
const size_t pipe_index = static_cast<size_t>(pipe_number);
|
||||||
LOG_ERROR(Audio_DSP, "pipe_number = %u invalid", pipe_number);
|
|
||||||
|
if (pipe_index >= NUM_DSP_PIPE) {
|
||||||
|
LOG_ERROR(Audio_DSP, "pipe_number = %zu invalid", pipe_index);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<u8>& data = pipe_data[static_cast<size_t>(pipe_number)];
|
std::vector<u8>& data = pipe_data[pipe_index];
|
||||||
|
|
||||||
if (length > data.size()) {
|
if (length > data.size()) {
|
||||||
LOG_WARNING(Audio_DSP, "pipe_number = %u is out of data, application requested read of %u but %zu remain",
|
LOG_WARNING(Audio_DSP, "pipe_number = %zu is out of data, application requested read of %u but %zu remain",
|
||||||
pipe_number, length, data.size());
|
pipe_index, length, data.size());
|
||||||
length = data.size();
|
length = data.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,16 +51,20 @@ std::vector<u8> PipeRead(DspPipe pipe_number, u32 length) {
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t GetPipeReadableSize(DspPipe pipe_number) {
|
size_t GetPipeReadableSize(DspPipe pipe_number) {
|
||||||
if (pipe_number >= DspPipe::DspPipe_MAX) {
|
const size_t pipe_index = static_cast<size_t>(pipe_number);
|
||||||
LOG_ERROR(Audio_DSP, "pipe_number = %u invalid", pipe_number);
|
|
||||||
|
if (pipe_index >= NUM_DSP_PIPE) {
|
||||||
|
LOG_ERROR(Audio_DSP, "pipe_number = %zu invalid", pipe_index);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pipe_data[static_cast<size_t>(pipe_number)].size();
|
return pipe_data[pipe_index].size();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteU16(DspPipe pipe_number, u16 value) {
|
static void WriteU16(DspPipe pipe_number, u16 value) {
|
||||||
std::vector<u8>& data = pipe_data[static_cast<size_t>(pipe_number)];
|
const size_t pipe_index = static_cast<size_t>(pipe_number);
|
||||||
|
|
||||||
|
std::vector<u8>& data = pipe_data.at(pipe_index);
|
||||||
// Little endian
|
// Little endian
|
||||||
data.emplace_back(value & 0xFF);
|
data.emplace_back(value & 0xFF);
|
||||||
data.emplace_back(value >> 8);
|
data.emplace_back(value >> 8);
|
||||||
|
@ -145,7 +151,7 @@ void PipeWrite(DspPipe pipe_number, const std::vector<u8>& buffer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
LOG_CRITICAL(Audio_DSP, "pipe_number = %u unimplemented", pipe_number);
|
LOG_CRITICAL(Audio_DSP, "pipe_number = %zu unimplemented", static_cast<size_t>(pipe_number));
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,9 @@ enum class DspPipe {
|
||||||
Debug = 0,
|
Debug = 0,
|
||||||
Dma = 1,
|
Dma = 1,
|
||||||
Audio = 2,
|
Audio = 2,
|
||||||
Binary = 3,
|
Binary = 3
|
||||||
DspPipe_MAX
|
|
||||||
};
|
};
|
||||||
|
constexpr size_t NUM_DSP_PIPE = 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a DSP pipe.
|
* Read a DSP pipe.
|
||||||
|
|
Loading…
Reference in a new issue