Files | |
file | analog.c |
file | analog.h |
file | digital.c |
file | digital.h |
file | i2cd.h |
file | i2cd.h |
Compounds | |
struct | i2c |
i2c bus controller structure. More... | |
struct | _I2C_ad_datas |
i2c a/d data structure. More... | |
struct | _I2C_bin_datas |
I2C digital datastructure. More... | |
struct | i2cmess |
I2C message structure. More... | |
Functions | |
int | I2C_ConfigureAnalog (int chip, char how) |
configure the a/d function of one PCF8591 chip. More... | |
int | I2C_WriteAnalogOut (int chip, int value) |
sets the D/A output channel of a PCF8591 chip. More... | |
int | I2C_init_analog () |
configure all PCF8591 A/D-D/A devices. More... | |
unsigned char | I2C_ReadBinIn (int chip) |
read the binary input on a PCF8574(A) device. More... | |
int | I2C_init_digital () |
initializes all PCF8574 devices in the system. More... | |
void | GenerateStop (struct i2c *p, unsigned char mess) |
I2C driver internal function. More... | |
void | _I2C_master_handler (struct i2c *p) |
internal I2C master queue handler. More... | |
void | _I2C_slave_handler (struct i2c *p) |
internal I2C slave handler. More... | |
void | I2C_inthandler (unsigned long minor) |
internal I2C interrupt handler. More... | |
int | I2C_init (int which, unsigned long ioaddr) |
Initialize I2C. More... | |
int | I2C_Start_I2C_Transfer (unsigned char which, struct i2cmess *msg) |
initiate an I2C transfer. More... | |
int | I2C_slprocess (unsigned char which, struct i2cmess *msg) |
process I2C slave message. More... | |
int | I2C_process (unsigned char whichBus, unsigned char whichQueue, struct i2cmess *msg) |
generic I2C processing function. More... | |
int | I2C_messagestatus (struct i2cmess *msg) |
check the message status of an I2C message. More... | |
int | I2C_scanbus (unsigned char bus) |
scan the I2C bus for devices. More... | |
Variables | |
_I2C_ad_datas | _I2C_ad_data [16] |
keeps information about the PCF8591 A/D - D/A converters in the system. More... | |
_I2C_bin_datas | _I2C_bin_data [32] |
keeps the internal data for all PCF8574(A) bin i/o devices. More... |
|
internal I2C master queue handler.
Definition at line 62 of file i2cd.c. References ACK, i2cmess::address, BB, i2cmess::buf, i2c_device::control, i2c_device::data, dummy, ENI, ESO, GenerateStop, I2C_ARBITRATION_LOST, I2C_ERR, I2C_MASTER_MODE, I2C_NACK_ON_ADDRESS, I2C_NACK_ON_DATA, I2C_OK, I2C_SLAVE_MODE, I2C_TIME_OUT, I2C_TIMEOUT_VAL, i2c::ioaddr, LAB, LRB, i2c::m_buff, i2c::m_dcnt, i2c::m_state, i2c::m_tail, MASTER_IDLE, MASTER_RECV, MASTER_RECV_LAST, MASTER_SEND, MASTER_WAIT_ACK, i2c::mode, i2cmess::nrBytes, PIN, i2c::s_state_handler, STA, and STO. Referenced by I2C_init. |
|
internal I2C slave handler.
Definition at line 152 of file i2cd.c. References AAS, ACK, i2c_device::control, i2c_device::data, ENI, ESO, I2C_SLAVE_ERR, I2C_SLAVE_IBUF_OVERFLOW, I2C_SLAVE_OBUF_EMPTY, i2c::ioaddr, LRB, PIN, i2c::s_ibuff, i2c::s_icnt, i2c::s_iptr, i2c::s_isem, i2c::s_obuff, i2c::s_ocnt, i2c::s_optr, i2c::s_osem, i2c::s_state, i2c::s_status, SBUFLEN, SLAVE_IDLE, SLAVE_RECV, SLAVE_SEND, ssem_signal, and STS. Referenced by I2C_init. |
|
I2C driver internal function.
Definition at line 38 of file i2cd.c. References I2C_SLAVE_MODE, i2c::m_buff, i2c::m_cnt, i2c::m_dcnt, i2c::m_sem, i2c::m_state, i2c::m_state_handler, i2c::m_tail, MASTER_IDLE, MBUFLEN, i2c::mode, and ssem_signal. Referenced by _I2C_master_handler. |
|
configure the a/d function of one PCF8591 chip.
Definition at line 77 of file analog.c. References _I2C_analog_mbuf, _I2C_ad_datas::active, _I2C_ad_datas::address, i2cmess::address, i2cmess::buf, I2C_MASTER, I2C_OK, I2C_process, i2cmess::nrBytes, i2cmess::status, and _I2C_ad_datas::status. |
|
Initialize I2C.
Definition at line 237 of file i2cd.c. References _I2C_master_handler, _I2C_slave_handler, _KERN_IVTab_setvector, ACK, i2c_device::control, i2c_device::data, ENI, ESO, I2C_int_a, I2C_int_b, I2C_SLAVE_MODE, I2C_SPEED, I2CA, I2CA_SLAVE_ADDR, I2CB, I2CB_SLAVE_ADDR, i2c::ioaddr, i2c::m_cnt, i2c::m_dcnt, i2c::m_head, i2c::m_sem, i2c::m_state, i2c::m_state_handler, i2c::m_tail, MASTER_IDLE, MBUFLEN, i2c::mode, PIN, readshort, i2c::s_icnt, i2c::s_iptr, i2c::s_isem, i2c::s_ocnt, i2c::s_optr, i2c::s_osem, i2c::s_state, i2c::s_state_handler, i2c::s_status, SIM_CSBAR3, SIM_CSBAR4, SIM_CSOR3, SIM_CSOR4, SIM_CSPAR0, SLAVE_IDLE, and writeshort. |
|
configure all PCF8591 A/D-D/A devices. This function looks for PCF8591 devices on all I2C channels, configures the devices as 4 times single-ended and lists all of them in an internal table. The devices get increasing device IDs from 0 to 15 depending on their bus address. Definition at line 129 of file analog.c. References _I2C_adnum, _I2C_analog_mbuf, _I2C_ad_datas::active, i2cmess::address, i2cmess::buf, I2C_MASTER, I2C_messagestatus, I2C_NACK_ON_ADDRESS, I2C_NO_BUS, I2C_OK, I2C_process, I2C_TIME_OUT, I2CA, I2CB, i2cmess::nrBytes, and i2cmess::status. |
|
initializes all PCF8574 devices in the system. This function scanns all I2C busses for PCF8574 and PCF8574A devices. It first looks for PCF8574 (device address 0x4x), then for PCF8574A (device address 0x7x) on the first, then on the second I2C bus. Devices found get assigned an ID from 0 to 31. Definition at line 87 of file digital.c. References _I2C_binnum, _I2C_digital_mbuf, _I2C_bin_datas::active, i2cmess::address, i2cmess::buf, I2C_MASTER, I2C_messagestatus, I2C_NACK_ON_ADDRESS, I2C_NO_BUS, I2C_OK, I2C_process, I2C_TIME_OUT, I2CA, I2CB, i2cmess::nrBytes, and i2cmess::status. |
|
internal I2C interrupt handler.
Definition at line 220 of file i2cd.c. References I2C_MASTER_MODE, i2c::m_state_handler, i2c::mode, and i2c::s_state_handler. |
|
check the message status of an I2C message.
Definition at line 474 of file i2cd.c. References I2C_ARBITRATION_LOST, I2C_ERR, I2C_NACK_ON_ADDRESS, I2C_NACK_ON_DATA, I2C_NO_BUS, I2C_OK, I2C_TIME_OUT, and i2cmess::status. |
|
generic I2C processing function.
Definition at line 457 of file i2cd.c. References I2C_MASTER, I2C_slprocess, and I2C_Start_I2C_Transfer. |
|
read the binary input on a PCF8574(A) device.
Definition at line 41 of file digital.c. References _I2C_digital_mbuf, _I2C_bin_datas::active, _I2C_bin_datas::address, i2cmess::address, i2cmess::buf, I2C_MASTER, I2C_process, and i2cmess::nrBytes. |
|
scan the I2C bus for devices.
Definition at line 517 of file i2cd.c. References i2cmess::address, i2cmess::buf, I2C_MASTER, I2C_messagestatus, I2C_NACK_ON_ADDRESS, I2C_NACK_ON_DATA, I2C_NO_BUS, I2C_OK, I2C_process, I2C_TIME_OUT, i2cmess::nrBytes, and i2cmess::status. |
|
process I2C slave message.
Definition at line 392 of file i2cd.c. References i2cmess::address, i2cmess::buf, disable, enable, I2C_ERR, I2C_NO_BUS, I2C_NOT_PROCESSED, I2C_OK, I2C_SLAVE_IBUF_OVERFLOW, I2C_SLAVE_OBUF_EMPTY, I2CA, i2c::ioaddr, i2cmess::nrBytes, i2cmess::procBytes, i2c::s_ibuff, i2c::s_icnt, i2c::s_iptr, i2c::s_isem, i2c::s_obuff, i2c::s_ocnt, i2c::s_optr, i2c::s_osem, i2c::s_status, SBUFLEN, ssem_wait, and i2cmess::status. Referenced by I2C_process. |
|
initiate an I2C transfer.
Definition at line 326 of file i2cd.c. References disable, enable, I2C_ARBITRATION_LOST, I2C_ERR, I2C_MASTER_MODE, I2C_NACK_ON_ADDRESS, I2C_NACK_ON_DATA, I2C_NO_BUS, I2C_NOT_PROCESSED, I2C_OK, I2C_SLAVE_MODE, I2C_TIME_OUT, I2CA, i2c::ioaddr, i2c::m_buff, i2c::m_cnt, i2c::m_head, i2c::m_sem, i2c::m_state_handler, MBUFLEN, i2c::mode, i2c::s_state, SLAVE_IDLE, ssem_wait, and i2cmess::status. Referenced by I2C_process. |
|
sets the D/A output channel of a PCF8591 chip.
Definition at line 101 of file analog.c. References _I2C_analog_mbuf, _I2C_ad_datas::active, _I2C_ad_datas::address, i2cmess::address, i2cmess::buf, I2C_MASTER, I2C_OK, I2C_process, i2cmess::nrBytes, i2cmess::status, and _I2C_ad_datas::status. |
|
keeps information about the PCF8591 A/D - D/A converters in the system.
|
|
keeps the internal data for all PCF8574(A) bin i/o devices.
|