GSP: Cleaned up command buffer decoding.

GSP: Cleaned up code and added additional comments.

GSP: Removed unnecessary TODO comment.

GSP: Changed u32 iterators in TriggerCmdReqQueue to unsigned.
This commit is contained in:
bunnei
2014-07-23 00:10:37 -04:00
parent 36fd1c169e
commit cad2f21985
2 changed files with 68 additions and 60 deletions

View File

@@ -41,8 +41,8 @@ enum class CommandId : u32 {
SET_COMMAND_LIST_FIRST = 0x05,
};
/// GSP thread interrupt queue header
struct InterruptQueue {
/// GSP thread interrupt relay queue
struct InterruptRelayQueue {
union {
u32 hex;
@@ -61,23 +61,8 @@ struct InterruptQueue {
InterruptId slot[0x34]; ///< Interrupt ID slots
};
static_assert(sizeof(InterruptQueue) == 0x40, "InterruptQueue struct has incorrect size");
/// GSP shared memory GX command buffer header
union CmdBufferHeader {
u32 hex;
// Current command index. This index is updated by GSP module after loading the command data,
// right before the command is processed. When this index is updated by GSP module, the total
// commands field is decreased by one as well.
BitField<0,8,u32> index;
// Total commands to process, must not be value 0 when GSP module handles commands. This must be
// <=15 when writing a command to shared memory. This is incremented by the application when
// writing a command to shared memory, after increasing this value TriggerCmdReqQueue is only
// used if this field is value 1.
BitField<8,8,u32> number_commands;
};
static_assert(sizeof(InterruptRelayQueue) == 0x40,
"InterruptRelayQueue struct has incorrect size");
/// GSP command
struct Command {
@@ -117,6 +102,29 @@ struct Command {
};
static_assert(sizeof(Command) == 0x20, "Command struct has incorrect size");
/// GSP shared memory GX command buffer header
struct CommandBuffer {
union {
u32 hex;
// Current command index. This index is updated by GSP module after loading the command
// data, right before the command is processed. When this index is updated by GSP module,
// the total commands field is decreased by one as well.
BitField<0,8,u32> index;
// Total commands to process, must not be value 0 when GSP module handles commands. This
// must be <=15 when writing a command to shared memory. This is incremented by the
// application when writing a command to shared memory, after increasing this value
// TriggerCmdReqQueue is only used if this field is value 1.
BitField<8,8,u32> number_commands;
};
u32 unk[7];
Command commands[0xF];
};
static_assert(sizeof(CommandBuffer) == 0x200, "CommandBuffer struct has incorrect size");
/// Interface to "srv:" service
class Interface : public Service::Interface {
public: