mirror of https://github.com/ARMmbed/mbed-os.git
CpuUid: removed STL includes, removed desctructor definition, as default destructor will be enough, and added critical sections to code filling buffers
parent
f7ed4b9f90
commit
44bf8228a1
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "hal/cpu_uid_api.h"
|
#include "hal/cpu_uid_api.h"
|
||||||
#include "platform/mbed_assert.h"
|
#include "platform/mbed_assert.h"
|
||||||
|
#include "platform/CriticalSectionLock.h"
|
||||||
#include "drivers/CpuUid.h"
|
#include "drivers/CpuUid.h"
|
||||||
|
|
||||||
#if DEVICE_CPUUID
|
#if DEVICE_CPUUID
|
||||||
|
@ -35,13 +36,10 @@ CpuUid::CpuUid()
|
||||||
populate_uid_buf();
|
populate_uid_buf();
|
||||||
}
|
}
|
||||||
|
|
||||||
CpuUid::~CpuUid()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CpuUid::populate_uid_buf()
|
void CpuUid::populate_uid_buf()
|
||||||
{
|
{
|
||||||
if (_uidptr == NULL) {
|
if (_uidptr == NULL) {
|
||||||
|
CriticalSectionLock lock;
|
||||||
cpu_uid_get_uid(_uidbuf);
|
cpu_uid_get_uid(_uidbuf);
|
||||||
_uidptr = _uidbuf;
|
_uidptr = _uidbuf;
|
||||||
}
|
}
|
||||||
|
@ -50,6 +48,7 @@ void CpuUid::populate_uid_buf()
|
||||||
void CpuUid::populate_str_buf()
|
void CpuUid::populate_str_buf()
|
||||||
{
|
{
|
||||||
if (_strptr == NULL) {
|
if (_strptr == NULL) {
|
||||||
|
CriticalSectionLock lock;
|
||||||
#ifdef MBED_CPU_UID_STR_SIZE_MAX
|
#ifdef MBED_CPU_UID_STR_SIZE_MAX
|
||||||
cpu_uid_get_str(_strbuf);
|
cpu_uid_get_str(_strbuf);
|
||||||
_strptr = _strbuf;
|
_strptr = _strbuf;
|
||||||
|
|
|
@ -26,9 +26,6 @@
|
||||||
#define CPU_UID_STRING_BUFFER_SIZE (MBED_CPU_UID_SIZE * 2 + 1)
|
#define CPU_UID_STRING_BUFFER_SIZE (MBED_CPU_UID_SIZE * 2 + 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
/** \addtogroup drivers */
|
/** \addtogroup drivers */
|
||||||
|
|
||||||
|
@ -43,10 +40,6 @@ public:
|
||||||
*/
|
*/
|
||||||
CpuUid();
|
CpuUid();
|
||||||
|
|
||||||
/** CpuUid destructor
|
|
||||||
*/
|
|
||||||
virtual ~CpuUid();
|
|
||||||
|
|
||||||
/** Get size of CPU UID in bytes
|
/** Get size of CPU UID in bytes
|
||||||
*
|
*
|
||||||
* @return Size of device's CPU UID in bytes
|
* @return Size of device's CPU UID in bytes
|
||||||
|
|
Loading…
Reference in New Issue