aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard/interface.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-02-17 16:23:12 -0800
committerJosh Blum <josh@joshknows.com>2010-02-17 16:23:12 -0800
commit4fb4572e1a16f54439f57655f90e0fc937c57c1e (patch)
tree5dc731d266c8f5f783c5b28996a1583dac18ab57 /host/lib/usrp/dboard/interface.cpp
parenteb7e709b7aff162cc7c8f9b8004089846839ffbe (diff)
downloaduhd-4fb4572e1a16f54439f57655f90e0fc937c57c1e.tar.gz
uhd-4fb4572e1a16f54439f57655f90e0fc937c57c1e.tar.bz2
uhd-4fb4572e1a16f54439f57655f90e0fc937c57c1e.zip
Worked out spi api for the dboard interface.
Created usrp2 spi transaction control on host and fw
Diffstat (limited to 'host/lib/usrp/dboard/interface.cpp')
-rw-r--r--host/lib/usrp/dboard/interface.cpp26
1 files changed, 26 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
+}