1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/atxmega/periph/cpuid.c
Gerson Fernando Budke 1a88f0bad6 cpu: Introduce Atmel xmega cpu
Add ATxmega common files and cpu definitions.

This works was originally developed by @Josar.  The 2018 version
were port to 2021 mainline.

This version changes original port to have only the atxmega CPU
definition. With that, all family can be accomodated.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-03-15 20:16:10 -03:00

65 lines
2.0 KiB
C

/*
* Copyright (C) 2021 Gerson Fernando Budke <nandojve@gmail.com>
*
* 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_atxmega
* @ingroup cpu_atxmega_periph
* @{
*
* @file
* @brief Low-level CPUID driver implementation
*
* @author Gerson Fernando Budke <nandojve@gmail.com>
*
* @}
*/
#include "periph_cpu.h"
#include "cpu_nvm.h"
#define ENABLE_DEBUG 0
#include "debug.h"
void cpuid_get(void *id)
{
uint8_t *addr = id;
addr[0x0] = nvm_read_production_signature_row(
nvm_get_production_signature_row_offset(LOTNUM0));
addr[0x1] = nvm_read_production_signature_row(
nvm_get_production_signature_row_offset(LOTNUM1));
addr[0x2] = nvm_read_production_signature_row(
nvm_get_production_signature_row_offset(LOTNUM2));
addr[0x3] = nvm_read_production_signature_row(
nvm_get_production_signature_row_offset(LOTNUM3));
addr[0x4] = nvm_read_production_signature_row(
nvm_get_production_signature_row_offset(LOTNUM4));
addr[0x5] = nvm_read_production_signature_row(
nvm_get_production_signature_row_offset(LOTNUM5));
addr[0x6] = nvm_read_production_signature_row(
nvm_get_production_signature_row_offset(WAFNUM));
addr[0x7] = nvm_read_production_signature_row(
nvm_get_production_signature_row_offset(COORDX0));
addr[0x8] = nvm_read_production_signature_row(
nvm_get_production_signature_row_offset(COORDX1));
addr[0x9] = nvm_read_production_signature_row(
nvm_get_production_signature_row_offset(COORDY0));
addr[0xa] = nvm_read_production_signature_row(
nvm_get_production_signature_row_offset(COORDY1));
if (IS_ACTIVE(ENABLE_DEBUG)) {
DEBUG("CPUID: ");
for (uint8_t i = 0; i < CPUID_LEN; i++) {
DEBUG("%02x ", addr[i]);
}
DEBUG("\n");
}
}