35
35
#include "common.h"
36
36
37
37
38
- /** Read file from the file system (host < => device)
38
+ /** Read file from the file system (host => device)
39
39
*
40
40
* The file read message reads a certain length (up to 255 bytes)
41
41
* from a given offset into a file, and returns the data in a
42
- * MSG_FILEIO_READ message where the message length field indicates
43
- * how many bytes were succesfully read. If the message is invalid,
44
- * a followup MSG_PRINT message will print "Invalid fileio read
45
- * message".
42
+ * MSG_FILEIO_READ_RESPONSE message where the message length field
43
+ * indicates how many bytes were succesfully read. If the message is
44
+ * invalid, a followup MSG_PRINT message will print "Invalid fileio
45
+ * read message".
46
46
*/
47
- #define SBP_MSG_FILEIO_READ 0x00A8
47
+ #define SBP_MSG_FILEIO_READ_REQUEST 0x00A8
48
48
typedef struct __attribute__((packed )) {
49
49
u32 offset ; /**< File offset [bytes] */
50
50
u8 chunk_size ; /**< Chunk size to read [bytes] */
51
51
char filename [20 ]; /**< Name of the file to read from (NULL padded) */
52
- } msg_fileio_read_t ;
52
+ } msg_fileio_read_request_t ;
53
+
54
+
55
+ /** File read from the file system (host <= device)
56
+ *
57
+ * The file read message reads a certain length (up to 255 bytes)
58
+ * from a given offset into a file, and returns the data in a
59
+ * message where the message length field indicates how many bytes
60
+ * were succesfully read.
61
+ */
62
+ #define SBP_MSG_FILEIO_READ_RESPONSE 0x00A3
63
+ typedef struct __attribute__((packed )) {
64
+ u32 offset ; /**< File offset [bytes] */
65
+ u8 chunk_size ; /**< Chunk size read [bytes] */
66
+ char filename [20 ]; /**< Name of the file read from (NULL padded) */
67
+ u8 contents [0 ]; /**< Contents of read file */
68
+ } msg_fileio_read_response_t ;
53
69
54
70
55
- /** List files in a directory (host < => device)
71
+ /** List files in a directory (host => device)
56
72
*
57
73
* The read directory message lists the files in a directory on the
58
74
* device's onboard flash file system. The offset parameter can be
59
75
* used to skip the first n elements of the file list. Returns a
60
- * MSG_FILEIO_READ_DIR message containing the directory listings as
61
- * a NULL delimited list. The listing is chunked over multiple SBP
62
- * packets and the end of the list is identified by an entry
63
- * containing just the character 0xFF. If message is invalid, a
76
+ * MSG_FILEIO_READ_DIR_RESPONSE message containing the directory
77
+ * listings as a NULL delimited list. The listing is chunked over
78
+ * multiple SBP packets and the end of the list is identified by an
79
+ * entry containing just the character 0xFF. If message is invalid, a
64
80
* followup MSG_PRINT message will print "Invalid fileio read
65
81
* message".
66
82
*/
67
- #define SBP_MSG_FILEIO_READ_DIR 0x00A9
83
+ #define SBP_MSG_FILEIO_READ_DIR_REQUEST 0x00A9
68
84
typedef struct __attribute__((packed )) {
69
85
u32 offset ; /**< The offset to skip the first n elements of the file list
70
86
*/
71
87
char dirname [20 ]; /**< Name of the directory to list (NULL padded) */
72
- } msg_fileio_read_dir_t ;
88
+ } msg_fileio_read_dir_request_t ;
89
+
90
+
91
+ /** Files listed in a directory (host <= device)
92
+ *
93
+ * The read directory message lists the files in a directory on the
94
+ * device's onboard flash file system. The offset parameter can be
95
+ * used to skip the first n elements of the file list. Message contains
96
+ * the directory listings as a NULL delimited list. The listing is
97
+ * chunked over multiple SBP packets and the end of the list is
98
+ * identified by an entry containing just the character 0xFF.
99
+ */
100
+ #define SBP_MSG_FILEIO_READ_DIR_RESPONSE 0x00AA
101
+ typedef struct __attribute__((packed )) {
102
+ u32 offset ; /**< The offset to skip the first n elements of the file list
103
+ */
104
+ char dirname [20 ]; /**< Name of the directory to list (NULL padded) */
105
+ u8 contents [0 ]; /**< Contents of read directory */
106
+ } msg_fileio_read_dir_response_t ;
73
107
74
108
75
109
/** Delete a file from the file system (host => device)
@@ -78,26 +112,41 @@ typedef struct __attribute__((packed)) {
78
112
* message is invalid, a followup MSG_PRINT message will print
79
113
* "Invalid fileio remove message".
80
114
*/
81
- #define SBP_MSG_FILEIO_REMOVE 0x00AC
115
+ #define SBP_MSG_FILEIO_REMOVE 0x00AC
82
116
typedef struct __attribute__((packed )) {
83
117
char filename [20 ]; /**< Name of the file to delete (NULL padded) */
84
118
} msg_fileio_remove_t ;
85
119
86
120
87
- /** Write to file (host < => device)
121
+ /** Write to file (host => device)
88
122
*
89
123
* The file write message writes a certain length (up to 255 bytes)
90
124
* of data to a file at a given offset. Returns a copy of the
91
- * original MSG_FILEIO_WRITE message to check integrity of the
92
- * write. If message is invalid, a followup MSG_PRINT message will
93
- * print "Invalid fileio write message".
125
+ * original MSG_FILEIO_WRITE_RESPONSE message to check integrity of
126
+ * the write. If message is invalid, a followup MSG_PRINT message
127
+ * will print "Invalid fileio write message".
128
+ */
129
+ #define SBP_MSG_FILEIO_WRITE_REQUEST 0x00AD
130
+ typedef struct __attribute__((packed )) {
131
+ char filename [20 ]; /**< Name of the file to write to (NULL padded) */
132
+ u32 offset ; /**< Offset into the file at which to start writing in bytes [bytes] */
133
+ u8 data [0 ]; /**< Variable-length array of data to write */
134
+ } msg_fileio_write_request_t ;
135
+
136
+
137
+ /** File written to (host <= device)
138
+ *
139
+ * The file write message writes a certain length (up to 255 bytes)
140
+ * of data to a file at a given offset. The message is a copy of the
141
+ * original MSG_FILEIO_WRITE_REQUEST message to check integrity of the
142
+ * write.
94
143
*/
95
- #define SBP_MSG_FILEIO_WRITE 0x00AD
144
+ #define SBP_MSG_FILEIO_WRITE_RESPONSE 0x00AB
96
145
typedef struct __attribute__((packed )) {
97
146
char filename [20 ]; /**< Name of the file to write to (NULL padded) */
98
147
u32 offset ; /**< Offset into the file at which to start writing in bytes [bytes] */
99
148
u8 data [0 ]; /**< Variable-length array of data to write */
100
- } msg_fileio_write_t ;
149
+ } msg_fileio_write_response_t ;
101
150
102
151
103
152
/** \} */
0 commit comments