1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/atxmega/include/cpu_nvm.h
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

66 lines
2.1 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
* @brief Non Volatile Memory (NVM) internal API
* @{
*
* @author Gerson Fernando Budke <nandojve@gmail.com>
*
*/
#ifndef CPU_NVM_H
#define CPU_NVM_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Get offset of calibration bytes in the production signature row
*
* @note In some distributions may require most recent vendor headers, even
* more recent than the upstream avr-libc. The headers can be download
* directly from Microchip web site. In general, Microchip have a
* dedicated page at Tools and Software / AVR and SAM Downloads Archive.
* The most recent version is AVR 8-bit Toolchain (3.4.4) 6.2.0.334.
* http://ww1.microchip.com/downloads/archive/avr8-headers-6.2.0.334.zip
*
* The official RIOT-OS docker container, Debian and Ubuntu are
* distributions that already had updated versions of those files.
*
* @param regname Name of register within the production signature row
* @retval Offset of register into the production signature row
*/
#define nvm_get_production_signature_row_offset(regname) \
offsetof(NVM_PROD_SIGNATURES_t, regname)
/**
* @brief Read one byte from the production signature row
*
* This function reads one byte from the production signature row of the device
* at the given address.
*
* @note This function is modifying the NVM.CMD register.
* If the application are using program space access in interrupts
* (__flash pointers in IAR EW or pgm_read_byte in GCC) interrupts
* needs to be disabled when running EEPROM access functions. If not
* the program space reads will be corrupted.
*
* @param address Byte offset into the signature row
*/
uint8_t nvm_read_production_signature_row(uint8_t address);
#ifdef __cplusplus
}
#endif
#endif /* CPU_NVM_H */
/** @} */