diff options
author | Oliver Schinagl <oliver@schinagl.nl> | 2011-06-28 13:40:27 (GMT) |
---|---|---|
committer | Oliver Schinagl <oliver@schinagl.nl> | 2011-06-28 13:40:27 (GMT) |
commit | fecdd9457cd3912c2b89aff1f99db0ba669af93b (patch) | |
tree | 34bbc7387ded825e303c3117b6c6da2cbe1fd771 /api/i2c_driver.c | |
download | AF903x_SRC-fecdd9457cd3912c2b89aff1f99db0ba669af93b.zip AF903x_SRC-fecdd9457cd3912c2b89aff1f99db0ba669af93b.tar.gz AF903x_SRC-fecdd9457cd3912c2b89aff1f99db0ba669af93b.tar.bz2 |
Initial checkin' of sourceball extracted from installer.
DRIVER_RELEASE_VERSION : v9.08.14.1
FW_RELEASE_VERSION : v8_8_63_0
API_RELEASE_VERSION : 200.20090402.0
Not sure what those version numbers relate to.
Might be Driver, the actual driver (src)
FW, the little bin file that is only a keymapping for the remote
API, all the tuners or so from /api?
No support for Asus U3100
mini (yet).
Diffstat (limited to 'api/i2c_driver.c')
-rw-r--r-- | api/i2c_driver.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/api/i2c_driver.c b/api/i2c_driver.c new file mode 100644 index 0000000..5c5460d --- /dev/null +++ b/api/i2c_driver.c @@ -0,0 +1,65 @@ +//--------------------------------------------------------------------------- +#include "xc4000_control.h" +#include "i2c_driver.h" +#include "type.h" +#include "error.h" +#include "user.h" +#include "register.h" +#include "standard.h" +//--------------------------------------------------------------------------- +Demodulator* XC4000Handle = NULL; +Byte XC4000Chip = 0; + +/* *************************************************************** */ +/* *************************************************************** */ +/* */ +/* FOLLOWING FUNCTIONS TO BE IMPLEMENTED BY CUSTOMER */ +/* */ +/* *************************************************************** */ +/* *************************************************************** */ + +// user must replace the following routines with their own i2c driver +// return XC_RESULT_SUCCESS if i2c data is send correctly, +// return XC_RESULT_I2C_WRITE_FAILURE when error occur. +int xc_send_i2c_data(unsigned char *bytes_to_send, int nb_bytes_to_send) +{ + Dword error = Error_NO_ERROR; + + error = Standard_writeTunerRegisters (XC4000Handle, XC4000Chip, 0x0000, nb_bytes_to_send, bytes_to_send); + return (error); +} + +int xc_read_i2c_data(unsigned char *bytes_received, int nb_bytes_to_receive) +{ + Dword error = Error_NO_ERROR; + + error = Standard_readTunerRegisters (XC4000Handle, XC4000Chip, 0x0000, nb_bytes_to_receive, bytes_received); + return (error); +} + +int xc_reset() +{ + Dword error = Error_NO_ERROR; + + error = Standard_writeRegisterBits (XC4000Handle, XC4000Chip, Processor_LINK, p_reg_top_gpiot2_o, reg_top_gpiot2_o_pos, reg_top_gpiot2_o_len, 0); + if (error) goto exit; + + error = Standard_writeRegisterBits (XC4000Handle, XC4000Chip, Processor_LINK, p_reg_top_gpiot2_en, reg_top_gpiot2_en_pos, reg_top_gpiot2_en_len, 1); + if (error) goto exit; + + error = Standard_writeRegisterBits (XC4000Handle, XC4000Chip, Processor_LINK, p_reg_top_gpiot2_on, reg_top_gpiot2_on_pos, reg_top_gpiot2_on_len, 1); + if (error) goto exit; + + User_delay (XC4000Handle, 250); + + error = Standard_writeRegisterBits (XC4000Handle, XC4000Chip, Processor_LINK, p_reg_top_gpiot2_o, reg_top_gpiot2_o_pos, reg_top_gpiot2_o_len, 1); + if (error) goto exit; + +exit: + return (error); +} + +void xc_wait(int wait_ms) +{ + User_delay (XC4000Handle, (Dword)wait_ms); +} |