summaryrefslogtreecommitdiff
path: root/usrp2/firmware/apps
diff options
context:
space:
mode:
authorjcorgan2008-12-29 01:35:48 +0000
committerjcorgan2008-12-29 01:35:48 +0000
commit50b2df2ed93de8dbba3185714a3e07e7470e1229 (patch)
tree2eb77cbebb878fc6f7ee8ebed3b5c546b5e330bd /usrp2/firmware/apps
parent31daef30bc197cb86c7310db386d0b5835c03422 (diff)
downloadgnuradio-50b2df2ed93de8dbba3185714a3e07e7470e1229.tar.gz
gnuradio-50b2df2ed93de8dbba3185714a3e07e7470e1229.tar.bz2
gnuradio-50b2df2ed93de8dbba3185714a3e07e7470e1229.zip
Implements USRP2 poke32() command.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10176 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'usrp2/firmware/apps')
-rw-r--r--usrp2/firmware/apps/app_common_v2.c20
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;