Skip to content

Commit 3040369

Browse files
committed
rename the types of core peripherals to UPPERCASE
closes #41
1 parent cba4bef commit 3040369

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/peripheral/mod.rs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,41 +16,41 @@ use interrupt::{CriticalSection, Nr};
1616
mod test;
1717

1818
/// CPUID
19-
pub const CPUID: Peripheral<Cpuid> = unsafe { Peripheral::new(0xE000_ED00) };
19+
pub const CPUID: Peripheral<CPUID> = unsafe { Peripheral::new(0xE000_ED00) };
2020

2121
/// Debug Control Block
22-
pub const DCB: Peripheral<Dcb> = unsafe { Peripheral::new(0xE000_EDF0) };
22+
pub const DCB: Peripheral<DCB> = unsafe { Peripheral::new(0xE000_EDF0) };
2323

2424
/// Data Watchpoint and Trace unit
25-
pub const DWT: Peripheral<Dwt> = unsafe { Peripheral::new(0xE000_1000) };
25+
pub const DWT: Peripheral<DWT> = unsafe { Peripheral::new(0xE000_1000) };
2626

2727
/// Flash Patch and Breakpoint unit
28-
pub const FPB: Peripheral<Fpb> = unsafe { Peripheral::new(0xE000_2000) };
28+
pub const FPB: Peripheral<FPB> = unsafe { Peripheral::new(0xE000_2000) };
2929

3030
/// Floating Point Unit
31-
pub const FPU: Peripheral<Fpu> = unsafe { Peripheral::new(0xE000_EF30) };
31+
pub const FPU: Peripheral<FPU> = unsafe { Peripheral::new(0xE000_EF30) };
3232

3333
/// Instrumentation Trace Macrocell
34-
pub const ITM: Peripheral<Itm> = unsafe { Peripheral::new(0xE000_0000) };
34+
pub const ITM: Peripheral<ITM> = unsafe { Peripheral::new(0xE000_0000) };
3535

3636
/// Memory Protection Unit
37-
pub const MPU: Peripheral<Mpu> = unsafe { Peripheral::new(0xE000_ED90) };
37+
pub const MPU: Peripheral<MPU> = unsafe { Peripheral::new(0xE000_ED90) };
3838

3939
/// Nested Vector Interrupt Controller
40-
pub const NVIC: Peripheral<Nvic> = unsafe { Peripheral::new(0xE000_E100) };
40+
pub const NVIC: Peripheral<NVIC> = unsafe { Peripheral::new(0xE000_E100) };
4141

4242
/// System Control Block
43-
pub const SCB: Peripheral<Scb> = unsafe { Peripheral::new(0xE000_ED04) };
43+
pub const SCB: Peripheral<SCB> = unsafe { Peripheral::new(0xE000_ED04) };
4444

4545
/// SysTick: System Timer
46-
pub const SYST: Peripheral<Syst> = unsafe { Peripheral::new(0xE000_E010) };
46+
pub const SYST: Peripheral<SYST> = unsafe { Peripheral::new(0xE000_E010) };
4747

4848
/// Trace Port Interface Unit;
49-
pub const TPIU: Peripheral<Tpiu> = unsafe { Peripheral::new(0xE004_0000) };
49+
pub const TPIU: Peripheral<TPIU> = unsafe { Peripheral::new(0xE004_0000) };
5050

5151
/// Cache and branch predictor maintenance operations
5252
#[cfg(armv7m)]
53-
pub const CBP: Peripheral<Cbp> = unsafe { Peripheral::new(0xE000_EF50) };
53+
pub const CBP: Peripheral<CBP> = unsafe { Peripheral::new(0xE000_EF50) };
5454

5555
// TODO stand-alone registers: ICTR, ACTLR and STIR
5656

@@ -88,7 +88,7 @@ impl<T> Peripheral<T> {
8888

8989
/// CPUID register block
9090
#[repr(C)]
91-
pub struct Cpuid {
91+
pub struct CPUID {
9292
/// CPUID base
9393
pub base: RO<u32>,
9494
reserved0: [u32; 15],
@@ -159,7 +159,7 @@ impl Cpuid {
159159

160160
/// DCB register block
161161
#[repr(C)]
162-
pub struct Dcb {
162+
pub struct DCB {
163163
/// Debug Halting Control and Status
164164
pub dhcsr: RW<u32>,
165165
/// Debug Core Register Selector
@@ -172,7 +172,7 @@ pub struct Dcb {
172172

173173
/// DWT register block
174174
#[repr(C)]
175-
pub struct Dwt {
175+
pub struct DWT {
176176
/// Control
177177
pub ctrl: RW<u32>,
178178
/// Cycle Count
@@ -198,7 +198,7 @@ pub struct Dwt {
198198
pub lsr: RO<u32>,
199199
}
200200

201-
impl Dwt {
201+
impl DWT {
202202
/// Enables the cycle counter
203203
pub fn enable_cycle_counter(&self) {
204204
unsafe { self.ctrl.modify(|r| r | 1) }
@@ -219,7 +219,7 @@ pub struct Comparator {
219219

220220
/// FPB register block
221221
#[repr(C)]
222-
pub struct Fpb {
222+
pub struct FPB {
223223
/// Control
224224
pub ctrl: RW<u32>,
225225
/// Remap
@@ -235,7 +235,7 @@ pub struct Fpb {
235235

236236
/// FPU register block
237237
#[repr(C)]
238-
pub struct Fpu {
238+
pub struct FPU {
239239
reserved: u32,
240240
/// Floating Point Context Control
241241
pub fpccr: RW<u32>,
@@ -249,7 +249,7 @@ pub struct Fpu {
249249

250250
/// ITM register block
251251
#[repr(C)]
252-
pub struct Itm {
252+
pub struct ITM {
253253
/// Stimulus Port
254254
pub stim: [Stim; 256],
255255
reserved0: [u32; 640],
@@ -297,7 +297,7 @@ impl Stim {
297297

298298
/// MPU register block
299299
#[repr(C)]
300-
pub struct Mpu {
300+
pub struct MPU {
301301
/// Type
302302
pub _type: RO<u32>,
303303
/// Control
@@ -324,7 +324,7 @@ pub struct Mpu {
324324

325325
/// NVIC register block
326326
#[repr(C)]
327-
pub struct Nvic {
327+
pub struct NVIC {
328328
/// Interrupt Set-Enable
329329
pub iser: [RW<u32>; 8],
330330
reserved0: [u32; 24],
@@ -344,7 +344,7 @@ pub struct Nvic {
344344
pub ipr: [RW<u8>; 240],
345345
}
346346

347-
impl Nvic {
347+
impl NVIC {
348348
/// Clears `interrupt`'s pending state
349349
pub fn clear_pending<I>(&self, interrupt: I)
350350
where
@@ -448,7 +448,7 @@ impl Nvic {
448448

449449
/// SCB register block
450450
#[repr(C)]
451-
pub struct Scb {
451+
pub struct SCB {
452452
/// Interrupt Control and State
453453
pub icsr: RW<u32>,
454454
/// Vector Table Offset
@@ -495,7 +495,7 @@ const SCB_CPACR_FPU_MASK: u32 = 0b11_11 << 20;
495495
const SCB_CPACR_FPU_ENABLE: u32 = 0b01_01 << 20;
496496
const SCB_CPACR_FPU_USER: u32 = 0b10_10 << 20;
497497

498-
impl Scb {
498+
impl SCB {
499499
/// Gets FPU access mode
500500
pub fn fpu_access_mode(&self) -> FpuAccessMode {
501501
let cpacr = self.cpacr.read();
@@ -817,7 +817,7 @@ impl Scb {
817817

818818
/// SysTick register block
819819
#[repr(C)]
820-
pub struct Syst {
820+
pub struct SYST {
821821
/// Control and Status
822822
pub csr: RW<u32>,
823823
/// Reload Value
@@ -847,7 +847,7 @@ const SYST_CSR_COUNTFLAG: u32 = 1 << 16;
847847
const SYST_CALIB_SKEW: u32 = 1 << 30;
848848
const SYST_CALIB_NOREF: u32 = 1 << 31;
849849

850-
impl Syst {
850+
impl SYST {
851851
/// Checks if counter is enabled
852852
pub fn is_counter_enabled(&self) -> bool {
853853
self.csr.read() & SYST_CSR_ENABLE != 0
@@ -955,7 +955,7 @@ impl Syst {
955955

956956
/// TPIU register block
957957
#[repr(C)]
958-
pub struct Tpiu {
958+
pub struct TPIU {
959959
/// Supported Parallel Port Sizes
960960
pub sspsr: RO<u32>,
961961
/// Current Parallel Port Size
@@ -979,7 +979,7 @@ pub struct Tpiu {
979979
/// Cache and branch predictor maintenance operations register block
980980
#[repr(C)]
981981
#[cfg(armv7m)]
982-
pub struct Cbp {
982+
pub struct CBP {
983983
/// I-cache invalidate all to PoU
984984
pub iciallu: WO<u32>,
985985
reserved0: u32,

0 commit comments

Comments
 (0)