diff options
author | Josh Blum <josh@joshknows.com> | 2013-07-24 17:46:04 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2013-07-24 17:46:04 -0700 |
commit | 0aeac60394420de1952ebc230a6fa2f8593df80a (patch) | |
tree | f08d6ca1555dc2df15a79c3da6d32cad9a6224d7 /host/lib/usrp/cores | |
parent | 690637f78685b2979a9f128ce3c82149b5421c46 (diff) | |
download | uhd-0aeac60394420de1952ebc230a6fa2f8593df80a.tar.gz uhd-0aeac60394420de1952ebc230a6fa2f8593df80a.tar.bz2 uhd-0aeac60394420de1952ebc230a6fa2f8593df80a.zip |
uhd: allow for 16 bit i2c and eeprom addrs
Diffstat (limited to 'host/lib/usrp/cores')
-rw-r--r-- | host/lib/usrp/cores/i2c_core_100.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/cores/i2c_core_100_wb32.cpp | 12 | ||||
-rw-r--r-- | host/lib/usrp/cores/i2c_core_200.cpp | 4 |
3 files changed, 14 insertions, 6 deletions
diff --git a/host/lib/usrp/cores/i2c_core_100.cpp b/host/lib/usrp/cores/i2c_core_100.cpp index ceeb3f518..9e8a226f2 100644 --- a/host/lib/usrp/cores/i2c_core_100.cpp +++ b/host/lib/usrp/cores/i2c_core_100.cpp @@ -70,7 +70,7 @@ public: } void write_i2c( - boost::uint8_t addr, + boost::uint16_t addr, const byte_vector_t &bytes ){ _iface->poke16(REG_I2C_DATA, (addr << 1) | 0); //addr and read bit (0) @@ -93,7 +93,7 @@ public: } byte_vector_t read_i2c( - boost::uint8_t addr, + boost::uint16_t addr, size_t num_bytes ){ byte_vector_t bytes; diff --git a/host/lib/usrp/cores/i2c_core_100_wb32.cpp b/host/lib/usrp/cores/i2c_core_100_wb32.cpp index b38d5b4bc..df6e6ff72 100644 --- a/host/lib/usrp/cores/i2c_core_100_wb32.cpp +++ b/host/lib/usrp/cores/i2c_core_100_wb32.cpp @@ -72,7 +72,7 @@ public: } void write_i2c( - boost::uint8_t addr, + boost::uint16_t addr, const byte_vector_t &bytes ){ _iface->poke32(REG_I2C_DATA, (addr << 1) | 0); //addr and read bit (0) @@ -95,7 +95,7 @@ public: } byte_vector_t read_i2c( - boost::uint8_t addr, + boost::uint16_t addr, size_t num_bytes ){ byte_vector_t bytes; @@ -119,6 +119,14 @@ public: return bytes; } + //override read_eeprom so we can write once, read all N bytes + //the default implementation calls read i2c once per byte + byte_vector_t read_eeprom(boost::uint16_t addr, boost::uint16_t offset, size_t num_bytes) + { + this->write_i2c(addr, byte_vector_t(1, offset)); + return this->read_i2c(addr, num_bytes); + } + private: void i2c_wait(void) { for (size_t i = 0; i < 10; i++) diff --git a/host/lib/usrp/cores/i2c_core_200.cpp b/host/lib/usrp/cores/i2c_core_200.cpp index 1b882c54a..6010ac5a2 100644 --- a/host/lib/usrp/cores/i2c_core_200.cpp +++ b/host/lib/usrp/cores/i2c_core_200.cpp @@ -73,7 +73,7 @@ public: } void write_i2c( - boost::uint8_t addr, + boost::uint16_t addr, const byte_vector_t &bytes ){ this->poke(REG_I2C_WR_DATA, (addr << 1) | 0); //addr and read bit (0) @@ -96,7 +96,7 @@ public: } byte_vector_t read_i2c( - boost::uint8_t addr, + boost::uint16_t addr, size_t num_bytes ){ byte_vector_t bytes; |