summaryrefslogtreecommitdiffstats
path: root/firmware/microblaze/apps
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-02-17 17:33:26 -0800
committerJosh Blum <josh@joshknows.com>2010-02-17 17:33:26 -0800
commitb9497ba5b8ff66856e13100160275ddc4a884db0 (patch)
tree03790382c28bdff95671f4a3550be3d05521fdb5 /firmware/microblaze/apps
parent4fb4572e1a16f54439f57655f90e0fc937c57c1e (diff)
downloaduhd-b9497ba5b8ff66856e13100160275ddc4a884db0.tar.gz
uhd-b9497ba5b8ff66856e13100160275ddc4a884db0.tar.bz2
uhd-b9497ba5b8ff66856e13100160275ddc4a884db0.zip
Added i2c control transactions in fw and host
Diffstat (limited to 'firmware/microblaze/apps')
-rw-r--r--firmware/microblaze/apps/txrx.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/firmware/microblaze/apps/txrx.c b/firmware/microblaze/apps/txrx.c
index fde7529ac..2cf3c46ed 100644
--- a/firmware/microblaze/apps/txrx.c
+++ b/firmware/microblaze/apps/txrx.c
@@ -44,6 +44,7 @@
#include <vrt/bits.h>
#include "usrp2/fw_common.h"
#include <db.h>
+#include <i2c.h>
#define FW_SETS_SEQNO 1 // define to 0 or 1 (FIXME must be 1 for now)
@@ -319,6 +320,33 @@ void handle_udp_ctrl_packet(
}
break;
+ /*******************************************************************
+ * I2C
+ ******************************************************************/
+ case USRP2_CTRL_ID_DO_AN_I2C_READ_FOR_ME_BRO:{
+ uint8_t num_bytes = ctrl_data_in->data.i2c_args.bytes;
+ i2c_read(
+ ctrl_data_in->data.i2c_args.addr,
+ ctrl_data_out.data.i2c_args.data,
+ num_bytes
+ );
+ ctrl_data_out.id = USRP2_CTRL_ID_HERES_THE_I2C_DATA_DUDE;
+ ctrl_data_out.data.i2c_args.bytes = num_bytes;
+ }
+ break;
+
+ case USRP2_CTRL_ID_WRITE_THESE_I2C_VALUES_BRO:{
+ uint8_t num_bytes = ctrl_data_in->data.i2c_args.bytes;
+ i2c_write(
+ ctrl_data_in->data.i2c_args.addr,
+ ctrl_data_in->data.i2c_args.data,
+ num_bytes
+ );
+ ctrl_data_out.id = USRP2_CTRL_ID_COOL_IM_DONE_I2C_WRITE_DUDE;
+ ctrl_data_out.data.i2c_args.bytes = num_bytes;
+ }
+ break;
+
default:
ctrl_data_out.id = USRP2_CTRL_ID_HUH_WHAT;