diff options
Diffstat (limited to 'usrp2/firmware/apps')
-rw-r--r-- | usrp2/firmware/apps/app_common_v2.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/usrp2/firmware/apps/app_common_v2.c b/usrp2/firmware/apps/app_common_v2.c index b51c3b23c..0a51110a9 100644 --- a/usrp2/firmware/apps/app_common_v2.c +++ b/usrp2/firmware/apps/app_common_v2.c @@ -350,11 +350,24 @@ peek_cmd(const op_peek_t *p, r->rid = p->rid; r->ok = true; - memcpy_wa(reply_payload+sizeof(*r), p->addr, p->bytes); + memcpy_wa(reply_payload+sizeof(*r), (void *)p->addr, p->bytes); return r->len; } +static bool +poke_cmd(const op_poke_t *p) +{ + int bytes = p->len - sizeof(*p); + putstr("poke: addr="); puthex32(p->addr); + printf(" bytes=%u\n", bytes); + + uint8_t *src = (uint8_t *)p + sizeof(*p); + memcpy_wa((void *)p->addr, src, bytes); + + return true; +} + static size_t generic_reply(const op_generic_t *p, void *reply_payload, size_t reply_payload_space, @@ -463,6 +476,11 @@ handle_control_chan_frame(u2_eth_packet_t *pkt, size_t len) subpktlen = peek_cmd((op_peek_t *)payload, reply_payload, reply_payload_space); break; + case OP_POKE: + subpktlen = generic_reply(gp, reply_payload, reply_payload_space, + poke_cmd((op_poke_t *)payload)); + break; + default: printf("app_common_v2: unhandled opcode = %d\n", gp->opcode); break; |