68
68
//!
69
69
//! - ARMv7-M Architecture Reference Manual (Issue E.b) - Chapter B3
70
70
71
- // TODO stand-alone registers: ICTR, ACTLR and STIR
71
+ // TODO stand-alone register: STIR
72
72
73
73
74
74
use core:: marker:: PhantomData ;
@@ -86,6 +86,7 @@ pub mod fpb;
86
86
// NOTE(target_arch) is for documentation purposes
87
87
#[ cfg( any( has_fpu, target_arch = "x86_64" ) ) ]
88
88
pub mod fpu;
89
+ pub mod icb;
89
90
#[ cfg( not( armv6m) ) ]
90
91
pub mod itm;
91
92
pub mod mpu;
@@ -122,7 +123,14 @@ pub struct Peripherals {
122
123
/// Floating Point Unit (only present on `thumbv7em-none-eabihf`)
123
124
pub FPU : FPU ,
124
125
125
- /// Instrumentation Trace Macrocell (not present on Cortex-M0 variants)
126
+ /// Implementation Control Block.
127
+ ///
128
+ /// The name is from the v8-M spec, but the block existed in earlier
129
+ /// revisions, without a name.
130
+ pub ICB : ICB ,
131
+
132
+ /// Instrumentation Trace Macrocell.
133
+ /// Not available on Armv6-M and Armv8-M Baseline.
126
134
pub ITM : ITM ,
127
135
128
136
/// Memory Protection Unit
@@ -183,6 +191,9 @@ impl Peripherals {
183
191
FPU : FPU {
184
192
_marker : PhantomData ,
185
193
} ,
194
+ ICB : ICB {
195
+ _marker : PhantomData ,
196
+ } ,
186
197
ITM : ITM {
187
198
_marker : PhantomData ,
188
199
} ,
@@ -362,6 +373,42 @@ impl ops::Deref for FPU {
362
373
}
363
374
}
364
375
376
+ /// Implementation Control Block.
377
+ ///
378
+ /// This block contains implementation-defined registers like `ictr` and
379
+ /// `actlr`. It's called the "implementation control block" in the ARMv8-M
380
+ /// standard, but earlier standards contained the registers, just without a
381
+ /// name.
382
+ pub struct ICB {
383
+ _marker : PhantomData < * const ( ) > ,
384
+ }
385
+
386
+ unsafe impl Send for ICB { }
387
+
388
+ impl ICB {
389
+ /// Returns a pointer to the register block
390
+ #[ inline( always) ]
391
+ pub fn ptr ( ) -> * mut icb:: RegisterBlock {
392
+ 0xE000_E004 as * mut _
393
+ }
394
+ }
395
+
396
+ impl ops:: Deref for ICB {
397
+ type Target = self :: icb:: RegisterBlock ;
398
+
399
+ #[ inline( always) ]
400
+ fn deref ( & self ) -> & Self :: Target {
401
+ unsafe { & * Self :: ptr ( ) }
402
+ }
403
+ }
404
+
405
+ impl ops:: DerefMut for ICB {
406
+ #[ inline( always) ]
407
+ fn deref_mut ( & mut self ) -> & mut Self :: Target {
408
+ unsafe { & mut * Self :: ptr ( ) }
409
+ }
410
+ }
411
+
365
412
/// Instrumentation Trace Macrocell
366
413
pub struct ITM {
367
414
_marker : PhantomData < * const ( ) > ,
0 commit comments