cpu_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Freie Universität Berlin
3  * 2020 Philipp-Alexander Blum <philipp-blum@jakiku.de>
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
10 #pragma once
11 
26 #include "cpu_conf_common.h"
27 
28 #ifdef CPU_MODEL_NRF52832XXAA
29 #include "vendor/nrf52.h"
30 #include "vendor/nrf52_bitfields.h"
31 #include "vendor/nrf52832_peripherals.h"
32 #elif defined(CPU_MODEL_NRF52805XXAA)
33 #include "vendor/nrf52805.h"
34 #include "vendor/nrf52805_bitfields.h"
35 #include "vendor/nrf52805_peripherals.h"
36 #elif defined(CPU_MODEL_NRF52810XXAA)
37 #include "vendor/nrf52810.h"
38 #include "vendor/nrf52810_bitfields.h"
39 #include "vendor/nrf52810_peripherals.h"
40 #elif defined(CPU_MODEL_NRF52811XXAA)
41 #include "vendor/nrf52811.h"
42 #include "vendor/nrf52811_bitfields.h"
43 #include "vendor/nrf52811_peripherals.h"
44 #elif defined(CPU_MODEL_NRF52820XXAA)
45 #include "vendor/nrf52820.h"
46 #include "vendor/nrf52820_bitfields.h"
47 #include "vendor/nrf52820_peripherals.h"
48 #elif defined(CPU_MODEL_NRF52833XXAA)
49 #include "vendor/nrf52833.h"
50 #include "vendor/nrf52833_bitfields.h"
51 #include "vendor/nrf52833_peripherals.h"
52 #elif defined(CPU_MODEL_NRF52840XXAA)
53 #include "vendor/nrf52840.h"
54 #include "vendor/nrf52840_bitfields.h"
55 #include "vendor/nrf52840_peripherals.h"
56 #else
57 #error "The CPU_MODEL of your board is currently not supported"
58 #endif
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
68 #define CPU_DEFAULT_IRQ_PRIO (2U)
69 #define CPU_FLASH_BASE (0x00000000)
70 
71 #if defined(CPU_MODEL_NRF52805XXAA)
72 #define CPU_IRQ_NUMOF (26U)
73 #elif defined(CPU_MODEL_NRF52810XXAA)
74 #define CPU_IRQ_NUMOF (30U)
75 #elif defined(CPU_MODEL_NRF52811XXAA)
76 #define CPU_IRQ_NUMOF (30U)
77 #elif defined(CPU_MODEL_NRF52820XXAA)
78 #define CPU_IRQ_NUMOF (40U)
79 #elif defined(CPU_MODEL_NRF52832XXAA)
80 #define CPU_IRQ_NUMOF (39U)
81 #elif defined(CPU_MODEL_NRF52833XXAA)
82 #define CPU_IRQ_NUMOF (48U)
83 #elif defined(CPU_MODEL_NRF52840XXAA)
84 #define CPU_IRQ_NUMOF (48U)
85 #endif
92 #ifdef BPROT_PRESENT
93 #define FLASHPAGE_SIZE BPROT_REGIONS_SIZE
94 #define FLASHPAGE_NUMOF BPROT_REGIONS_NUM
95 #elif defined(CPU_MODEL_NRF52820XXAA)
96 #define FLASHPAGE_SIZE (4096U)
97 #define FLASHPAGE_NUMOF (64U)
98 #elif defined(CPU_MODEL_NRF52833XXAA)
99 #define FLASHPAGE_SIZE (4096U)
100 #define FLASHPAGE_NUMOF (128U)
101 #elif defined(CPU_MODEL_NRF52840XXAA)
102 #define FLASHPAGE_SIZE (4096U)
103 #define FLASHPAGE_NUMOF (256U)
104 #endif
105 
106 /* The minimum block size which can be written is 4B. However, the erase
107  * block is always FLASHPAGE_SIZE.
108  */
109 #define FLASHPAGE_WRITE_BLOCK_SIZE (4U)
110 /* Writing should be always 4 bytes aligned */
111 #define FLASHPAGE_WRITE_BLOCK_ALIGNMENT (4U)
114 #ifdef CPU_MODEL_NRF52840XXAA
120 /* Taken from OpenWSN @32.768Hz */
121 #define PORT_maxTxDataPrepare (400/PORT_US_PER_TICK)
122 #define PORT_maxRxAckPrepare (400/PORT_US_PER_TICK)
123 #define PORT_maxRxDataPrepare (400/PORT_US_PER_TICK)
124 #define PORT_maxTxAckPrepare (400/PORT_US_PER_TICK)
125 /* Measured 220us */
126 #define PORT_delayTx (300/PORT_US_PER_TICK)
127 #define PORT_delayRx (150/PORT_US_PER_TICK)
129 #endif
130 
134 static inline void nrf52_sleep(void)
135 {
136  __SEV();
137  __WFE();
138  __asm("nop");
139 }
140 
141 #ifdef __cplusplus
142 }
143 #endif
144 
static void nrf52_sleep(void)
Put the CPU in the low-power 'wait for event' state.
Definition: cpu_conf.h:134