summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/gsp.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2014-07-23 05:26:28 +0200
committerbunnei <bunneidev@gmail.com>2014-08-06 05:58:00 +0200
commit4e9f305ed214ef0fbffd83042c86f41cd233ec3b (patch)
tree51787c34f01a244d28ee3b41bdbfc0b93c38bbff /src/core/hle/service/gsp.h
parentGSP: Removed unnecessary GX_FinishCommand function. (diff)
downloadyuzu-4e9f305ed214ef0fbffd83042c86f41cd233ec3b.tar
yuzu-4e9f305ed214ef0fbffd83042c86f41cd233ec3b.tar.gz
yuzu-4e9f305ed214ef0fbffd83042c86f41cd233ec3b.tar.bz2
yuzu-4e9f305ed214ef0fbffd83042c86f41cd233ec3b.tar.lz
yuzu-4e9f305ed214ef0fbffd83042c86f41cd233ec3b.tar.xz
yuzu-4e9f305ed214ef0fbffd83042c86f41cd233ec3b.tar.zst
yuzu-4e9f305ed214ef0fbffd83042c86f41cd233ec3b.zip
Diffstat (limited to 'src/core/hle/service/gsp.h')
-rw-r--r--src/core/hle/service/gsp.h67
1 files changed, 54 insertions, 13 deletions
diff --git a/src/core/hle/service/gsp.h b/src/core/hle/service/gsp.h
index 5a649d2df..66b99e94a 100644
--- a/src/core/hle/service/gsp.h
+++ b/src/core/hle/service/gsp.h
@@ -12,7 +12,19 @@
namespace GSP_GPU {
-enum class GXCommandId : u32 {
+/// GSP interrupt ID
+enum class InterruptId : u8 {
+ PSC0 = 0x00,
+ PSC1 = 0x01,
+ PDC0 = 0x02, // Seems called every vertical screen line
+ PDC1 = 0x03, // Seems called every frame
+ PPF = 0x04,
+ P3D = 0x05,
+ DMA = 0x06,
+};
+
+/// GSP command ID
+enum class CommandId : u32 {
REQUEST_DMA = 0x00,
SET_COMMAND_LIST_LAST = 0x01,
@@ -29,18 +41,47 @@ enum class GXCommandId : u32 {
SET_COMMAND_LIST_FIRST = 0x05,
};
-enum class GXInterruptId : u8 {
- PSC0 = 0x00,
- PSC1 = 0x01,
- PDC0 = 0x02, // Seems called every vertical screen line
- PDC1 = 0x03, // Seems called every frame
- PPF = 0x04,
- P3D = 0x05,
- DMA = 0x06,
+/// GSP thread interrupt queue header
+struct InterruptQueue {
+ union {
+ u32 hex;
+
+ // Index of last interrupt in the queue
+ BitField<0,8,u32> index;
+
+ // Number of interrupts remaining to be processed by the userland code
+ BitField<8,8,u32> number_interrupts;
+
+ // Error code - zero on success, otherwise an error has occurred
+ BitField<16,8,u32> error_code;
+ };
+
+ u32 unk0;
+ u32 unk1;
+
+ 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;
};
-struct GXCommand {
- BitField<0, 8, GXCommandId> id;
+/// GSP command
+struct Command {
+ BitField<0, 8, CommandId> id;
union {
struct {
@@ -74,7 +115,7 @@ struct GXCommand {
u8 raw_data[0x1C];
};
};
-static_assert(sizeof(GXCommand) == 0x20, "GXCommand struct has incorrect size");
+static_assert(sizeof(Command) == 0x20, "Command struct has incorrect size");
/// Interface to "srv:" service
class Interface : public Service::Interface {
@@ -98,6 +139,6 @@ public:
* Signals that the specified interrupt type has occurred to userland code
* @param interrupt_id ID of interrupt that is being signalled
*/
-void SignalInterrupt(GXInterruptId interrupt_id);
+void SignalInterrupt(InterruptId interrupt_id);
} // namespace