diff options
author | Josh Blum <josh@joshknows.com> | 2010-04-05 12:18:17 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-04-05 12:18:17 -0700 |
commit | 12aa8ad74cf3a343159ddbb452455bf4e7f435b8 (patch) | |
tree | 69b6928826b73d9a8adcfa62d8301ce28b95c11a /firmware | |
parent | 83bd55d63972804e62f3890a4a90c8288fcbad0c (diff) | |
download | uhd-12aa8ad74cf3a343159ddbb452455bf4e7f435b8.tar.gz uhd-12aa8ad74cf3a343159ddbb452455bf4e7f435b8.tar.bz2 uhd-12aa8ad74cf3a343159ddbb452455bf4e7f435b8.zip |
added 16 bit peek and poke, 16 bit register defs for gpios and atrs
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/microblaze/apps/txrx.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/firmware/microblaze/apps/txrx.c b/firmware/microblaze/apps/txrx.c index 555dd4dd5..69a04d771 100644 --- a/firmware/microblaze/apps/txrx.c +++ b/firmware/microblaze/apps/txrx.c @@ -415,14 +415,38 @@ void handle_udp_ctrl_packet( if (ctrl_data_in->data.poke_args.addr < 0xC000){ printf("error! tried to poke into 0x%x\n", ctrl_data_in->data.poke_args.addr); } - else{ - *((uint32_t *) ctrl_data_in->data.poke_args.addr) = ctrl_data_in->data.poke_args.data; + else switch(ctrl_data_in->data.poke_args.num_bytes){ + case sizeof(uint32_t): + *((uint32_t *) ctrl_data_in->data.poke_args.addr) = (uint32_t)ctrl_data_in->data.poke_args.data; + break; + + case sizeof(uint16_t): + *((uint16_t *) ctrl_data_in->data.poke_args.addr) = (uint16_t)ctrl_data_in->data.poke_args.data; + break; + + case sizeof(uint8_t): + *((uint8_t *) ctrl_data_in->data.poke_args.addr) = (uint8_t)ctrl_data_in->data.poke_args.data; + break; + } ctrl_data_out.id = USRP2_CTRL_ID_OMG_POKED_REGISTER_SO_BAD_DUDE; break; case USRP2_CTRL_ID_PEEK_AT_THIS_REGISTER_FOR_ME_BRO: - ctrl_data_in->data.poke_args.data = *((uint32_t *) ctrl_data_in->data.poke_args.addr); + switch(ctrl_data_in->data.poke_args.num_bytes){ + case sizeof(uint32_t): + ctrl_data_in->data.poke_args.data = *((uint32_t *) ctrl_data_in->data.poke_args.addr); + break; + + case sizeof(uint16_t): + ctrl_data_in->data.poke_args.data = *((uint16_t *) ctrl_data_in->data.poke_args.addr); + break; + + case sizeof(uint8_t): + ctrl_data_in->data.poke_args.data = *((uint8_t *) ctrl_data_in->data.poke_args.addr); + break; + + } ctrl_data_out.id = USRP2_CTRL_ID_WOAH_I_DEFINITELY_PEEKED_IT_DUDE; break; |