remove e4k-specific I2C functions from library

Signed-off-by: Steve Markgraf <steve@steve-m.de>
This commit is contained in:
Steve Markgraf 2013-11-04 21:53:41 +01:00
parent aefd8b7d58
commit 015c78a4ca
3 changed files with 17 additions and 22 deletions

View File

@ -212,9 +212,6 @@ int e4k_if_filter_bw_set(struct e4k_state *e4k, enum e4k_if_filter filter,
int e4k_if_filter_chan_enable(struct e4k_state *e4k, int on); int e4k_if_filter_chan_enable(struct e4k_state *e4k, int on);
int e4k_rf_filter_set(struct e4k_state *e4k); int e4k_rf_filter_set(struct e4k_state *e4k);
int e4k_reg_write(struct e4k_state *e4k, uint8_t reg, uint8_t val);
uint8_t e4k_reg_read(struct e4k_state *e4k, uint8_t reg);
int e4k_manual_dc_offset(struct e4k_state *e4k, int8_t iofs, int8_t irange, int8_t qofs, int8_t qrange); int e4k_manual_dc_offset(struct e4k_state *e4k, int8_t iofs, int8_t irange, int8_t qofs, int8_t qrange);
int e4k_dc_offset_calibrate(struct e4k_state *e4k); int e4k_dc_offset_calibrate(struct e4k_state *e4k);
int e4k_dc_offset_gen_table(struct e4k_state *e4k); int e4k_dc_offset_gen_table(struct e4k_state *e4k);

View File

@ -403,17 +403,6 @@ uint8_t rtlsdr_i2c_read_reg(rtlsdr_dev_t *dev, uint8_t i2c_addr, uint8_t reg)
return data; return data;
} }
/* TODO clean this up again */
int e4k_reg_write(struct e4k_state *e4k, uint8_t reg, uint8_t val)
{
return rtlsdr_i2c_write_reg((rtlsdr_dev_t*)e4k->rtl_dev, e4k->i2c_addr, reg, val);
}
uint8_t e4k_reg_read(struct e4k_state *e4k, uint8_t reg)
{
return rtlsdr_i2c_read_reg((rtlsdr_dev_t*)e4k->rtl_dev, e4k->i2c_addr, reg);
}
int rtlsdr_i2c_write(rtlsdr_dev_t *dev, uint8_t i2c_addr, uint8_t *buffer, int len) int rtlsdr_i2c_write(rtlsdr_dev_t *dev, uint8_t i2c_addr, uint8_t *buffer, int len)
{ {
uint16_t addr = i2c_addr; uint16_t addr = i2c_addr;

View File

@ -29,6 +29,7 @@
#include <reg_field.h> #include <reg_field.h>
#include <tuner_e4k.h> #include <tuner_e4k.h>
#include <rtlsdr_i2c.h>
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
@ -55,17 +56,19 @@ static const uint8_t width2mask[] = {
/*********************************************************************** /***********************************************************************
* Register Access */ * Register Access */
#if 0
/*! \brief Write a register of the tuner chip /*! \brief Write a register of the tuner chip
* \param[in] e4k reference to the tuner * \param[in] e4k reference to the tuner
* \param[in] reg number of the register * \param[in] reg number of the register
* \param[in] val value to be written * \param[in] val value to be written
* \returns 0 on success, negative in case of error * \returns 0 on success, negative in case of error
*/ */
int e4k_reg_write(struct e4k_state *e4k, uint8_t reg, uint8_t val) static int e4k_reg_write(struct e4k_state *e4k, uint8_t reg, uint8_t val)
{ {
/* FIXME */ uint8_t data[2];
return 0; data[0] = reg;
data[1] = val;
return rtlsdr_i2c_write_fn(e4k->rtl_dev, e4k->i2c_addr, data, 2);
} }
/*! \brief Read a register of the tuner chip /*! \brief Read a register of the tuner chip
@ -73,12 +76,18 @@ int e4k_reg_write(struct e4k_state *e4k, uint8_t reg, uint8_t val)
* \param[in] reg number of the register * \param[in] reg number of the register
* \returns positive 8bit register contents on success, negative in case of error * \returns positive 8bit register contents on success, negative in case of error
*/ */
int e4k_reg_read(struct e4k_state *e4k, uint8_t reg) static int e4k_reg_read(struct e4k_state *e4k, uint8_t reg)
{ {
/* FIXME */ uint8_t data = reg;
return 0;
if (rtlsdr_i2c_write_fn(e4k->rtl_dev, e4k->i2c_addr, &data, 1) < 1)
return -1;
if (rtlsdr_i2c_read_fn(e4k->rtl_dev, e4k->i2c_addr, &data, 1) < 1)
return -1;
return data;
} }
#endif
/*! \brief Set or clear some (masked) bits inside a register /*! \brief Set or clear some (masked) bits inside a register
* \param[in] e4k reference to the tuner * \param[in] e4k reference to the tuner