summaryrefslogtreecommitdiffstats
path: root/sahara.h
diff options
context:
space:
mode:
Diffstat (limited to 'sahara.h')
-rw-r--r--sahara.h43
1 files changed, 36 insertions, 7 deletions
diff --git a/sahara.h b/sahara.h
index c3cf7af..b4b0e7b 100644
--- a/sahara.h
+++ b/sahara.h
@@ -26,14 +26,19 @@
//modes
#define SAH_MODE_TRANSFER_PENDING 0x00
#define SAH_MODE_TRANSFER_COMPLETE 0x01
+#define SAH_MODE_MEMORY_DEBUG 0x02
// commands
-#define SAH_COMMAND_HELLO_REQ 0x01
-#define SAH_COMMAND_HELLO_RESP 0x02
-#define SAH_COMMAND_DATA_REQ 0x03
-#define SAH_COMMAND_DATA_END_REQ 0x04
-#define SAH_COMMAND_DATA_END_RESP 0x05
-#define SAH_COMMAND_DATA_END_ACK 0x06
+#define SAH_COMMAND_HELLO_REQ 0x01
+#define SAH_COMMAND_HELLO_RESP 0x02
+#define SAH_COMMAND_DATA_REQ 0x03
+#define SAH_COMMAND_DATA_END_REQ 0x04
+#define SAH_COMMAND_DATA_END_RESP 0x05
+#define SAH_COMMAND_DATA_END_ACK 0x06
+#define SAH_COMMAND_RESET_REQ 0x07
+#define SAH_COMMAND_RESET_RESP 0x08
+#define SAH_COMMAND_MEMORY_DEBUG_REQ 0x09
+#define SAH_COMMAND_MEMORY_READ_REQ 0x0A
struct sah_header {
unsigned int command;
@@ -41,7 +46,6 @@ struct sah_header {
} __attribute__((__packed__));
struct sah_hello_req {
- struct sah_header header;
unsigned int version;
unsigned int min_version;
unsigned int not_needed;
@@ -74,4 +78,29 @@ struct sah_data_end_ack {
unsigned int status; // 0 more file requests to come, 1 complete
} __attribute__((__packed__));
+struct sah_memory_debug_req {
+ unsigned int address;
+ unsigned int size;
+} __attribute__((__packed__));
+
+struct sah_memory_read_req {
+ struct sah_header header;
+ unsigned int address;
+ unsigned int size;
+} __attribute__((__packed__));
+
+// response after a memory read request
+struct sah_memory_table {
+ unsigned int unknown;
+ unsigned int address;
+ unsigned int size;
+ unsigned char empty[20];
+ unsigned char file[20];
+} __attribute__((__packed__));
+
+int hello_response(int tty_fd, int mode);
+int hello_handshake(int tty_fd, int mode);
+int send_file(int tty_fd, struct sah_data_end_ack *data_end_ack);
+int handle_memory_debug(int tty_fd);
+
#endif