Subject: Re: New i2c framework
To: None <eeh@netbsd.org, wrstuden@netbsd.org>
From: None <eeh@netbsd.org>
List: tech-kern
Date: 02/19/2002 18:13:25
| On 19 Feb 2002 eeh@netbsd.org wrote:
|
| > | On 18 Feb 2002 eeh@netbsd.org wrote:
| >
| > | > if (id != AT76C651_CHIPID) {
| > | ^^^
| > | What is the defined byte ordering for i2c? Is there one? Since id is a
| > | int16_t, BE and LE machines will handle this bit differently...
| >
| > There is no defined byte ordering for i2c. That is defined separately
| > by each device manufacturer.
|
| So then how do you know if you got the right id? What if another chip has
| the byte-swapped ID, and its manufacturer chose to use the other byte
| ordering, so that they both end up being the same byte sequence?
You lose.
The way things are *supposed* to work is that each manufacturer requests
a specific bus address for a specific device. Then you can identify the
device by the address at which it probes.
Some manufacturers do not allocate an address for the device, rather they
allow the address to be programmable. In that case you need some other
method of determining what sort of device is attached at a particular bus
address.
In this case, this device has a register with a chip ID accessible with
a specific bus access sequece. Considering the many different possible
addresses and access sequences, the likelyhood that two completely
different devices will probe the same way is almost zero.
Eduardo