diff options
Diffstat (limited to 'host/lib/usrp/dboard')
-rw-r--r-- | host/lib/usrp/dboard/interface.cpp | 26 | ||||
-rw-r--r-- | host/lib/usrp/dboard/manager.cpp | 12 |
2 files changed, 38 insertions, 0 deletions
diff --git a/host/lib/usrp/dboard/interface.cpp b/host/lib/usrp/dboard/interface.cpp index 837c76d0a..b8f6724ba 100644 --- a/host/lib/usrp/dboard/interface.cpp +++ b/host/lib/usrp/dboard/interface.cpp @@ -26,3 +26,29 @@ interface::interface(void){ interface::~interface(void){ /* NOP */ } + +void interface::write_spi( + spi_dev_t dev, + spi_push_t push, + const byte_vector_t &buf +){ + transact_spi(dev, SPI_LATCH_RISE, push, buf, false); //dont readback +} + +interface::byte_vector_t interface::read_spi( + spi_dev_t dev, + spi_latch_t latch, + size_t num_bytes +){ + byte_vector_t buf(num_bytes, 0x00); //dummy data + return transact_spi(dev, latch, SPI_PUSH_RISE, buf, true); //readback +} + +interface::byte_vector_t interface::read_write_spi( + spi_dev_t dev, + spi_latch_t latch, + spi_push_t push, + const byte_vector_t &buf +){ + return transact_spi(dev, latch, push, buf, true); //readback +} diff --git a/host/lib/usrp/dboard/manager.cpp b/host/lib/usrp/dboard/manager.cpp index 4a675fd0b..3540cd1bc 100644 --- a/host/lib/usrp/dboard/manager.cpp +++ b/host/lib/usrp/dboard/manager.cpp @@ -135,6 +135,17 @@ manager::manager( register_internal_dboards(); //always call first const dboard_ctor_t rx_dboard_ctor = get_dboard_ctor(rx_dboard_id, "rx"); const dboard_ctor_t tx_dboard_ctor = get_dboard_ctor(tx_dboard_id, "tx"); + + //initialize the gpio pins before creating subdevs + dboard_interface->set_gpio_ddr(interface::GPIO_RX_BANK, 0x0000, 0xffff); //all inputs + dboard_interface->set_gpio_ddr(interface::GPIO_TX_BANK, 0x0000, 0xffff); + + dboard_interface->write_gpio(interface::GPIO_RX_BANK, 0x0000, 0xffff); //all zeros + dboard_interface->write_gpio(interface::GPIO_TX_BANK, 0x0000, 0xffff); + + dboard_interface->set_atr_reg(interface::GPIO_RX_BANK, 0x0000, 0x0000, 0x0000); //software controlled + dboard_interface->set_atr_reg(interface::GPIO_TX_BANK, 0x0000, 0x0000, 0x0000); + //make xcvr subdevs (make one subdev for both rx and tx dboards) if (rx_dboard_ctor == tx_dboard_ctor){ BOOST_FOREACH(std::string name, ctor_to_names_map[rx_dboard_ctor]){ @@ -151,6 +162,7 @@ manager::manager( ); } } + //make tx and rx subdevs (separate subdevs for rx and tx dboards) else{ //make the rx subdevs |