CC23x0R5DriverLibrary
hw_scb.h
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: hw_scb_h
3 ******************************************************************************
4 * Copyright (c) 2021 Texas Instruments Incorporated. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * 1) Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 *
12 * 2) Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
15 *
16 * 3) Neither the name of the copyright holder nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 ******************************************************************************/
32 
33 #ifndef __HW_SCB_H__
34 #define __HW_SCB_H__
35 
36 //*****************************************************************************
37 //
38 // This section defines the register offsets of
39 // SCB component
40 //
41 //*****************************************************************************
42 // CPUID Base Register
43 #define SCB_O_CPUID 0x00000000U
44 
45 // Interrupt Control State Register
46 #define SCB_O_ICSR 0x00000004U
47 
48 // Vector Table Offset Register
49 #define SCB_O_VTOR 0x00000008U
50 
51 // Application Interrupt and Reset Control Register
52 #define SCB_O_AIRCR 0x0000000CU
53 
54 // System Control Register
55 #define SCB_O_SCR 0x00000010U
56 
57 // Configuration and Control Register
58 #define SCB_O_CCR 0x00000014U
59 
60 // System Handler Priority Register 2
61 #define SCB_O_SHPR2 0x0000001CU
62 
63 // System Handler Priority Register 3
64 #define SCB_O_SHPR3 0x00000020U
65 
66 // System Handler Control and State Register
67 #define SCB_O_SHCSR 0x00000024U
68 
69 //*****************************************************************************
70 //
71 // Register: SCB_O_CPUID
72 //
73 //*****************************************************************************
74 // Field: [31:24] IMPLEMENTER
75 //
76 // Implementor code: 0x41 = ARM
77 #define SCB_CPUID_IMPLEMENTER_W 8U
78 #define SCB_CPUID_IMPLEMENTER_M 0xFF000000U
79 #define SCB_CPUID_IMPLEMENTER_S 24U
80 
81 // Field: [23:20] VARIANT
82 //
83 // Implementation defined variant number: 0x0 (for r0)
84 #define SCB_CPUID_VARIANT_W 4U
85 #define SCB_CPUID_VARIANT_M 0x00F00000U
86 #define SCB_CPUID_VARIANT_S 20U
87 
88 // Field: [19:16] CONSTANT
89 //
90 // Reads as 0xC
91 #define SCB_CPUID_CONSTANT_W 4U
92 #define SCB_CPUID_CONSTANT_M 0x000F0000U
93 #define SCB_CPUID_CONSTANT_S 16U
94 
95 // Field: [15:4] PARTNO
96 //
97 // Number of processor within family: 0xC20
98 #define SCB_CPUID_PARTNO_W 12U
99 #define SCB_CPUID_PARTNO_M 0x0000FFF0U
100 #define SCB_CPUID_PARTNO_S 4U
101 
102 // Field: [3:0] REVISION
103 //
104 // Implementation defined revision number: 0x1 = processor p1 revision.
105 #define SCB_CPUID_REVISION_W 4U
106 #define SCB_CPUID_REVISION_M 0x0000000FU
107 #define SCB_CPUID_REVISION_S 0U
108 
109 //*****************************************************************************
110 //
111 // Register: SCB_O_ICSR
112 //
113 //*****************************************************************************
114 // Field: [31] NMIPENDSET
115 //
116 // Setting this bit will activate an NMI. Since NMI is the highest priority
117 // exception, it will activate as soon as it is registered. Reads back with
118 // current state (1 if Pending, 0 if not).
119 // 0x0:No effect
120 // 0x1:Set pending nmi
121 #define SCB_ICSR_NMIPENDSET 0x80000000U
122 #define SCB_ICSR_NMIPENDSET_M 0x80000000U
123 #define SCB_ICSR_NMIPENDSET_S 31U
124 
125 // Field: [28] PENDSVSET
126 //
127 // Set pending PendSV bit. On reads this bit returns the pending state of
128 // PendSV
129 // 0x0:No effect
130 // 0x1:Set pending pendsv
131 #define SCB_ICSR_PENDSVSET 0x10000000U
132 #define SCB_ICSR_PENDSVSET_M 0x10000000U
133 #define SCB_ICSR_PENDSVSET_S 28U
134 
135 // Field: [27] PENDSVCLR
136 //
137 // Clear pending PendSV bit
138 // 0x0:No effect
139 // 0x1:Clear pending pendsv
140 #define SCB_ICSR_PENDSVCLR 0x08000000U
141 #define SCB_ICSR_PENDSVCLR_M 0x08000000U
142 #define SCB_ICSR_PENDSVCLR_S 27U
143 
144 // Field: [26] PENDSTSET
145 //
146 // Set a pending SysTick bit. On reads this bit returns the pending state of
147 // SysTick.
148 // 0x0:No effect
149 // 0x1:Set pending systick
150 #define SCB_ICSR_PENDSTSET 0x04000000U
151 #define SCB_ICSR_PENDSTSET_M 0x04000000U
152 #define SCB_ICSR_PENDSTSET_S 26U
153 
154 // Field: [25] PENDSTCLR
155 //
156 // Clear pending SysTick bit
157 // 0x0:No effect
158 // 0x1:Clear pending systick
159 #define SCB_ICSR_PENDSTCLR 0x02000000U
160 #define SCB_ICSR_PENDSTCLR_M 0x02000000U
161 #define SCB_ICSR_PENDSTCLR_S 25U
162 
163 // Field: [23] ISRPREEMPT
164 //
165 // The system can only access this bit when the core is halted. It indicates
166 // that a pending interrupt is to be taken in the next running cycle. If
167 // C_MASKINTS is clear in the Debug Halting Control and Status Register, the
168 // interrupt is serviced.
169 // 0x0:A pending exception is not serviced.
170 // 0x1:A pending exception is serviced on exit from the debug halt state
171 #define SCB_ICSR_ISRPREEMPT 0x00800000U
172 #define SCB_ICSR_ISRPREEMPT_M 0x00800000U
173 #define SCB_ICSR_ISRPREEMPT_S 23U
174 
175 // Field: [22] ISRPENDING
176 //
177 // External interrupt pending flag
178 // 0x0:Interrupt not pending
179 // 0x1:Interrupt pending
180 #define SCB_ICSR_ISRPENDING 0x00400000U
181 #define SCB_ICSR_ISRPENDING_M 0x00400000U
182 #define SCB_ICSR_ISRPENDING_S 22U
183 
184 // Field: [20:12] VECTPENDING
185 //
186 // Indicates the exception number for the highest priority pending exception: 0
187 // = no pending exceptions. Non zero = The pending state includes the effect of
188 // memory-mapped enable and mask registers. It does not include the PRIMASK
189 // special-purpose register qualifier.
190 #define SCB_ICSR_VECTPENDING_W 9U
191 #define SCB_ICSR_VECTPENDING_M 0x001FF000U
192 #define SCB_ICSR_VECTPENDING_S 12U
193 
194 // Field: [8:0] VECTACTIVE
195 //
196 // Active exception number field. Reset clears the VECTACTIVE field.
197 #define SCB_ICSR_VECTACTIVE_W 9U
198 #define SCB_ICSR_VECTACTIVE_M 0x000001FFU
199 #define SCB_ICSR_VECTACTIVE_S 0U
200 
201 //*****************************************************************************
202 //
203 // Register: SCB_O_VTOR
204 //
205 //*****************************************************************************
206 // Field: [31:8] TBLOFF
207 //
208 // Bits [31:8] of the indicate the vector table offset address.
209 #define SCB_VTOR_TBLOFF_W 24U
210 #define SCB_VTOR_TBLOFF_M 0xFFFFFF00U
211 #define SCB_VTOR_TBLOFF_S 8U
212 
213 //*****************************************************************************
214 //
215 // Register: SCB_O_AIRCR
216 //
217 //*****************************************************************************
218 // Field: [31:16] VECTKEY
219 //
220 // Register key. To write to other parts of this register, you must ensure
221 // 0x5FA is written into the VECTKEY field.
222 #define SCB_AIRCR_VECTKEY_W 16U
223 #define SCB_AIRCR_VECTKEY_M 0xFFFF0000U
224 #define SCB_AIRCR_VECTKEY_S 16U
225 
226 // Field: [15] ENDIANESS
227 //
228 // Data endianness bit. The read value depends on the endian configuration
229 // implemented
230 // 0x0:Little endian
231 // 0x1:Be-8 big-endian
232 #define SCB_AIRCR_ENDIANESS 0x00008000U
233 #define SCB_AIRCR_ENDIANESS_M 0x00008000U
234 #define SCB_AIRCR_ENDIANESS_S 15U
235 
236 // Field: [2] SYSRESETREQ
237 //
238 // Writing 1 to this bit causes the SYSRESETREQ signal to the outer system to
239 // be asserted to request a reset. The intention is to force a large system
240 // reset of all major components except for debug. The C_HALT bit in the DHCSR
241 // is cleared as a result of the system reset requested. The debugger does not
242 // lose contact with the device.
243 #define SCB_AIRCR_SYSRESETREQ 0x00000004U
244 #define SCB_AIRCR_SYSRESETREQ_M 0x00000004U
245 #define SCB_AIRCR_SYSRESETREQ_S 2U
246 
247 // Field: [1] VECTCLRACTIVE
248 //
249 // Clears all active state information for fixed and configurable exceptions.
250 // This bit: is self-clearing, can only be set by the DAP when the core is
251 // halted. When set: clears all active exception status of the processor,
252 // forces a return to Thread mode, forces an IPSR of 0. A debugger must
253 // re-initialize the stack.
254 #define SCB_AIRCR_VECTCLRACTIVE 0x00000002U
255 #define SCB_AIRCR_VECTCLRACTIVE_M 0x00000002U
256 #define SCB_AIRCR_VECTCLRACTIVE_S 1U
257 
258 //*****************************************************************************
259 //
260 // Register: SCB_O_SCR
261 //
262 //*****************************************************************************
263 // Field: [4] SEVONPEND
264 //
265 // When enabled, this causes WFE to wake up when an interrupt moves from
266 // inactive to pended. Otherwise, WFE only wakes up from an event signal,
267 // external and SEV instruction generated. The event input, RXEV, is registered
268 // even when not waiting for an event, and so effects the next WFE.
269 #define SCB_SCR_SEVONPEND 0x00000010U
270 #define SCB_SCR_SEVONPEND_M 0x00000010U
271 #define SCB_SCR_SEVONPEND_S 4U
272 
273 // Field: [2] SLEEPDEEP
274 //
275 // Sleep deep bit.
276 // ENUMs:
277 // DSLP_EN indicates to the system that Cortex-M0 clock can
278 // be stopped. Setting this bit causes the
279 // SLEEPDEEP port to be asserted when the
280 // processor can be stopped.
281 // DSLP_DIS not OK to turn off system clock
282 #define SCB_SCR_SLEEPDEEP 0x00000004U
283 #define SCB_SCR_SLEEPDEEP_M 0x00000004U
284 #define SCB_SCR_SLEEPDEEP_S 2U
285 #define SCB_SCR_SLEEPDEEP_DSLP_EN 0x00000004U
286 #define SCB_SCR_SLEEPDEEP_DSLP_DIS 0x00000000U
287 
288 // Field: [1] SLEEPONEXIT
289 //
290 // Sleep on exit when returning from Handler mode to Thread mode. Enables
291 // interrupt driven applications to avoid returning to empty main application.
292 // ENUMs:
293 // SLP_EN Sleep on return to thread mode
294 // SLP_DIS Do not sleep when returning to thread mode
295 #define SCB_SCR_SLEEPONEXIT 0x00000002U
296 #define SCB_SCR_SLEEPONEXIT_M 0x00000002U
297 #define SCB_SCR_SLEEPONEXIT_S 1U
298 #define SCB_SCR_SLEEPONEXIT_SLP_EN 0x00000002U
299 #define SCB_SCR_SLEEPONEXIT_SLP_DIS 0x00000000U
300 
301 //*****************************************************************************
302 //
303 // Register: SCB_O_CCR
304 //
305 //*****************************************************************************
306 // Field: [9] STKALIGN
307 //
308 // Always set to 1. On exception entry, all exceptions are entered with 8-byte
309 // stack alignment and the context to restore it is saved. The SP is restored
310 // on the associated exception return.
311 #define SCB_CCR_STKALIGN 0x00000200U
312 #define SCB_CCR_STKALIGN_M 0x00000200U
313 #define SCB_CCR_STKALIGN_S 9U
314 
315 // Field: [3] UNALIGN_TRP
316 //
317 // Indicates that all unaligned accesses results in a Hard Fault. Trap for
318 // unaligned access is fixed at 1.
319 #define SCB_CCR_UNALIGN_TRP 0x00000008U
320 #define SCB_CCR_UNALIGN_TRP_M 0x00000008U
321 #define SCB_CCR_UNALIGN_TRP_S 3U
322 
323 //*****************************************************************************
324 //
325 // Register: SCB_O_SHPR2
326 //
327 //*****************************************************************************
328 // Field: [31:30] PRI_11
329 //
330 // Priority of system handler 11, SVCall
331 #define SCB_SHPR2_PRI_11_W 2U
332 #define SCB_SHPR2_PRI_11_M 0xC0000000U
333 #define SCB_SHPR2_PRI_11_S 30U
334 
335 //*****************************************************************************
336 //
337 // Register: SCB_O_SHPR3
338 //
339 //*****************************************************************************
340 // Field: [31:30] PRI_15
341 //
342 // Priority of system handler 15, SysTick
343 #define SCB_SHPR3_PRI_15_W 2U
344 #define SCB_SHPR3_PRI_15_M 0xC0000000U
345 #define SCB_SHPR3_PRI_15_S 30U
346 
347 // Field: [23:22] PRI_14
348 //
349 // Priority of system handler 14, PendSV
350 #define SCB_SHPR3_PRI_14_W 2U
351 #define SCB_SHPR3_PRI_14_M 0x00C00000U
352 #define SCB_SHPR3_PRI_14_S 22U
353 
354 //*****************************************************************************
355 //
356 // Register: SCB_O_SHCSR
357 //
358 //*****************************************************************************
359 // Field: [15] SVCALLPENDED
360 //
361 // Reads as 1 if SVCall is Pending. Write 1 to set pending SVCall, write 0 to
362 // clear pending SVCall.
363 #define SCB_SHCSR_SVCALLPENDED 0x00008000U
364 #define SCB_SHCSR_SVCALLPENDED_M 0x00008000U
365 #define SCB_SHCSR_SVCALLPENDED_S 15U
366 
367 
368 #endif // __SCB__