diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-03-23 00:03:29 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-03-23 00:03:29 +0100 |
commit | 2cf0eaffddab2457fc81d672599c0f58eb6950f9 (patch) | |
tree | f1964cdc4d9a4f7ff8ffa15b2a359cdad55a58d8 /include/osmo-fl2k.h | |
parent | eb11e68412b49b0945ab6bb332ac9486f1ebeb9e (diff) | |
parent | df33203db5007218384e6724748be52a1d4fdb25 (diff) | |
download | osmo-fl2k-2cf0eaffddab2457fc81d672599c0f58eb6950f9.tar.gz osmo-fl2k-2cf0eaffddab2457fc81d672599c0f58eb6950f9.tar.bz2 osmo-fl2k-2cf0eaffddab2457fc81d672599c0f58eb6950f9.zip |
Merge remote-tracking branch 'upstream/master' into interleaved_rg
Diffstat (limited to 'include/osmo-fl2k.h')
-rw-r--r-- | include/osmo-fl2k.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/include/osmo-fl2k.h b/include/osmo-fl2k.h index 6a1b3ee..aefbb8c 100644 --- a/include/osmo-fl2k.h +++ b/include/osmo-fl2k.h @@ -37,6 +37,7 @@ enum fl2k_error { FL2K_ERROR_NO_DEVICE = -2, FL2K_ERROR_NOT_FOUND = -5, FL2K_ERROR_BUSY = -6, + FL2K_ERROR_TIMEOUT = -7, FL2K_ERROR_NO_MEM = -11, }; @@ -124,6 +125,40 @@ FL2K_API int fl2k_start_tx(fl2k_dev_t *dev, fl2k_tx_cb_t cb, */ FL2K_API int fl2k_stop_tx(fl2k_dev_t *dev); +/*! + * Read 4 bytes via the FL2K I2C bus + * + * \param dev the device handle given by fl2k_open() + * \param i2c_addr address of the I2C device + * \param reg_addr start address of the 4 bytes to be read + * \param data pointer to byte array of size 4 + * \return 0 on success + * \note A read operation will look like this on the bus: + * START, I2C_ADDR(W), REG_ADDR, REP_START, I2C_ADDR(R), DATA[0], STOP + * START, I2C_ADDR(W), REG_ADDR+1, REP_START, I2C_ADDR(R), DATA[1], STOP + * START, I2C_ADDR(W), REG_ADDR+2, REP_START, I2C_ADDR(R), DATA[2], STOP + * START, I2C_ADDR(W), REG_ADDR+3, REP_START, I2C_ADDR(R), DATA[3], STOP + */ +FL2K_API int fl2k_i2c_read(fl2k_dev_t *dev, uint8_t i2c_addr, + uint8_t reg_addr, uint8_t *data); + +/*! + * Write 4 bytes via the FL2K I2C bus + * + * \param dev the device handle given by fl2k_open() + * \param i2c_addr address of the I2C device + * \param reg_addr start address of the 4 bytes to be written + * \param data pointer to byte array of size 4 + * \return 0 on success + * \note A write operation will look like this on the bus: + * START, I2C_ADDR(W), REG_ADDR, DATA[0], STOP + * START, I2C_ADDR(W), REG_ADDR+1, DATA[1], STOP + * START, I2C_ADDR(W), REG_ADDR+2, DATA[2], STOP + * START, I2C_ADDR(W), REG_ADDR+3, DATA[3], STOP + */ +FL2K_API int fl2k_i2c_write(fl2k_dev_t *dev, uint8_t i2c_addr, + uint8_t reg_addr, uint8_t *data); + #ifdef __cplusplus } #endif |