What endianness is word in i2c_smbus_data?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm rather confused here.  In SMBUS, the "read word" operation returns
two bytes.  Just to be confusing, the SMBUS spec calls the first byte
"Data Byte Low" and the second byte "Data Byte High".  But they really
are the first and second bytes -- Read Word will return whatever Read
Byte would have as its first byte.  Let's call these bytes B1 and B2
for first and second.

The eeprom and at24 drivers expect data->word to be (B2 << 8) | B1.
That is, data->word is the cpu representation of the value on the bus
if that value is treated as little-endian.  Is that indeed the correct
interpretation?  If so, should it be documented somewhere?

--Andy

-- 
Andy Lutomirski
AMA Capital Management, LLC
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux