Loading...
Searching...
No Matches
cpu_conf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016 Freie Universität Berlin
3 * SPDX-FileCopyrightText: 2020 Philipp-Alexander Blum <philipp-blum@jakiku.de>
4 * SPDX-License-Identifier: LGPL-2.1-only
5 */
6
7#pragma once
8
20
21#include "cpu_conf_common.h"
22
23#ifdef CPU_MODEL_NRF52832XXAA
24#include "vendor/nrf52.h"
25#include "vendor/nrf52_bitfields.h"
26#include "vendor/nrf52832_peripherals.h"
27#elif defined(CPU_MODEL_NRF52805XXAA)
28#include "vendor/nrf52805.h"
29#include "vendor/nrf52805_bitfields.h"
30#include "vendor/nrf52805_peripherals.h"
31#elif defined(CPU_MODEL_NRF52810XXAA)
32#include "vendor/nrf52810.h"
33#include "vendor/nrf52810_bitfields.h"
34#include "vendor/nrf52810_peripherals.h"
35#elif defined(CPU_MODEL_NRF52811XXAA)
36#include "vendor/nrf52811.h"
37#include "vendor/nrf52811_bitfields.h"
38#include "vendor/nrf52811_peripherals.h"
39#elif defined(CPU_MODEL_NRF52820XXAA)
40#include "vendor/nrf52820.h"
41#include "vendor/nrf52820_bitfields.h"
42#include "vendor/nrf52820_peripherals.h"
43#elif defined(CPU_MODEL_NRF52833XXAA)
44#include "vendor/nrf52833.h"
45#include "vendor/nrf52833_bitfields.h"
46#include "vendor/nrf52833_peripherals.h"
47#elif defined(CPU_MODEL_NRF52840XXAA)
48#include "vendor/nrf52840.h"
49#include "vendor/nrf52840_bitfields.h"
50#include "vendor/nrf52840_peripherals.h"
51#else
52#error "The CPU_MODEL of your board is currently not supported"
53#endif
54
55#ifdef __cplusplus
56extern "C" {
57#endif
58
63#define CPU_DEFAULT_IRQ_PRIO (2U)
64#define CPU_FLASH_BASE (0x00000000)
65
66#if defined(CPU_MODEL_NRF52805XXAA)
67#define CPU_IRQ_NUMOF (26U)
68#elif defined(CPU_MODEL_NRF52810XXAA)
69#define CPU_IRQ_NUMOF (30U)
70#elif defined(CPU_MODEL_NRF52811XXAA)
71#define CPU_IRQ_NUMOF (30U)
72#elif defined(CPU_MODEL_NRF52820XXAA)
73#define CPU_IRQ_NUMOF (40U)
74#elif defined(CPU_MODEL_NRF52832XXAA)
75#define CPU_IRQ_NUMOF (39U)
76#elif defined(CPU_MODEL_NRF52833XXAA)
77#define CPU_IRQ_NUMOF (48U)
78#elif defined(CPU_MODEL_NRF52840XXAA)
79#define CPU_IRQ_NUMOF (48U)
80#endif
82
87#ifdef BPROT_PRESENT
88#define FLASHPAGE_SIZE BPROT_REGIONS_SIZE
89#define FLASHPAGE_NUMOF BPROT_REGIONS_NUM
90#elif defined(CPU_MODEL_NRF52820XXAA)
91#define FLASHPAGE_SIZE (4096U)
92#define FLASHPAGE_NUMOF (64U)
93#elif defined(CPU_MODEL_NRF52833XXAA)
94#define FLASHPAGE_SIZE (4096U)
95#define FLASHPAGE_NUMOF (128U)
96#elif defined(CPU_MODEL_NRF52840XXAA)
97#define FLASHPAGE_SIZE (4096U)
98#define FLASHPAGE_NUMOF (256U)
99#endif
100
101/* The minimum block size which can be written is 4B. However, the erase
102 * block is always FLASHPAGE_SIZE.
103 */
104#define FLASHPAGE_WRITE_BLOCK_SIZE (4U)
105/* Writing should be always 4 bytes aligned */
106#define FLASHPAGE_WRITE_BLOCK_ALIGNMENT (4U)
108
109#ifdef CPU_MODEL_NRF52840XXAA
115/* Taken from OpenWSN @32.768Hz */
116#define PORT_maxTxDataPrepare (400/PORT_US_PER_TICK)
117#define PORT_maxRxAckPrepare (400/PORT_US_PER_TICK)
118#define PORT_maxRxDataPrepare (400/PORT_US_PER_TICK)
119#define PORT_maxTxAckPrepare (400/PORT_US_PER_TICK)
120/* Measured 220us */
121#define PORT_delayTx (300/PORT_US_PER_TICK)
122#define PORT_delayRx (150/PORT_US_PER_TICK)
124#endif
125
129static inline void nrf52_sleep(void)
130{
131 __SEV();
132 __WFE();
133 __asm("nop");
134}
135
136#ifdef __cplusplus
137}
138#endif
139
static void nrf52_sleep(void)
Put the CPU in the low-power 'wait for event' state.
Definition cpu_conf.h:129