diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2018-02-24 16:01:19 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-03-01 09:39:42 +0100 |
commit | bfcdef33add4f58ebd7f6a9621c94b1fb2caabd5 (patch) | |
tree | 0d97784763bcaae6059e405673bfaae3d45f880d /include/ratp_bb.h | |
parent | 706328c33fc8e9e680f37ee4cdac9ecbf3127f23 (diff) | |
download | barebox-bfcdef33add4f58ebd7f6a9621c94b1fb2caabd5.tar.gz barebox-bfcdef33add4f58ebd7f6a9621c94b1fb2caabd5.tar.xz |
ratp: new md and mw commands
This commit introduces support for running the md and mw commands
using the binary interface provided by RATP. This allows clients to
read and write memory files without needing to do custom string
parsing on the data returned by the console 'md' and 'mw' operations.
The request and response messages used for these new operations are
structured in the same way:
* An initial fixed-sized section includes the fixed-sized
variables (e.g. integers), as well as the size and offset of the
variable-length variables.
* After the initial fixed-sized section, the buffer is given, which
contains the variable-length variables in the offsets previously
defined and with the size previously defined.
The message also defines separately the offset of the buffer
w.r.t. the start of the message. The endpoint reading the message will
use this information to decide where the buffer starts. This allows to
extend the message format in the future without needing to break the
message API, as new fields can be appended to the fixed-sized section
as long as the buffer offset is also updated to report the new
position of the buffer.
E.g.:
$ ./bbremote --port /dev/ttyUSB2 md /dev/pic_eeprom_rdu 0x107 5
0000000000
$ ./bbremote --port /dev/ttyUSB2 mw /dev/pic_eeprom_rdu 0x107 0102030405
5 bytes written
$ ./bbremote --port /dev/ttyUSB2 md /dev/pic_eeprom_rdu 0x107 5
0102030405
$ ./bbremote --port /dev/ttyUSB2 mw /dev/pic_eeprom_rdu 0x107 0000000000
5 bytes written
$ ./bbremote --port /dev/ttyUSB2 md /dev/pic_eeprom_rdu 0x107 5
0000000000
Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/ratp_bb.h')
-rw-r--r-- | include/ratp_bb.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/ratp_bb.h b/include/ratp_bb.h index 75aabed55e..00b165f77e 100644 --- a/include/ratp_bb.h +++ b/include/ratp_bb.h @@ -12,6 +12,10 @@ #define BB_RATP_TYPE_GETENV_RETURN 7 #define BB_RATP_TYPE_FS 8 #define BB_RATP_TYPE_FS_RETURN 9 +#define BB_RATP_TYPE_MD 10 +#define BB_RATP_TYPE_MD_RETURN 11 +#define BB_RATP_TYPE_MW 12 +#define BB_RATP_TYPE_MW_RETURN 13 struct ratp_bb { uint16_t type; |