mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2025-04-21 12:27:27 +03:00
tools/lib/atusb.c: added SRAM access to atusb driver
- tools/atrf-proxy/PROTOCOL: documented new commands GETRAM and SETRAM for SRAM access - tools/atrf-proxy/atrf-proxy.c (cmd_two, cmd_more): added "setram" command - tools/atrf-proxy/atrf-proxy.c (cmd_more): added "getram" command - tools/lib/atnet.c (atnet_sram_write, atnet_sram_read): SRAM access functions - tools/lub/atnet.c (atnet_driver): added new functions to driver operations
This commit is contained in:
@@ -48,6 +48,14 @@ READ
|
||||
+length raw-data
|
||||
-message
|
||||
|
||||
SETRAM addr value
|
||||
+[comment]
|
||||
-message
|
||||
|
||||
GETRAM addr
|
||||
+value
|
||||
-message
|
||||
|
||||
POLL
|
||||
+0|1
|
||||
-message
|
||||
|
||||
@@ -103,6 +103,19 @@ static int cmd_two(struct atrf_dsc *dsc, struct netio *netio, const char *cmd)
|
||||
return netio_printf(netio, "-I/O error\n");
|
||||
return netio_printf(netio, "+\n");
|
||||
}
|
||||
if (!strcasecmp(cmd, "setram")) {
|
||||
int val;
|
||||
|
||||
val = get_num(netio, 1, &ret);
|
||||
if (val < 0)
|
||||
return ret;
|
||||
if (val > 255)
|
||||
return netio_printf(netio, "-bad argument\n");
|
||||
atrf_sram_write(dsc, n, val);
|
||||
if (atrf_error(dsc))
|
||||
return netio_printf(netio, "-I/O error\n");
|
||||
return netio_printf(netio, "+\n");
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
@@ -113,6 +126,8 @@ static int cmd_more(struct atrf_dsc *dsc, struct netio *netio, const char *cmd)
|
||||
|
||||
if (!strcasecmp(cmd, "set"))
|
||||
return cmd_two(dsc, netio, cmd);
|
||||
if (!strcasecmp(cmd, "setram"))
|
||||
return cmd_two(dsc, netio, cmd);
|
||||
if (!strcasecmp(cmd, "write"))
|
||||
return cmd_two(dsc, netio, cmd);
|
||||
|
||||
@@ -144,6 +159,16 @@ static int cmd_more(struct atrf_dsc *dsc, struct netio *netio, const char *cmd)
|
||||
return netio_printf(netio, "-I/O error\n");
|
||||
return netio_printf(netio, "+0x%02x\n", res);
|
||||
}
|
||||
if (!strcasecmp(cmd, "getram")) {
|
||||
uint8_t res;
|
||||
|
||||
if (n > 255)
|
||||
return netio_printf(netio, "-bad argument\n");
|
||||
res = atrf_sram_read(dsc, n);
|
||||
if (atrf_error(dsc))
|
||||
return netio_printf(netio, "-I/O error\n");
|
||||
return netio_printf(netio, "+0x%02x\n", res);
|
||||
}
|
||||
return netio_printf(netio, "-unrecognized command\n");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user