Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: hwinfo: update NXP platforms for byte order consistency #24271

Merged

Conversation

pabigot
Copy link
Collaborator

@pabigot pabigot commented Apr 10, 2020

Convert 32-bit values to big-endian representation for device-independent interpretation.

Resources indicate that CFG2 holds the upper 32 bits, and CFG1 the
lower 32 bits, of a 64-bit unique identifier.  Store it in big-endian
format so it reads correctly when accessed as a byte sequence.

https://community.nxp.com/docs/DOC-94459

Signed-off-by: Peter Bigot <[email protected]>
@pabigot pabigot added platform: NXP NXP area: HWINFO Hardware Information Driver labels Apr 10, 2020
Following the practice for i.MX decoding assume the 32-bit identifier
values need to be converted to big-endian representation for
device-independent interpretation.

Signed-off-by: Peter Bigot <[email protected]>
if (length > sizeof(dev_id.id)) {
length = sizeof(dev_id.id);
if (length > sizeof(id)) {
length = sizeof(id);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why i didn‘t used the MIN() macro in any of the drivers.

@carlescufi carlescufi merged commit 736860a into zephyrproject-rtos:master Apr 22, 2020
@pabigot pabigot deleted the nordic/20200410/hwinfo-nxp branch April 27, 2020 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: HWINFO Hardware Information Driver platform: NXP NXP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants