diff options
author | Andrew Tridgell <tridge@samba.org> | 2014-03-25 10:56:33 +1100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-08 11:39:40 +0200 |
commit | 37b4cdfce21ff6a7374599a6706ad387bd359515 (patch) | |
tree | 58454aa722dac3802770a1d1c6cbfe4fbca26362 /src/modules | |
parent | 0d0c4c36265b044ba978cfe4dbe369e93aa25d44 (diff) | |
download | px4-firmware-37b4cdfce21ff6a7374599a6706ad387bd359515.tar.gz px4-firmware-37b4cdfce21ff6a7374599a6706ad387bd359515.tar.bz2 px4-firmware-37b4cdfce21ff6a7374599a6706ad387bd359515.zip |
board_serial: use a uint8_t buffer
we should not be using 'char' for binary APIs, as the C standard does
not specify if it is signed or unsigned, so results may not be
consistent
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/systemlib/board_serial.c | 8 | ||||
-rw-r--r-- | src/modules/systemlib/board_serial.h | 2 | ||||
-rw-r--r-- | src/modules/systemlib/otp.h | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/modules/systemlib/board_serial.c b/src/modules/systemlib/board_serial.c index ad8c2bf83..182fd15c6 100644 --- a/src/modules/systemlib/board_serial.c +++ b/src/modules/systemlib/board_serial.c @@ -44,11 +44,11 @@ #include "board_config.h" #include "board_serial.h" -int get_board_serial(char *serialid) +int get_board_serial(uint8_t *serialid) { - const volatile unsigned *udid_ptr = (const unsigned *)UDID_START; + const volatile uint32_t *udid_ptr = (const uint32_t *)UDID_START; union udid id; - val_read((unsigned *)&id, udid_ptr, sizeof(id)); + val_read((uint32_t *)&id, udid_ptr, sizeof(id)); /* Copy the serial from the chips non-write memory and swap endianess */ @@ -57,4 +57,4 @@ int get_board_serial(char *serialid) serialid[8] = id.data[11]; serialid[9] = id.data[10]; serialid[10] = id.data[9]; serialid[11] = id.data[8]; return 0; -}
\ No newline at end of file +} diff --git a/src/modules/systemlib/board_serial.h b/src/modules/systemlib/board_serial.h index b14bb4376..873d9657b 100644 --- a/src/modules/systemlib/board_serial.h +++ b/src/modules/systemlib/board_serial.h @@ -44,6 +44,6 @@ __BEGIN_DECLS -__EXPORT int get_board_serial(char *serialid); +__EXPORT int get_board_serial(uint8_t *serialid); __END_DECLS diff --git a/src/modules/systemlib/otp.h b/src/modules/systemlib/otp.h index f10e129d8..273b064f0 100644 --- a/src/modules/systemlib/otp.h +++ b/src/modules/systemlib/otp.h @@ -125,7 +125,7 @@ struct otp_lock { #pragma pack(push, 1) union udid { uint32_t serial[3]; - char data[12]; + uint8_t data[12]; }; #pragma pack(pop) |