1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/native/periph/cpuid.c

41 lines
902 B
C
Raw Normal View History

2014-06-24 13:40:14 +02:00
/*
2015-02-08 18:51:25 +01:00
* Copyright (C) 2014 Martine Lenders <mlenders@inf.fu-berlin.de>
2014-06-24 13:40:14 +02:00
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
2014-06-24 13:40:14 +02:00
*/
/**
* @ingroup cpu_native
* @ingroup drivers_periph_cpuid
2014-06-24 13:40:14 +02:00
* @{
*
* @file
2014-06-24 13:40:14 +02:00
* @brief Implementation
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*
* @}
2014-06-24 13:40:14 +02:00
*/
#include <string.h>
#include <stdint.h>
#include "cpu_conf.h"
2014-06-24 13:40:14 +02:00
#include "native_internal.h"
#include "periph/cpuid.h"
void cpuid_get(void *id)
{
/* Just in case _native_id is shorter than CPUID_LEN: */
size_t len = CPUID_LEN;
if (sizeof(_native_id) < CPUID_LEN) {
memset(((char*)id) + sizeof(_native_id), 0xff,
CPUID_LEN - sizeof(_native_id));
len = sizeof(_native_id);
}
memcpy(id, &(_native_id), len);
2014-06-24 13:40:14 +02:00
}