From b9497ba5b8ff66856e13100160275ddc4a884db0 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 17 Feb 2010 17:33:26 -0800 Subject: Added i2c control transactions in fw and host --- firmware/microblaze/apps/txrx.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'firmware/microblaze') 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 #include "usrp2/fw_common.h" #include +#include #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; -- cgit v1.2.3