-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathfile_io.yaml
213 lines (201 loc) · 7.59 KB
/
file_io.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# Copyright (C) 2015-2021 Swift Navigation Inc.
# Contact: https://support.swiftnav.com
#
# This source is subject to the license found in the file 'LICENSE' which must
# be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
package: swiftnav.sbp.file_io
description: >
Messages for using device's onboard flash filesystem
functionality. This allows data to be stored persistently in the
device's program flash with wear-levelling using a simple filesystem
interface. The file system interface (CFS) defines an abstract API
for reading directories and for reading and writing files.
Note that some of these messages share the same message type ID for both the
host request and the device response.
stable: False
public: True
include:
- types.yaml
definitions:
- MSG_FILEIO_READ_REQ:
id: 0x00A8
short_desc: Read file from the file system (host => device)
desc: >
The file read message reads a certain length (up to 255 bytes)
from a given offset into a file, and returns the data in a
MSG_FILEIO_READ_RESP message where the message length field
indicates how many bytes were successfully read. The sequence
number in the request will be returned in the response.
If the message is invalid, a followup MSG_PRINT message will
print "Invalid fileio read message". A device will only respond
to this message when it is received from sender ID 0x42.
fields:
- sequence:
type: u32
desc: Read sequence number
- offset:
type: u32
units: bytes
desc: File offset
- chunk_size:
type: u8
units: bytes
desc: Chunk size to read
- filename:
type: string
encoding: null_terminated
desc: Name of the file to read from
- MSG_FILEIO_READ_RESP:
id: 0x00A3
short_desc: File read from the file system (host <= device)
desc: >
The file read message reads a certain length (up to 255 bytes)
from a given offset into a file, and returns the data in a
message where the message length field indicates how many bytes
were successfully read. The sequence number in the response is
preserved from the request.
fields:
- sequence:
type: u32
desc: Read sequence number
- contents:
type: array
fill: u8
desc: Contents of read file
- MSG_FILEIO_READ_DIR_REQ:
id: 0x00A9
short_desc: List files in a directory (host => device)
desc: >
The read directory message lists the files in a directory on the
device's onboard flash file system. The offset parameter can be
used to skip the first n elements of the file list. Returns a
MSG_FILEIO_READ_DIR_RESP message containing the directory
listings as a NULL delimited list. The listing is chunked over
multiple SBP packets. The sequence number in the request will be
returned in the response. If message is invalid, a followup
MSG_PRINT message will print "Invalid fileio read message".
A device will only respond to this message when it is received
from sender ID 0x42.
fields:
- sequence:
type: u32
desc: Read sequence number
- offset:
type: u32
desc: >
The offset to skip the first n elements of the file list
- dirname:
type: string
encoding: null_terminated
desc: Name of the directory to list
- MSG_FILEIO_READ_DIR_RESP:
id: 0x00AA
short_desc: Files listed in a directory (host <= device)
desc: >
The read directory message lists the files in a directory on the
device's onboard flash file system. Message contains the directory
listings as a NULL delimited list. The listing is chunked over
multiple SBP packets and the end of the list is identified by an
packet with no entries. The sequence number in the response is
preserved from the request.
fields:
- sequence:
type: u32
desc: Read sequence number
- contents:
type: string
encoding: multipart
fill: u8
desc: Contents of read directory
- MSG_FILEIO_REMOVE:
id: 0x00AC
short_desc: Delete a file from the file system (host => device)
desc: >
The file remove message deletes a file from the file system.
If the message is invalid, a followup MSG_PRINT message will
print "Invalid fileio remove message". A device will only
process this message when it is received from sender ID 0x42.
fields:
- filename:
type: string
encoding: null_terminated
desc: Name of the file to delete
- MSG_FILEIO_WRITE_REQ:
id: 0x00AD
short_desc: Write to file (host => device)
desc: >
The file write message writes a certain length (up to 255 bytes)
of data to a file at a given offset. Returns a copy of the
original MSG_FILEIO_WRITE_RESP message to check integrity of
the write. The sequence number in the request will be returned
in the response. If message is invalid, a followup MSG_PRINT
message will print "Invalid fileio write message". A device will
only process this message when it is received from sender ID
0x42.
fields:
- sequence:
type: u32
desc: Write sequence number
- offset:
type: u32
units: bytes
desc: Offset into the file at which to start writing in bytes
- filename:
type: string
encoding: null_terminated
desc: Name of the file to write to
- data:
type: array
fill: u8
desc: Variable-length array of data to write
- MSG_FILEIO_WRITE_RESP:
id: 0x00AB
short_desc: File written to (host <= device)
desc: >
The file write message writes a certain length (up to 255 bytes)
of data to a file at a given offset. The message is a copy of the
original MSG_FILEIO_WRITE_REQ message to check integrity of the
write. The sequence number in the response is preserved from the
request.
fields:
- sequence:
type: u32
desc: Write sequence number
- MSG_FILEIO_CONFIG_REQ:
id: 0x1001
short_desc: Request advice on the optimal configuration for FileIO
desc: >
Requests advice on the optimal configuration for a FileIO
transfer. Newer version of FileIO can support greater
throughput by supporting a large window of FileIO data
that can be in-flight during read or write operations.
fields:
- sequence:
type: u32
desc: Advice sequence number
- MSG_FILEIO_CONFIG_RESP:
id: 0x1002
short_desc: >
Response with advice on the optimal configuration for FileIO.
desc: >
The advice on the optimal configuration for a FileIO
transfer. Newer version of FileIO can support greater
throughput by supporting a large window of FileIO data
that can be in-flight during read or write operations.
fields:
- sequence:
type: u32
desc: Advice sequence number
- window_size:
type: u32
desc: The number of SBP packets in the data in-flight window
- batch_size:
type: u32
desc: The number of SBP packets sent in one PDU
- fileio_version:
type: u32
desc: The version of FileIO that is supported