lkml.org 
[lkml]   [2013]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectWhat endianness is word in i2c_smbus_data?
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


\
 
 \ /
  Last update: 2013-07-17 04:21    [W:0.037 / U:4.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site