I2C bus

I like software developing! Few days ago I have found out, that my ATI driver may works incorrectly with TFT monitors. Due to lack of I2C bus the driver was unable to fetch the DDC2 data from monitor, and therefore could not even guess the type of device connected to the ATI card. I had two options – to implement I2C bus in ATI driver itself, or to provide a general solution. The former would be easier, the later would bie nicer.

The new directory: arch/common/hidd.i2c showed up in AROS source tree. It is a general implementation of the I2C bus for AROS. It will be definitely used in the ATI driver, but it is not the only purpouse of it. The hidd consists of two OOP classes:

1. The I2C bus class which is used by devices and abstracts every hardware bus into well known API. Using it as a superclass and overloading only two of its methods, one creates hardware specific bus driver.

2. The I2C device class which is used by software to communicate with devices over the bus. Using it as a superclass let’s one to define new types of protocols, like SMBus for example, which use the I2C as a transport medium.

The specific driver class which uses the genmodule app from Staf Verhaegen (our talented AROS developer) may be as small as few hundred bytes in source, and less than two kilobytes in binary.

The ATI driver is one example of potential use. The I2C bus might be used aswell to communicate with hardware sensors, with TV cards (access the tuner through I2C bus) or even through parallel port (see this link for more details: http://oap.sourceforge.net/oap/i2c_para_module/i2c_para_module.pdf)
to talk with thousands of different IC’s which provide the I2C interface.

Have fun with it. I will 🙂