2

What does cpu_to_le64 function do? Where can I find the definition? The function gets an unsigned int as the input parameter. I have different variation in my device driver code, e.g. cpu_to_le32 or cpu_to_le16. Any idea what is this about?

NaSh
  • 665
  • 5
  • 16
  • 1
    translates value to little endian representation https://en.wikipedia.org/wiki/Endianness . If your system uses little endian order, than it does nothing, if big endian then it swaps the order of the bytes – Alex Hoppus Feb 18 '16 at 19:33
  • @AlexHoppus That should be an answer. – Peter L. Feb 18 '16 at 19:57
  • It's a de facto duplicate to http://stackoverflow.com/questions/21932790/how-to-convert-u32-to-be32-in-linux-kernel And the original link to nice article: http://bruceblinn.com/linuxinfo/ByteOrder.html – 0andriy Feb 19 '16 at 22:41

1 Answers1

3

It translates value to little endian representation . If your system uses little endian order, than it does nothing, if big endian then it swaps the order of the bytes

Alex Hoppus
  • 3,821
  • 4
  • 28
  • 47