diff options
author | Alex Williams <alex.williams@ni.com> | 2018-11-12 11:16:31 -0800 |
---|---|---|
committer | Brent Stapleton <bstapleton@g.hmc.edu> | 2018-11-12 16:04:08 -0800 |
commit | d70298dcb5ef5e9669999913d5b74af74d5db3b7 (patch) | |
tree | ba9ac2fde1a0ab886ab5ca1b4be0d82a907c1272 /mpm/include | |
parent | 4a6b623b5c8e0d0d12fe7d6eb43ed6bb31f341af (diff) | |
download | uhd-d70298dcb5ef5e9669999913d5b74af74d5db3b7.tar.gz uhd-d70298dcb5ef5e9669999913d5b74af74d5db3b7.tar.bz2 uhd-d70298dcb5ef5e9669999913d5b74af74d5db3b7.zip |
mpm: i2c: Open and close i2c file descriptor on every access
This will release the i2c device when it's not in use. If MPM hangs on
to the i2c devices, we won't be able to cleanly change FPGA images--The
kernel hangs up the process until the refcount drops to zero.
Diffstat (limited to 'mpm/include')
-rw-r--r-- | mpm/include/mpm/i2c/i2c_iface.hpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mpm/include/mpm/i2c/i2c_iface.hpp b/mpm/include/mpm/i2c/i2c_iface.hpp index aca5994b1..e3fe9e8ed 100644 --- a/mpm/include/mpm/i2c/i2c_iface.hpp +++ b/mpm/include/mpm/i2c/i2c_iface.hpp @@ -38,19 +38,23 @@ namespace mpm { namespace i2c { * \param tx_len Size (in bytes) of TX buffer * \param rx Buffer to hold read data * \param rx_len Number of bytes to read + * \param do_close If true, close file descriptor at end of function */ - virtual int transfer(uint8_t *tx, size_t tx_len, uint8_t *rx, size_t rx_len) = 0; + virtual int transfer(uint8_t *tx, size_t tx_len, uint8_t *rx, + size_t rx_len, bool do_close = true) = 0; /*! * \param tx Buffer of data to send * \param rx Buffer to hold read data + * \param do_close If true, close file descriptor at end of function * * All data in tx will be transmitted. * The amount of data read will be determined by the number of elements * in the rx vector. Those elements will be overwritten with the data. * Use the resize() function for a new rx vector. */ - virtual int transfer(std::vector<uint8_t> *tx, std::vector<uint8_t> *rx) = 0; + virtual int transfer(std::vector<uint8_t> *tx, std::vector<uint8_t> *rx, + bool do_close = true) = 0; }; }}; /* namespace mpm::i2c */ |