2014-09-09 11:12:39 +02:00
|
|
|
/*
|
2016-12-15 11:39:19 +01:00
|
|
|
* Copyright (C) 2014-2016 Freie Universität Berlin
|
2014-09-09 11:12:39 +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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2016-12-15 11:45:53 +01:00
|
|
|
* @ingroup cpu_sam0_common
|
2017-08-24 14:52:15 +02:00
|
|
|
* @brief Implementation specific CPU configuration options
|
2014-09-09 11:12:39 +02:00
|
|
|
* @{
|
|
|
|
*
|
2014-10-21 16:52:30 +02:00
|
|
|
* @file
|
2014-09-09 11:12:39 +02:00
|
|
|
* @brief Implementation specific CPU configuration options
|
|
|
|
*
|
|
|
|
* @author Thomas Eichinger <thomas.eichinger@fu-berlin.de>
|
2016-12-15 11:39:19 +01:00
|
|
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
2014-09-09 11:12:39 +02:00
|
|
|
*/
|
|
|
|
|
2016-06-10 17:43:21 +02:00
|
|
|
#ifndef CPU_CONF_H
|
|
|
|
#define CPU_CONF_H
|
2014-09-09 11:12:39 +02:00
|
|
|
|
2016-01-14 23:21:49 +01:00
|
|
|
#include "cpu_conf_common.h"
|
2020-02-06 19:52:05 +01:00
|
|
|
|
|
|
|
/* Workaround redefinition of LITTLE_ENDIAN macro (part1) */
|
|
|
|
#ifdef LITTLE_ENDIAN
|
|
|
|
#define __TMP_LITTLE_ENDIAN LITTLE_ENDIAN
|
|
|
|
#undef LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
2020-02-06 20:07:34 +01:00
|
|
|
#if defined(CPU_SAMD21A)
|
|
|
|
#include "vendor/samd21/include_a/samd21.h"
|
|
|
|
#elif defined(CPU_SAMD21B)
|
|
|
|
#include "vendor/samd21/include_b/samd21.h"
|
|
|
|
#elif defined(CPU_SAMD21C)
|
|
|
|
#include "vendor/samd21/include_c/samd21.h"
|
|
|
|
#elif defined(CPU_SAMD21D)
|
|
|
|
#include "vendor/samd21/include_d/samd21.h"
|
2020-02-06 19:52:05 +01:00
|
|
|
#elif defined(CPU_SAMD51)
|
|
|
|
#include "vendor/samd51/include/samd51.h"
|
|
|
|
#elif defined(CPU_SAME54)
|
|
|
|
#include "vendor/same54/include/same54.h"
|
|
|
|
#elif defined(CPU_SAML10)
|
|
|
|
#include "vendor/saml10/include/sam.h"
|
|
|
|
#elif defined(CPU_SAML11)
|
|
|
|
#include "vendor/saml11/include/sam.h"
|
|
|
|
#elif defined(CPU_SAML21A)
|
|
|
|
#include "vendor/saml21/include/saml21.h"
|
|
|
|
#elif defined(CPU_SAML21B)
|
|
|
|
#include "vendor/saml21/include_b/saml21.h"
|
|
|
|
#elif defined(CPU_SAMR21)
|
|
|
|
#include "vendor/samr21/include/samr21.h"
|
|
|
|
#elif defined(CPU_SAMR30)
|
|
|
|
#include "vendor/samr30/include/samr30.h"
|
|
|
|
#elif defined(CPU_SAMR34)
|
|
|
|
#include "vendor/samr34/include/samr34.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Workaround redefinition of LITTLE_ENDIAN macro (part2) */
|
|
|
|
#ifdef LITTLE_ENDIAN
|
|
|
|
#undef LITTLE_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __TMP_LITTLE_ENDIAN
|
|
|
|
#define LITTLE_ENDIAN __TMP_LITTLE_ENDIAN
|
2019-01-21 17:06:58 +01:00
|
|
|
#endif
|
2014-09-09 11:12:39 +02:00
|
|
|
|
2014-10-13 10:53:20 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2014-09-09 11:12:39 +02:00
|
|
|
|
|
|
|
/**
|
2015-05-27 23:07:23 +02:00
|
|
|
* @brief ARM Cortex-M specific CPU configuration
|
2014-09-09 11:12:39 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2015-05-27 23:07:23 +02:00
|
|
|
#define CPU_DEFAULT_IRQ_PRIO (1U)
|
|
|
|
#define CPU_IRQ_NUMOF PERIPH_COUNT_IRQn
|
|
|
|
#define CPU_FLASH_BASE FLASH_ADDR
|
2019-01-27 11:29:35 +01:00
|
|
|
|
|
|
|
#ifdef CPU_SAML1X
|
|
|
|
#define CPU_FLASH_RWWEE_BASE DATAFLASH_ADDR
|
|
|
|
#else
|
|
|
|
#define CPU_FLASH_RWWEE_BASE NVMCTRL_RWW_EEPROM_ADDR
|
|
|
|
#endif
|
2014-09-09 11:12:39 +02:00
|
|
|
/** @} */
|
|
|
|
|
2016-04-20 11:19:03 +02:00
|
|
|
/**
|
|
|
|
* @brief Flash page configuration
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
/* a flashpage in RIOT is mapped to a flash row on the SAM0s */
|
2019-03-12 13:57:27 +01:00
|
|
|
#if defined(NVMCTRL_ROW_SIZE)
|
|
|
|
#define FLASHPAGE_SIZE (NVMCTRL_ROW_SIZE)
|
|
|
|
#elif defined(NVMCTRL_BLOCK_SIZE)
|
|
|
|
#define FLASHPAGE_SIZE (NVMCTRL_BLOCK_SIZE)
|
|
|
|
#elif defined(NVMCTRL_PAGE_SIZE)
|
|
|
|
/* saml1x: The NVM is organized into rows, where each row contains four pages,
|
|
|
|
as shown in the NVM Row Organization figure. */
|
|
|
|
#define FLASHPAGE_SIZE (4 * NVMCTRL_PAGE_SIZE)
|
|
|
|
#else
|
|
|
|
#error "Unsupported Device"
|
|
|
|
#endif
|
|
|
|
|
2018-12-21 11:48:16 +01:00
|
|
|
/* one SAM0 row contains 4 SAM0 pages, so 4 SAM0 pages contain
|
|
|
|
* the amount of a RIOT flashpage
|
|
|
|
*/
|
2019-03-12 13:57:27 +01:00
|
|
|
#define FLASHPAGE_PAGES_PER_ROW (FLASHPAGE_SIZE/FLASH_PAGE_SIZE)
|
2018-09-28 11:25:47 +02:00
|
|
|
/* number of RIOT flashpages on device */
|
|
|
|
#define FLASHPAGE_NUMOF (FLASH_NB_OF_PAGES / FLASHPAGE_PAGES_PER_ROW)
|
2017-11-16 00:00:56 +01:00
|
|
|
/* The minimum block size which can be written is 16B. However, the erase
|
|
|
|
* block is always FLASHPAGE_SIZE (SAM0 row).
|
|
|
|
*/
|
|
|
|
#define FLASHPAGE_RAW_BLOCKSIZE (16)
|
|
|
|
/* Writing should be always 4 byte aligned */
|
|
|
|
#define FLASHPAGE_RAW_ALIGNMENT (4)
|
2019-01-27 11:29:35 +01:00
|
|
|
/* Add RWWEE memory if supported by revision of the chip
|
|
|
|
* On some chips it is called RWW EEPROM while on some DATAFLASH, try to
|
|
|
|
* catch all without relying on the CPU model but on the named defines
|
|
|
|
*/
|
|
|
|
#ifdef NVMCTRL_RWW_EEPROM_SIZE
|
|
|
|
#define FLASHPAGE_RWWEE_NUMOF (NVMCTRL_RWWEE_PAGES / FLASHPAGE_PAGES_PER_ROW)
|
|
|
|
#endif
|
|
|
|
#ifdef DATAFLASH_SIZE
|
|
|
|
#define FLASHPAGE_RWWEE_NUMOF (DATAFLASH_NB_OF_PAGES / FLASHPAGE_PAGES_PER_ROW)
|
|
|
|
#endif
|
2016-04-20 11:19:03 +02:00
|
|
|
/** @} */
|
|
|
|
|
2019-12-12 00:42:53 +01:00
|
|
|
/**
|
|
|
|
* @brief The CPU has Low Power RAM that can be used as Heap
|
|
|
|
*/
|
|
|
|
#ifdef CPU_HAS_BACKUP_RAM
|
|
|
|
#define NUM_HEAPS (2)
|
|
|
|
#endif
|
|
|
|
|
2015-05-26 16:45:34 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-06-10 17:43:21 +02:00
|
|
|
#endif /* CPU_CONF_H */
|
2014-09-09 11:12:39 +02:00
|
|
|
/** @} */
|