diff options
Diffstat (limited to 'host/include')
| -rw-r--r-- | host/include/uhd/types/serial.hpp | 61 | 
1 files changed, 61 insertions, 0 deletions
| diff --git a/host/include/uhd/types/serial.hpp b/host/include/uhd/types/serial.hpp index b0fe5d7bd..c134725f5 100644 --- a/host/include/uhd/types/serial.hpp +++ b/host/include/uhd/types/serial.hpp @@ -30,6 +30,67 @@ namespace uhd{      typedef std::vector<boost::uint8_t> byte_vector_t;      /*! +     * The i2c interface class: +     * Provides i2c and eeprom functionality. +     * A subclass should only have to implement the i2c routines. +     * An eeprom implementation comes for free with the interface. +     * +     * The eeprom routines are implemented on top of i2c. +     * The built in eeprom implementation only does single +     * byte reads and byte writes over the i2c interface, +     * so it should be portable across multiple eeproms. +     * Override the eeprom routines if this is not acceptable. +     */ +    class UHD_API i2c_iface{ +    public: +        /*! +         * Write bytes over the i2c. +         * \param addr the address +         * \param buf the vector of bytes +         */ +        virtual void write_i2c( +            boost::uint8_t addr, +            const byte_vector_t &buf +        ) = 0; + +        /*! +         * Read bytes over the i2c. +         * \param addr the address +         * \param num_bytes number of bytes to read +         * \return a vector of bytes +         */ +        virtual byte_vector_t read_i2c( +            boost::uint8_t addr, +            size_t num_bytes +        ) = 0; + +        /*! +         * Write bytes to an eeprom. +         * \param addr the address +         * \param offset byte offset +         * \param buf the vector of bytes +         */ +        virtual void write_eeprom( +            boost::uint8_t addr, +            boost::uint8_t offset, +            const byte_vector_t &buf +        ); + +        /*! +         * Read bytes from an eeprom. +         * \param addr the address +         * \param offset byte offset +         * \param num_bytes number of bytes to read +         * \return a vector of bytes +         */ +        virtual byte_vector_t read_eeprom( +            boost::uint8_t addr, +            boost::uint8_t offset, +            size_t num_bytes +        ); +    }; + +    /*!       * The SPI configuration struct:       * Used to configure a SPI transaction interface.       */ | 
