Skip to content
Snippets Groups Projects
Commit 24f54614 authored by David Sidrane's avatar David Sidrane Committed by Lorenz Meier
Browse files

systemlib/board_serial uses common board api for UUID

parent 459f71f5
No related branches found
No related tags found
No related merge requests found
......@@ -41,20 +41,17 @@
*/
#include <px4_config.h>
#include "otp.h"
#include <string.h>
#include "board_serial.h"
int get_board_serial(uint8_t *serialid)
int get_board_serial(raw_uuid_byte_t serialid)
{
const volatile uint32_t *udid_ptr = (const uint32_t *)STM32_SYSMEM_UID;
union udid id;
val_read((uint32_t *)&id, udid_ptr, sizeof(id));
#if defined(BOARD_OVERRIDE_UUID)
memcpy(serialid, BOARD_OVERRIDE_UUID, PX4_CPU_UUID_BYTE_LENGTH);
#else
uuid_uint8_reorder_t odering = {3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8};
/* Copy the serial from the chips non-write memory and swap endianess */
serialid[0] = id.data[3]; serialid[1] = id.data[2]; serialid[2] = id.data[1]; serialid[3] = id.data[0];
serialid[4] = id.data[7]; serialid[5] = id.data[6]; serialid[6] = id.data[5]; serialid[7] = id.data[4];
serialid[8] = id.data[11]; serialid[9] = id.data[10]; serialid[10] = id.data[9]; serialid[11] = id.data[8];
board_get_uuid(serialid, odering);
#endif
return 0;
}
/****************************************************************************
*
* Copyright (c) 2012-2014 PX4 Development Team. All rights reserved.
* Copyright (c) 2012-2014, 2017 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -42,10 +42,10 @@
#pragma once
#include <stdint.h> // uint8_t
#include <px4_config.h>
__BEGIN_DECLS
__EXPORT int get_board_serial(uint8_t *serialid);
__EXPORT int get_board_serial(raw_uuid_byte_t serialid);
__END_DECLS
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment