POSIX: ifdef getreg32() calls in mcu_unique_id()

mcu_unique_id() reads registers at an invalid address in non-nuttx builds.
Added ifdef to return a dummy value for non-nuttx builds.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois
2015-06-13 21:18:11 -07:00
committed by Lorenz Meier
parent 7254f04f68
commit c6b36073fe
+6
View File
@@ -62,9 +62,15 @@
/** Copy the 96bit MCU Unique ID into the provided pointer */
void mcu_unique_id(uint32_t *uid_96_bit)
{
#ifdef __PX4_NUTTX
uid_96_bit[0] = getreg32(UNIQUE_ID);
uid_96_bit[1] = getreg32(UNIQUE_ID+4);
uid_96_bit[2] = getreg32(UNIQUE_ID+8);
#else
uid_96_bit[0] = 0;
uid_96_bit[1] = 1;
uid_96_bit[2] = 2;
#endif
}
int mcu_version(char* rev, char** revstr)