summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-04-12 15:19:25 -0700
committerJosh Blum <josh@joshknows.com>2010-04-12 15:19:25 -0700
commitb87d9afe82e962718f5f5d514abf9d79b9603b98 (patch)
treecaa53a69eaa9847994737748c1385a2dfd3153f8 /firmware
parent24ca9fbd0784c7c53af6ad4f9035e8d43e888290 (diff)
parentfa96b25b99dbd19ac0689cab9bcab84063287ad3 (diff)
downloaduhd-b87d9afe82e962718f5f5d514abf9d79b9603b98.tar.gz
uhd-b87d9afe82e962718f5f5d514abf9d79b9603b98.tar.bz2
uhd-b87d9afe82e962718f5f5d514abf9d79b9603b98.zip
Merge branch 'rfx' of git@ettus.sourcerepo.com:ettus/uhd into io
Conflicts: host/lib/usrp/usrp2/io_impl.cpp
Diffstat (limited to 'firmware')
-rw-r--r--firmware/microblaze/apps/txrx.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/firmware/microblaze/apps/txrx.c b/firmware/microblaze/apps/txrx.c
index 69a04d771..561f3148f 100644
--- a/firmware/microblaze/apps/txrx.c
+++ b/firmware/microblaze/apps/txrx.c
@@ -253,29 +253,18 @@ void handle_udp_ctrl_packet(
* SPI
******************************************************************/
case USRP2_CTRL_ID_TRANSACT_ME_SOME_SPI_BRO:{
- uint8_t num_bytes = ctrl_data_in->data.spi_args.bytes;
-
- //load the data from the array of bytes
- uint32_t data = 0x0;
- for (size_t i = 0; i < num_bytes; i++){
- data = (data << 8) | ctrl_data_in->data.spi_args.data[i];
- }
-
//transact
uint32_t result = spi_transact(
(ctrl_data_in->data.spi_args.readback == 0)? SPI_TXONLY : SPI_TXRX,
- ctrl_data_in->data.spi_args.dev,
- data, num_bytes*8, //length in bits
- (ctrl_data_in->data.spi_args.edge == USRP2_CLK_EDGE_RISE)? SPIF_PUSH_RISE : SPIF_PUSH_FALL |
- (ctrl_data_in->data.spi_args.edge == USRP2_CLK_EDGE_RISE)? SPIF_LATCH_RISE : SPIF_LATCH_FALL
+ ctrl_data_in->data.spi_args.dev, //which device
+ ctrl_data_in->data.spi_args.data, //32 bit data
+ ctrl_data_in->data.spi_args.num_bits, //length in bits
+ (ctrl_data_in->data.spi_args.mosi_edge == USRP2_CLK_EDGE_RISE)? SPIF_PUSH_FALL : SPIF_PUSH_RISE |
+ (ctrl_data_in->data.spi_args.miso_edge == USRP2_CLK_EDGE_RISE)? SPIF_LATCH_RISE : SPIF_LATCH_FALL
);
- //load the result into the array of bytes
- for (size_t i = 0; i < num_bytes; i++){
- uint8_t byte_shift = num_bytes - i - 1;
- ctrl_data_out.data.spi_args.data[i] = (result >> (byte_shift*8)) & 0xff;
- }
- ctrl_data_out.data.spi_args.bytes = num_bytes;
+ //load output
+ ctrl_data_out.data.spi_args.data = result;
ctrl_data_out.id = USRP2_CTRL_ID_OMG_TRANSACTED_SPI_DUDE;
}
break;