From ab6006ea3eece3a5505acb94680104b8635f6a53 Mon Sep 17 00:00:00 2001 From: Francois Berder Date: Thu, 20 Jul 2017 09:02:27 +0100 Subject: [PATCH 1/3] cpu: pic32: Implement cpuid_get function Signed-off-by: Francois Berder --- .../include/periph_cpu_common.h | 5 +++++ cpu/mips_pic32_common/periph/cpuid.c | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 cpu/mips_pic32_common/periph/cpuid.c diff --git a/cpu/mips_pic32_common/include/periph_cpu_common.h b/cpu/mips_pic32_common/include/periph_cpu_common.h index 2f838c8aec4c..08f3c791ddfd 100644 --- a/cpu/mips_pic32_common/include/periph_cpu_common.h +++ b/cpu/mips_pic32_common/include/periph_cpu_common.h @@ -25,6 +25,11 @@ extern "C" { #endif + /** + * @brief Length of the CPU_ID in bytes + */ +#define CPUID_LEN (4U) + #define GPIO_PIN(x,y) ((x << 4) | (y & 0xf)) /** diff --git a/cpu/mips_pic32_common/periph/cpuid.c b/cpu/mips_pic32_common/periph/cpuid.c new file mode 100644 index 000000000000..22842e8e1909 --- /dev/null +++ b/cpu/mips_pic32_common/periph/cpuid.c @@ -0,0 +1,18 @@ +/* + * Copyright(C) 2017 Francois Berder + * + * 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. + * + */ + +#include +#include +#include "board.h" +#include "periph/cpuid.h" + + void cpuid_get(void *id) + { + memcpy(id, (uint32_t*)&DEVID, CPUID_LEN); + } From 73ffeb55ab2dee692b5ca9d50f4ba46078988683 Mon Sep 17 00:00:00 2001 From: Francois Berder Date: Thu, 20 Jul 2017 09:03:10 +0100 Subject: [PATCH 2/3] boards: clicker: Add cpuid peripheral support Signed-off-by: Francois Berder --- boards/pic32-clicker/Makefile.features | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/pic32-clicker/Makefile.features b/boards/pic32-clicker/Makefile.features index 272d7cc6fa20..195a6f4b4369 100644 --- a/boards/pic32-clicker/Makefile.features +++ b/boards/pic32-clicker/Makefile.features @@ -1,4 +1,5 @@ # Put defined MCU peripherals here (in alphabetical order) +FEATURES_PROVIDED += periph_cpuid FEATURES_PROVIDED += periph_gpio FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_uart From 095afabb79a935b1b0569b215f3d5ad5127c21d6 Mon Sep 17 00:00:00 2001 From: Francois Berder Date: Thu, 20 Jul 2017 09:03:18 +0100 Subject: [PATCH 3/3] boards: wifire: Add cpuid peripheral support Signed-off-by: Francois Berder --- boards/pic32-wifire/Makefile.features | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/pic32-wifire/Makefile.features b/boards/pic32-wifire/Makefile.features index 272d7cc6fa20..195a6f4b4369 100644 --- a/boards/pic32-wifire/Makefile.features +++ b/boards/pic32-wifire/Makefile.features @@ -1,4 +1,5 @@ # Put defined MCU peripherals here (in alphabetical order) +FEATURES_PROVIDED += periph_cpuid FEATURES_PROVIDED += periph_gpio FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_uart