daniel-santos / mcp2210-linux

MCP2210 driver for linux
http://danielthesantos.blogspot.com/search/label/mcp2210
51 stars 31 forks source link

replace use of packed structs #3

Open daniel-santos opened 10 years ago

daniel-santos commented 10 years ago

Packed structs are good for managing protocols, but bad for most everything else. When data is read from the MCP2210, the packed structs are perfect. However, they need to be copied out of these and into unpacked structs for any further processing (including storage for later use). This also introduces the perfect time and place for endianness flipping. Thus, our packed structs can use le types and if the unpacked structs use non-le types, then sparse will tell us if we fuck anything up! (make C=1 EXTRA_CPPFLAGS=-D__CHECK_ENDIAN__)