diff --git a/boards/weio/Makefile.features b/boards/weio/Makefile.features index fe61281120..31c224344e 100644 --- a/boards/weio/Makefile.features +++ b/boards/weio/Makefile.features @@ -3,4 +3,5 @@ FEATURES_PROVIDED += periph_uart FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_gpio FEATURES_PROVIDED += periph_pwm +FEATURES_PROVIDED += periph_cpuid FEATURES_MCU_GROUP = cortex_m0 diff --git a/cpu/lpc11u34/include/cpu_conf.h b/cpu/lpc11u34/include/cpu_conf.h index e5a276b0c0..f5d9fbeae1 100644 --- a/cpu/lpc11u34/include/cpu_conf.h +++ b/cpu/lpc11u34/include/cpu_conf.h @@ -36,6 +36,13 @@ extern "C" { #define CPU_FLASH_BASE LPC_FLASH_BASE /** @} */ +/** + * @brief CPU ID configuration + * @{ + */ +#define CPUID_ID_LEN (16U) +/* @} */ + #ifdef __cplusplus } #endif diff --git a/cpu/lpc11u34/periph/cpuid.c b/cpu/lpc11u34/periph/cpuid.c new file mode 100644 index 0000000000..b759ebcf1c --- /dev/null +++ b/cpu/lpc11u34/periph/cpuid.c @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2015 Freie Universität Berlin + * + * 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. + */ + +/** + * @ingroup cpu_lpc11u34 + * @{ + * + * @file + * @brief Low-level CPUID driver implementation + * + * @author Paul RATHGEB + */ + +#include +#include "periph/cpuid.h" + +/* IAP base address */ +#define IAP_ADDRESS 0x1FFF1FF1 + +void cpuid_get(void *id) +{ + uint32_t result[5]; + /* IAP command for UUID : 58 (UM10462 page 409) */ + uint32_t command = 58; + /* Define pointer to function type */ + void (*iap)(uint32_t[], uint32_t[]); + /* Set the function pointer */ + iap = (void (*)(uint32_t[], uint32_t[])) IAP_ADDRESS; + /* Read UUID */ + iap(&command, result); + memcpy(id, &result[1], CPUID_ID_LEN); +} +/** @} */