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/systemlib/board_serial.c | |
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/systemlib/board_serial.c')
-rw-r--r-- | src/modules/systemlib/board_serial.c | 8 |
1 files changed, 4 insertions, 4 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 +} |