Adds a board common way of retriving the SoC' Unique identifier

This abstraction will support mcu's with longer ID's then the
   stm32 family.

   It provids a common interface for byte and 32 bit word access
   to the UUID data and a facility to reorder it.
This commit is contained in:
David Sidrane
2017-01-25 07:43:11 +01:00
committed by Lorenz Meier
parent b86380086e
commit bf0de997cb
4 changed files with 214 additions and 4 deletions
+1 -1
View File
@@ -43,8 +43,8 @@
#include <nuttx/config.h>
#include <nuttx/arch.h>
#include <board_config.h>
#include "px4_micro_hal.h"
#include <board_config.h>
#elif defined (__PX4_POSIX)
# include <system_config.h>
+16
View File
@@ -56,6 +56,22 @@ __BEGIN_DECLS
# include <stm32_tim.h>
# include <stm32_spi.h>
# include <stm32_i2c.h>
/* STM32/32F7 defines the 96 bit UUID as
* init32_t[3] that can be read as bytes/half-words/words
* init32_t[0] PX4_CPU_UUID_ADDRESS[0] bits 31:0 (offset 0)
* init32_t[1] PX4_CPU_UUID_ADDRESS[1] bits 63:32 (offset 4)
* init32_t[2] PX4_CPU_UUID_ADDRESS[3] bits 96:64 (offset 8)
*
* PX4 uses the legacy uint32 ordering
* word [0] [1] [2]
* bits 31-00, 63-32, 95-64
*/
# define PX4_CPU_UUID_BYTE_LENGTH 12
# define PX4_CPU_UUID_WORD32_LENGTH (PX4_CPU_UUID_BYTE_LENGTH/sizeof(uint32_t))
# define PX4_CPU_UUID_WORD32_LEGACY_FORMAT_ORDER {0,1,2}
# define PX4_CPU_UUID_WORD32_LEGACY_FORMAT_SIZE (PX4_CPU_UUID_WORD32_LENGTH-1+(2*PX4_CPU_UUID_BYTE_LENGTH))
# define px4_spibus_initialize(port_1based) stm32_spibus_initialize(port_1based)
# define px4_i2cbus_initialize(bus_num_1based) stm32_i2cbus_initialize(bus_num_1based)