aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/microblaze/apps/txrx_uhd.c
diff options
context:
space:
mode:
authorNick Foster <nick@nerdnetworks.org>2010-08-11 13:42:03 -0700
committerNick Foster <nick@nerdnetworks.org>2010-08-16 17:29:40 -0700
commitecc971c613d4a7dfe31bc142f99bfdba898d91eb (patch)
tree9eb42726e99b8885e5a1fcb82c1731439db48439 /firmware/microblaze/apps/txrx_uhd.c
parent20d1f96f9594e299f8aef78cc70a587d1d87e289 (diff)
downloaduhd-ecc971c613d4a7dfe31bc142f99bfdba898d91eb.tar.gz
uhd-ecc971c613d4a7dfe31bc142f99bfdba898d91eb.tar.bz2
uhd-ecc971c613d4a7dfe31bc142f99bfdba898d91eb.zip
IRQ-based SPI works. Don't try to do multiple transactions without waiting for results first. In fact, don't try to do
an I2C transaction while an SPI transaction is pending.
Diffstat (limited to 'firmware/microblaze/apps/txrx_uhd.c')
-rw-r--r--firmware/microblaze/apps/txrx_uhd.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/firmware/microblaze/apps/txrx_uhd.c b/firmware/microblaze/apps/txrx_uhd.c
index 6fb01fec2..1dd6e80ac 100644
--- a/firmware/microblaze/apps/txrx_uhd.c
+++ b/firmware/microblaze/apps/txrx_uhd.c
@@ -194,7 +194,7 @@ void i2c_write_done_callback(void) {
static volatile bool spi_done = false;
static volatile uint32_t spi_readback_data;
void get_spi_readback_data(void) {
- spi_readback_data = spi_get_data();
+ ctrl_data_out.data.spi_args.data = spi_get_data();
spi_done = true;
spi_register_callback(0);
}
@@ -245,8 +245,6 @@ void handle_udp_ctrl_packet(
******************************************************************/
case USRP2_CTRL_ID_TRANSACT_ME_SOME_SPI_BRO:{
//transact
- uint32_t result;
- void (*volatile spicall)(void) = (ctrl_data_in->data.spi_args.readback == 0) ? 0 : get_spi_readback_data; //only need a callback if we're doing readback
bool success = spi_async_transact(
//(ctrl_data_in->data.spi_args.readback == 0)? SPI_TXONLY : SPI_TXRX,
ctrl_data_in->data.spi_args.dev, //which device
@@ -254,11 +252,10 @@ void handle_udp_ctrl_packet(
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 | //flags
(ctrl_data_in->data.spi_args.miso_edge == USRP2_CLK_EDGE_RISE)? SPIF_LATCH_RISE : SPIF_LATCH_FALL,
- spicall //callback
+ get_spi_readback_data //callback
);
//load output
- ctrl_data_out.data.spi_args.data = result;
ctrl_data_out.id = USRP2_CTRL_ID_OMG_TRANSACTED_SPI_DUDE;
spi_src = src;
}