-
Notifications
You must be signed in to change notification settings - Fork 0
GEMU Protocol
The GEMU server consists of a collection of device trees. Each device tree is rooted by the cpu core, and consists of all the devices connected to that cpu core. Devices range from simple clocks and floppy drives up to complex radio communication systems.
Each packet will consist of a header, followed by a message. The header will specify the device tree that the packet is for, with the device tree ID 0 specifing a packet for the server itself(in most cases this will be for creating a new device tree). The Device ID will be unique to the device tree. Any responses to a packet will contain a matching TXID, to allow easier matching of request/response pairs.
Device Tree ID | Device ID | Packet Type | Packet TX ID | Packet Length | Packet Data |
---|---|---|---|---|---|
uint32 | uint16 | uint16 | uint16 | uint16 | uint8[n] |
The client sends a request for the class list to the server. This request must be sent to device tree 0.
Request | Response |
---|---|
0x0001 | 0x8001 |
No packet body
struct {
ClassID uint32
Name string
Desc string
}[n]
The client sends a request for the creation of a device tree, which includes the specification of a CPU and any parameters associated with it. This request must be sent to device tree 0.
Request | Response |
---|---|
0x0101 | 0x8101 |
ClassID uint32
Parameters
DeviceTreeID uint32
Error uint32
The client sends a request to delete a device tree. The device tree is NOT serialized to persistent storage, and is immediately irretrievable. This request is sent to the device to be deleted
Request | Response |
---|---|
0x0102 | 0x8102 |
No packet body
Error uint32
The client sends a request to attach a device to the device tree. The created device is attached to the specific device that this request was directed to. To attach to the main root of the tree, send the request to device ID 0. The device is inserted at the requested location, pushing the item at that location towards higher indices. A Where
value of 0xFFFF indicates to insert the item at the end of the list.
Request | Response |
---|---|
0x0103 | 0x8103 |
ClassID uint32
Where uint16
Parameters
ClassID uint32
DeviceID uint16
Error uint32
The client sends a request to remove a device from the device tree.
Request | Response |
---|---|
0x0104 | 0x8104 |
No packet body
Error uint32
The client sends a request to start a device tree. This does not imply resetting the device tree, merely starting the processor ticking and similar tasks.
Request | Response |
---|---|
0x0105 | 0x8105 |
No packet body
Error uint32
The client sends a request to stop a device tree.
Request | Response |
---|---|
0x0106 | 0x8106 |
No packet body
Error uint32
The client sends a request to reset a device tree. This causes all devices attached to the tree to be reset as well
Request | Response |
---|---|
0x0107 | 0x8107 |
No packet body
Error uint32
The client sends a request to list a device tree. This returns all the devices in the tree.
Request | Response |
---|---|
0x0108 | 0x8108 |
No packet body
struct Device {
ID uint16
Class uint32
ChildCount uint16
Children [uint16]Device
}
This packet sends a message to a specific device. It can be sent in either direction, to allow events to pass to or from the emulated device. The exact details of this message depend on the device the message is sent to. Examples include key presses for a keyboard and similar. This packet does not follow a "request/response" pattern.
Packet Type |
---|
0x0110 |
The client sends a request to start recieving StateSync updates for a specific device tree node over this connection. Note: StateSync is automatically registered for the connection that creates a device. This packet does not follow a "request/response" pattern.
Packet Type |
---|
0x0120 |
No packet body
The client sends a request to start recieving MemSync updates for a specific device tree node over this connection. This packet does not follow a "request/response" pattern.
Packet Type |
---|
0x0121 |
No packet body
The client sends a request to stop recieving StateSync updates for a specific device tree node over this connection. This packet does not follow a "request/response" pattern.
Packet Type |
---|
0x0122 |
No packet body
The client sends a request to stop recieving MemSync updates for a specific device tree node over this connection. This packet does not follow a "request/response" pattern.
Packet Type |
---|
0x0123 |
No packet body
This packet is sent when an update to the state of a device is performed. It can be sent in either direction, to allow updates to pass to or from the emulated device, though typically they will pass from the emulator to the client. The exact details of this message depend on the device the message is sent to. Examples include memory base pointers for LEM displays. This packet does not follow a "request/response" pattern.
Packet Type |
---|
0x0130 |
This packet is sent when an update to the memory of a device is performed. It can be sent in either direction, to allow updates to pass to or from the emulated device, though typically they will pass from the emulator to the client. This packet does not follow a "request/response" pattern.
Packet Type |
---|
0x0131 |
SectionCount uint16
struct {
StartChunk uint16
Count uint8
Ram uint16[Count*16]
}[SectionCount]
ParamCount uint8
struct {
ID uint8
Len uint8
Data uint8[Len]
}[ParamCount]