Skip to content

Commit fcdfeb4

Browse files
author
Marti Bolivar
committed
<libmaple/scb.h>: Don't use BIT().
Also, assert copyright LeafLabs 2012. Signed-off-by: Marti Bolivar <mbolivar@lozenge.(none)>
1 parent f006ea1 commit fcdfeb4

File tree

1 file changed

+60
-60
lines changed
  • libmaple/include/libmaple

1 file changed

+60
-60
lines changed

libmaple/include/libmaple/scb.h

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* The MIT License
33
*
44
* Copyright (c) 2010 Perry Hung.
5-
* Copyright (c) 2011 LeafLabs, LLC.
5+
* Copyright (c) 2011-2012 LeafLabs, LLC.
66
*
77
* Permission is hereby granted, free of charge, to any person
88
* obtaining a copy of this software and associated documentation
@@ -99,14 +99,14 @@ typedef struct scb_reg_map {
9999

100100
/* Interrupt control state register (SCB_ICSR) */
101101

102-
#define SCB_ICSR_NMIPENDSET BIT(31)
103-
#define SCB_ICSR_PENDSVSET BIT(28)
104-
#define SCB_ICSR_PENDSVCLR BIT(27)
105-
#define SCB_ICSR_PENDSTSET BIT(26)
106-
#define SCB_ICSR_PENDSTCLR BIT(25)
107-
#define SCB_ICSR_ISRPENDING BIT(22)
102+
#define SCB_ICSR_NMIPENDSET (1U << 31)
103+
#define SCB_ICSR_PENDSVSET (1U << 28)
104+
#define SCB_ICSR_PENDSVCLR (1U << 27)
105+
#define SCB_ICSR_PENDSTSET (1U << 26)
106+
#define SCB_ICSR_PENDSTCLR (1U << 25)
107+
#define SCB_ICSR_ISRPENDING (1U << 22)
108108
#define SCB_ICSR_VECTPENDING (0x3FF << 12)
109-
#define SCB_ICSR_RETOBASE BIT(11)
109+
#define SCB_ICSR_RETOBASE (1U << 11)
110110
#define SCB_ICSR_VECTACTIVE 0xFF
111111

112112
/* Vector table offset register (SCB_VTOR) */
@@ -117,26 +117,26 @@ typedef struct scb_reg_map {
117117

118118
#define SCB_AIRCR_VECTKEYSTAT (0x5FA << 16)
119119
#define SCB_AIRCR_VECTKEY (0x5FA << 16)
120-
#define SCB_AIRCR_ENDIANNESS BIT(15)
120+
#define SCB_AIRCR_ENDIANNESS (1U << 15)
121121
#define SCB_AIRCR_PRIGROUP (0x3 << 8)
122-
#define SCB_AIRCR_SYSRESETREQ BIT(2)
123-
#define SCB_AIRCR_VECTCLRACTIVE BIT(1)
124-
#define SCB_AIRCR_VECTRESET BIT(0)
122+
#define SCB_AIRCR_SYSRESETREQ (1U << 2)
123+
#define SCB_AIRCR_VECTCLRACTIVE (1U << 1)
124+
#define SCB_AIRCR_VECTRESET (1U << 0)
125125

126126
/* System control register (SCB_SCR) */
127127

128-
#define SCB_SCR_SEVONPEND BIT(4)
129-
#define SCB_SCR_SLEEPDEEP BIT(2)
130-
#define SCB_SCR_SLEEPONEXIT BIT(1)
128+
#define SCB_SCR_SEVONPEND (1U << 4)
129+
#define SCB_SCR_SLEEPDEEP (1U << 2)
130+
#define SCB_SCR_SLEEPONEXIT (1U << 1)
131131

132132
/* Configuration and Control Register (SCB_CCR) */
133133

134-
#define SCB_CCR_STKALIGN BIT(9)
135-
#define SCB_CCR_BFHFNMIGN BIT(8)
136-
#define SCB_CCR_DIV_0_TRP BIT(4)
137-
#define SCB_CCR_UNALIGN_TRP BIT(3)
138-
#define SCB_CCR_USERSETMPEND BIT(1)
139-
#define SCB_CCR_NONBASETHRDENA BIT(0)
134+
#define SCB_CCR_STKALIGN (1U << 9)
135+
#define SCB_CCR_BFHFNMIGN (1U << 8)
136+
#define SCB_CCR_DIV_0_TRP (1U << 4)
137+
#define SCB_CCR_UNALIGN_TRP (1U << 3)
138+
#define SCB_CCR_USERSETMPEND (1U << 1)
139+
#define SCB_CCR_NONBASETHRDENA (1U << 0)
140140

141141
/* System handler priority registers (SCB_SHPRx) */
142142

@@ -151,57 +151,57 @@ typedef struct scb_reg_map {
151151

152152
/* System Handler Control and state register (SCB_SHCSR) */
153153

154-
#define SCB_SHCSR_USGFAULTENA BIT(18)
155-
#define SCB_SHCSR_BUSFAULTENA BIT(17)
156-
#define SCB_SHCSR_MEMFAULTENA BIT(16)
157-
#define SCB_SHCSR_SVCALLPENDED BIT(15)
158-
#define SCB_SHCSR_BUSFAULTPENDED BIT(14)
159-
#define SCB_SHCSR_MEMFAULTPENDED BIT(13)
160-
#define SCB_SHCSR_USGFAULTPENDED BIT(12)
161-
#define SCB_SHCSR_SYSTICKACT BIT(11)
162-
#define SCB_SHCSR_PENDSVACT BIT(10)
163-
#define SCB_SHCSR_MONITORACT BIT(8)
164-
#define SCB_SHCSR_SVCALLACT BIT(7)
165-
#define SCB_SHCSR_USGFAULTACT BIT(3)
166-
#define SCB_SHCSR_BUSFAULTACT BIT(1)
167-
#define SCB_SHCSR_MEMFAULTACT BIT(0)
154+
#define SCB_SHCSR_USGFAULTENA (1U << 18)
155+
#define SCB_SHCSR_BUSFAULTENA (1U << 17)
156+
#define SCB_SHCSR_MEMFAULTENA (1U << 16)
157+
#define SCB_SHCSR_SVCALLPENDED (1U << 15)
158+
#define SCB_SHCSR_BUSFAULTPENDED (1U << 14)
159+
#define SCB_SHCSR_MEMFAULTPENDED (1U << 13)
160+
#define SCB_SHCSR_USGFAULTPENDED (1U << 12)
161+
#define SCB_SHCSR_SYSTICKACT (1U << 11)
162+
#define SCB_SHCSR_PENDSVACT (1U << 10)
163+
#define SCB_SHCSR_MONITORACT (1U << 8)
164+
#define SCB_SHCSR_SVCALLACT (1U << 7)
165+
#define SCB_SHCSR_USGFAULTACT (1U << 3)
166+
#define SCB_SHCSR_BUSFAULTACT (1U << 1)
167+
#define SCB_SHCSR_MEMFAULTACT (1U << 0)
168168

169169
/* Configurable fault status register (SCB_CFSR) */
170170

171-
#define SCB_CFSR_DIVBYZERO BIT(25)
172-
#define SCB_CFSR_UNALIGNED BIT(24)
173-
#define SCB_CFSR_NOCP BIT(19)
174-
#define SCB_CFSR_INVPC BIT(18)
175-
#define SCB_CFSR_INVSTATE BIT(17)
176-
#define SCB_CFSR_UNDEFINSTR BIT(16)
177-
#define SCB_CFSR_BFARVALID BIT(15)
178-
#define SCB_CFSR_STKERR BIT(12)
179-
#define SCB_CFSR_UNSTKERR BIT(11)
180-
#define SCB_CFSR_IMPRECISERR BIT(10)
181-
#define SCB_CFSR_PRECISERR BIT(9)
182-
#define SCB_CFSR_IBUSERR BIT(8)
183-
#define SCB_CFSR_MMARVALID BIT(7)
184-
#define SCB_CFSR_MSTKERR BIT(4)
185-
#define SCB_CFSR_MUNSTKERR BIT(3)
186-
#define SCB_CFSR_DACCVIOL BIT(1)
187-
#define SCB_CFSR_IACCVIOL BIT(0)
171+
#define SCB_CFSR_DIVBYZERO (1U << 25)
172+
#define SCB_CFSR_UNALIGNED (1U << 24)
173+
#define SCB_CFSR_NOCP (1U << 19)
174+
#define SCB_CFSR_INVPC (1U << 18)
175+
#define SCB_CFSR_INVSTATE (1U << 17)
176+
#define SCB_CFSR_UNDEFINSTR (1U << 16)
177+
#define SCB_CFSR_BFARVALID (1U << 15)
178+
#define SCB_CFSR_STKERR (1U << 12)
179+
#define SCB_CFSR_UNSTKERR (1U << 11)
180+
#define SCB_CFSR_IMPRECISERR (1U << 10)
181+
#define SCB_CFSR_PRECISERR (1U << 9)
182+
#define SCB_CFSR_IBUSERR (1U << 8)
183+
#define SCB_CFSR_MMARVALID (1U << 7)
184+
#define SCB_CFSR_MSTKERR (1U << 4)
185+
#define SCB_CFSR_MUNSTKERR (1U << 3)
186+
#define SCB_CFSR_DACCVIOL (1U << 1)
187+
#define SCB_CFSR_IACCVIOL (1U << 0)
188188

189189
/* Hard Fault Status Register (SCB_HFSR) */
190190

191-
#define SCB_HFSR_DEBUG_VT BIT(31)
192-
#define SCB_CFSR_FORCED BIT(30)
193-
#define SCB_CFSR_VECTTBL BIT(1)
191+
#define SCB_HFSR_DEBUG_VT (1U << 31)
192+
#define SCB_CFSR_FORCED (1U << 30)
193+
#define SCB_CFSR_VECTTBL (1U << 1)
194194

195195
/* Debug Fault Status Register */
196196

197197
/* Not specified by PM0056, but required by ARM. The bit definitions
198198
* here are based on the names given in the ARM v7-M ARM. */
199199

200-
#define SCB_DFSR_EXTERNAL BIT(4)
201-
#define SCB_DFSR_VCATCH BIT(3)
202-
#define SCB_DFSR_DWTTRAP BIT(2)
203-
#define SCB_DFSR_BKPT BIT(1)
204-
#define SCB_DFSR_HALTED BIT(0)
200+
#define SCB_DFSR_EXTERNAL (1U << 4)
201+
#define SCB_DFSR_VCATCH (1U << 3)
202+
#define SCB_DFSR_DWTTRAP (1U << 2)
203+
#define SCB_DFSR_BKPT (1U << 1)
204+
#define SCB_DFSR_HALTED (1U << 0)
205205

206206
#ifdef __cplusplus
207207
}

0 commit comments

Comments
 (0)