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 
23 #include "cpu_conf_common.h"
24 
25 #ifdef CPU_MODEL_NRF52832XXAA
26 #include "vendor/nrf52.h"
27 #include "vendor/nrf52_bitfields.h"
28 #include "vendor/nrf52832_peripherals.h"
29 #elif defined(CPU_MODEL_NRF52805XXAA)
30 #include "vendor/nrf52805.h"
31 #include "vendor/nrf52805_bitfields.h"
32 #include "vendor/nrf52805_peripherals.h"
33 #elif defined(CPU_MODEL_NRF52810XXAA)
34 #include "vendor/nrf52810.h"
35 #include "vendor/nrf52810_bitfields.h"
36 #include "vendor/nrf52810_peripherals.h"
37 #elif defined(CPU_MODEL_NRF52811XXAA)
38 #include "vendor/nrf52811.h"
39 #include "vendor/nrf52811_bitfields.h"
40 #include "vendor/nrf52811_peripherals.h"
41 #elif defined(CPU_MODEL_NRF52820XXAA)
42 #include "vendor/nrf52820.h"
43 #include "vendor/nrf52820_bitfields.h"
44 #include "vendor/nrf52820_peripherals.h"
45 #elif defined(CPU_MODEL_NRF52833XXAA)
46 #include "vendor/nrf52833.h"
47 #include "vendor/nrf52833_bitfields.h"
48 #include "vendor/nrf52833_peripherals.h"
49 #elif defined(CPU_MODEL_NRF52840XXAA)
50 #include "vendor/nrf52840.h"
51 #include "vendor/nrf52840_bitfields.h"
52 #include "vendor/nrf52840_peripherals.h"
53 #else
54 #error "The CPU_MODEL of your board is currently not supported"
55 #endif
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
65 #define CPU_DEFAULT_IRQ_PRIO (2U)
66 #define CPU_FLASH_BASE (0x00000000)
67 
68 #if defined(CPU_MODEL_NRF52805XXAA)
69 #define CPU_IRQ_NUMOF (26U)
70 #elif defined(CPU_MODEL_NRF52810XXAA)
71 #define CPU_IRQ_NUMOF (30U)
72 #elif defined(CPU_MODEL_NRF52811XXAA)
73 #define CPU_IRQ_NUMOF (30U)
74 #elif defined(CPU_MODEL_NRF52820XXAA)
75 #define CPU_IRQ_NUMOF (40U)
76 #elif defined(CPU_MODEL_NRF52832XXAA)
77 #define CPU_IRQ_NUMOF (39U)
78 #elif defined(CPU_MODEL_NRF52833XXAA)
79 #define CPU_IRQ_NUMOF (48U)
80 #elif defined(CPU_MODEL_NRF52840XXAA)
81 #define CPU_IRQ_NUMOF (48U)
82 #endif
89 #ifdef BPROT_PRESENT
90 #define FLASHPAGE_SIZE BPROT_REGIONS_SIZE
91 #define FLASHPAGE_NUMOF BPROT_REGIONS_NUM
92 #elif defined(CPU_MODEL_NRF52820XXAA)
93 #define FLASHPAGE_SIZE (4096U)
94 #define FLASHPAGE_NUMOF (64U)
95 #elif defined(CPU_MODEL_NRF52833XXAA)
96 #define FLASHPAGE_SIZE (4096U)
97 #define FLASHPAGE_NUMOF (128U)
98 #elif defined(CPU_MODEL_NRF52840XXAA)
99 #define FLASHPAGE_SIZE (4096U)
100 #define FLASHPAGE_NUMOF (256U)
101 #endif
102 
103 /* The minimum block size which can be written is 4B. However, the erase
104  * block is always FLASHPAGE_SIZE.
105  */
106 #define FLASHPAGE_WRITE_BLOCK_SIZE (4U)
107 /* Writing should be always 4 bytes aligned */
108 #define FLASHPAGE_WRITE_BLOCK_ALIGNMENT (4U)
111 #ifdef CPU_MODEL_NRF52840XXAA
117 /* Taken from OpenWSN @32.768Hz */
118 #define PORT_maxTxDataPrepare (400/PORT_US_PER_TICK)
119 #define PORT_maxRxAckPrepare (400/PORT_US_PER_TICK)
120 #define PORT_maxRxDataPrepare (400/PORT_US_PER_TICK)
121 #define PORT_maxTxAckPrepare (400/PORT_US_PER_TICK)
122 /* Measured 220us */
123 #define PORT_delayTx (300/PORT_US_PER_TICK)
124 #define PORT_delayRx (150/PORT_US_PER_TICK)
126 #endif
127 
131 static inline void nrf52_sleep(void)
132 {
133  __SEV();
134  __WFE();
135  __asm("nop");
136 }
137 
138 #ifdef __cplusplus
139 }
140 #endif
141 
static void nrf52_sleep(void)
Put the CPU in the low-power 'wait for event' state.
Definition: cpu_conf.h:131