Add WriteHWRegRepeat

This commit is contained in:
Darius Goad 2015-02-23 20:53:16 -06:00
parent 50a0c4f14f
commit ac27ce2141

View File

@ -167,6 +167,29 @@ static void WriteHWRegsWithMask(Service::Interface* self) {
WriteHWRegsWithMask(reg_addr, size, src_data, mask_data); WriteHWRegsWithMask(reg_addr, size, src_data, mask_data);
} }
static void WriteHWRegRepeat(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
u32 reg_addr = cmd_buff[1];
u32 size = cmd_buff[2];
// TODO: Return proper error codes
if (reg_addr + size >= 0x420000) {
LOG_ERROR(Service_GSP, "Write address out of range! (address=0x%08x, size=0x%08x)", reg_addr, size);
return;
}
//Taking size to mean amount of times the reg is hammered.
/*// size should be word-aligned
if ((size % 4) != 0) {
LOG_ERROR(Service_GSP, "Invalid size 0x%08x", size);
return;
}*/
u32 data = cmd_buff[4];
for(int i = 0;i<size;i++) GPU::Write<u32>(reg_addr,data);
}
/// Read a GSP GPU hardware register /// Read a GSP GPU hardware register
static void ReadHWRegs(Service::Interface* self) { static void ReadHWRegs(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer(); u32* cmd_buff = Kernel::GetCommandBuffer();
@ -452,7 +475,7 @@ static void TriggerCmdReqQueue(Service::Interface* self) {
const Interface::FunctionInfo FunctionTable[] = { const Interface::FunctionInfo FunctionTable[] = {
{0x00010082, WriteHWRegs, "WriteHWRegs"}, {0x00010082, WriteHWRegs, "WriteHWRegs"},
{0x00020084, WriteHWRegsWithMask, "WriteHWRegsWithMask"}, {0x00020084, WriteHWRegsWithMask, "WriteHWRegsWithMask"},
{0x00030082, nullptr, "WriteHWRegRepeat"}, {0x00030082, WriteHWRegRepeat, "WriteHWRegRepeat"},
{0x00040080, ReadHWRegs, "ReadHWRegs"}, {0x00040080, ReadHWRegs, "ReadHWRegs"},
{0x00050200, SetBufferSwap, "SetBufferSwap"}, {0x00050200, SetBufferSwap, "SetBufferSwap"},
{0x00060082, nullptr, "SetCommandList"}, {0x00060082, nullptr, "SetCommandList"},