@@ -231,16 +231,19 @@ unsafe impl Send for CBP {}
231
231
#[ cfg( not( armv6m) ) ]
232
232
impl CBP {
233
233
#[ inline( always) ]
234
- pub ( crate ) unsafe fn new ( ) -> Self {
234
+ pub ( crate ) const unsafe fn new ( ) -> Self {
235
235
CBP {
236
236
_marker : PhantomData ,
237
237
}
238
238
}
239
239
240
- /// Returns a pointer to the register block
240
+ /// Pointer to the register block
241
+ pub const PTR : * const self :: cbp:: RegisterBlock = 0xE000_EF50 as * const _ ;
242
+
243
+ /// Returns a pointer to the register block (to be deprecated in 0.7)
241
244
#[ inline( always) ]
242
- pub fn ptr ( ) -> * const self :: cbp:: RegisterBlock {
243
- 0xE000_EF50 as * const _
245
+ pub const fn ptr ( ) -> * const self :: cbp:: RegisterBlock {
246
+ Self :: PTR
244
247
}
245
248
}
246
249
@@ -250,7 +253,7 @@ impl ops::Deref for CBP {
250
253
251
254
#[ inline( always) ]
252
255
fn deref ( & self ) -> & Self :: Target {
253
- unsafe { & * Self :: ptr ( ) }
256
+ unsafe { & * Self :: PTR }
254
257
}
255
258
}
256
259
@@ -262,10 +265,13 @@ pub struct CPUID {
262
265
unsafe impl Send for CPUID { }
263
266
264
267
impl CPUID {
265
- /// Returns a pointer to the register block
268
+ /// Pointer to the register block
269
+ pub const PTR : * const self :: cpuid:: RegisterBlock = 0xE000_ED00 as * const _ ;
270
+
271
+ /// Returns a pointer to the register block (to be deprecated in 0.7)
266
272
#[ inline( always) ]
267
- pub fn ptr ( ) -> * const self :: cpuid:: RegisterBlock {
268
- 0xE000_ED00 as * const _
273
+ pub const fn ptr ( ) -> * const self :: cpuid:: RegisterBlock {
274
+ Self :: PTR
269
275
}
270
276
}
271
277
@@ -274,7 +280,7 @@ impl ops::Deref for CPUID {
274
280
275
281
#[ inline( always) ]
276
282
fn deref ( & self ) -> & Self :: Target {
277
- unsafe { & * Self :: ptr ( ) }
283
+ unsafe { & * Self :: PTR }
278
284
}
279
285
}
280
286
@@ -286,10 +292,13 @@ pub struct DCB {
286
292
unsafe impl Send for DCB { }
287
293
288
294
impl DCB {
289
- /// Returns a pointer to the register block
295
+ /// Pointer to the register block
296
+ pub const PTR : * const dcb:: RegisterBlock = 0xE000_EDF0 as * const _ ;
297
+
298
+ /// Returns a pointer to the register block (to be deprecated in 0.7)
290
299
#[ inline( always) ]
291
- pub fn ptr ( ) -> * const dcb:: RegisterBlock {
292
- 0xE000_EDF0 as * const _
300
+ pub const fn ptr ( ) -> * const dcb:: RegisterBlock {
301
+ Self :: PTR
293
302
}
294
303
}
295
304
@@ -298,7 +307,7 @@ impl ops::Deref for DCB {
298
307
299
308
#[ inline( always) ]
300
309
fn deref ( & self ) -> & Self :: Target {
301
- unsafe { & * DCB :: ptr ( ) }
310
+ unsafe { & * DCB :: PTR }
302
311
}
303
312
}
304
313
@@ -310,10 +319,13 @@ pub struct DWT {
310
319
unsafe impl Send for DWT { }
311
320
312
321
impl DWT {
313
- /// Returns a pointer to the register block
322
+ /// Pointer to the register block
323
+ pub const PTR : * const dwt:: RegisterBlock = 0xE000_1000 as * const _ ;
324
+
325
+ /// Returns a pointer to the register block (to be deprecated in 0.7)
314
326
#[ inline( always) ]
315
- pub fn ptr ( ) -> * const dwt:: RegisterBlock {
316
- 0xE000_1000 as * const _
327
+ pub const fn ptr ( ) -> * const dwt:: RegisterBlock {
328
+ Self :: PTR
317
329
}
318
330
}
319
331
@@ -322,7 +334,7 @@ impl ops::Deref for DWT {
322
334
323
335
#[ inline( always) ]
324
336
fn deref ( & self ) -> & Self :: Target {
325
- unsafe { & * Self :: ptr ( ) }
337
+ unsafe { & * Self :: PTR }
326
338
}
327
339
}
328
340
@@ -335,10 +347,13 @@ unsafe impl Send for FPB {}
335
347
336
348
#[ cfg( not( armv6m) ) ]
337
349
impl FPB {
338
- /// Returns a pointer to the register block
350
+ /// Pointer to the register block
351
+ pub const PTR : * const fpb:: RegisterBlock = 0xE000_2000 as * const _ ;
352
+
353
+ /// Returns a pointer to the register block (to be deprecated in 0.7)
339
354
#[ inline( always) ]
340
- pub fn ptr ( ) -> * const fpb:: RegisterBlock {
341
- 0xE000_2000 as * const _
355
+ pub const fn ptr ( ) -> * const fpb:: RegisterBlock {
356
+ Self :: PTR
342
357
}
343
358
}
344
359
@@ -348,7 +363,7 @@ impl ops::Deref for FPB {
348
363
349
364
#[ inline( always) ]
350
365
fn deref ( & self ) -> & Self :: Target {
351
- unsafe { & * Self :: ptr ( ) }
366
+ unsafe { & * Self :: PTR }
352
367
}
353
368
}
354
369
@@ -361,10 +376,13 @@ unsafe impl Send for FPU {}
361
376
362
377
#[ cfg( any( has_fpu, target_arch = "x86_64" ) ) ]
363
378
impl FPU {
364
- /// Returns a pointer to the register block
379
+ /// Pointer to the register block
380
+ pub const PTR : * const fpu:: RegisterBlock = 0xE000_EF30 as * const _ ;
381
+
382
+ /// Returns a pointer to the register block (to be deprecated in 0.7)
365
383
#[ inline( always) ]
366
- pub fn ptr ( ) -> * const fpu:: RegisterBlock {
367
- 0xE000_EF30 as * const _
384
+ pub const fn ptr ( ) -> * const fpu:: RegisterBlock {
385
+ Self :: PTR
368
386
}
369
387
}
370
388
@@ -374,7 +392,7 @@ impl ops::Deref for FPU {
374
392
375
393
#[ inline( always) ]
376
394
fn deref ( & self ) -> & Self :: Target {
377
- unsafe { & * Self :: ptr ( ) }
395
+ unsafe { & * Self :: PTR }
378
396
}
379
397
}
380
398
@@ -391,10 +409,13 @@ pub struct ICB {
391
409
unsafe impl Send for ICB { }
392
410
393
411
impl ICB {
394
- /// Returns a pointer to the register block
412
+ /// Pointer to the register block
413
+ pub const PTR : * mut icb:: RegisterBlock = 0xE000_E004 as * mut _ ;
414
+
415
+ /// Returns a pointer to the register block (to be deprecated in 0.7)
395
416
#[ inline( always) ]
396
- pub fn ptr ( ) -> * mut icb:: RegisterBlock {
397
- 0xE000_E004 as * mut _
417
+ pub const fn ptr ( ) -> * mut icb:: RegisterBlock {
418
+ Self :: PTR
398
419
}
399
420
}
400
421
@@ -403,14 +424,14 @@ impl ops::Deref for ICB {
403
424
404
425
#[ inline( always) ]
405
426
fn deref ( & self ) -> & Self :: Target {
406
- unsafe { & * Self :: ptr ( ) }
427
+ unsafe { & * Self :: PTR }
407
428
}
408
429
}
409
430
410
431
impl ops:: DerefMut for ICB {
411
432
#[ inline( always) ]
412
433
fn deref_mut ( & mut self ) -> & mut Self :: Target {
413
- unsafe { & mut * Self :: ptr ( ) }
434
+ unsafe { & mut * Self :: PTR }
414
435
}
415
436
}
416
437
@@ -423,10 +444,13 @@ unsafe impl Send for ITM {}
423
444
424
445
#[ cfg( all( not( armv6m) , not( armv8m_base) ) ) ]
425
446
impl ITM {
426
- /// Returns a pointer to the register block
447
+ /// Pointer to the register block
448
+ pub const PTR : * mut itm:: RegisterBlock = 0xE000_0000 as * mut _ ;
449
+
450
+ /// Returns a pointer to the register block (to be deprecated in 0.7)
427
451
#[ inline( always) ]
428
- pub fn ptr ( ) -> * mut itm:: RegisterBlock {
429
- 0xE000_0000 as * mut _
452
+ pub const fn ptr ( ) -> * mut itm:: RegisterBlock {
453
+ Self :: PTR
430
454
}
431
455
}
432
456
@@ -436,15 +460,15 @@ impl ops::Deref for ITM {
436
460
437
461
#[ inline( always) ]
438
462
fn deref ( & self ) -> & Self :: Target {
439
- unsafe { & * Self :: ptr ( ) }
463
+ unsafe { & * Self :: PTR }
440
464
}
441
465
}
442
466
443
467
#[ cfg( all( not( armv6m) , not( armv8m_base) ) ) ]
444
468
impl ops:: DerefMut for ITM {
445
469
#[ inline( always) ]
446
470
fn deref_mut ( & mut self ) -> & mut Self :: Target {
447
- unsafe { & mut * Self :: ptr ( ) }
471
+ unsafe { & mut * Self :: PTR }
448
472
}
449
473
}
450
474
@@ -456,10 +480,13 @@ pub struct MPU {
456
480
unsafe impl Send for MPU { }
457
481
458
482
impl MPU {
459
- /// Returns a pointer to the register block
483
+ /// Pointer to the register block
484
+ pub const PTR : * const mpu:: RegisterBlock = 0xE000_ED90 as * const _ ;
485
+
486
+ /// Returns a pointer to the register block (to be deprecated in 0.7)
460
487
#[ inline( always) ]
461
- pub fn ptr ( ) -> * const mpu:: RegisterBlock {
462
- 0xE000_ED90 as * const _
488
+ pub const fn ptr ( ) -> * const mpu:: RegisterBlock {
489
+ Self :: PTR
463
490
}
464
491
}
465
492
@@ -468,7 +495,7 @@ impl ops::Deref for MPU {
468
495
469
496
#[ inline( always) ]
470
497
fn deref ( & self ) -> & Self :: Target {
471
- unsafe { & * Self :: ptr ( ) }
498
+ unsafe { & * Self :: PTR }
472
499
}
473
500
}
474
501
@@ -480,10 +507,13 @@ pub struct NVIC {
480
507
unsafe impl Send for NVIC { }
481
508
482
509
impl NVIC {
483
- /// Returns a pointer to the register block
510
+ /// Pointer to the register block
511
+ pub const PTR : * const nvic:: RegisterBlock = 0xE000_E100 as * const _ ;
512
+
513
+ /// Returns a pointer to the register block (to be deprecated in 0.7)
484
514
#[ inline( always) ]
485
- pub fn ptr ( ) -> * const nvic:: RegisterBlock {
486
- 0xE000_E100 as * const _
515
+ pub const fn ptr ( ) -> * const nvic:: RegisterBlock {
516
+ Self :: PTR
487
517
}
488
518
}
489
519
@@ -492,7 +522,7 @@ impl ops::Deref for NVIC {
492
522
493
523
#[ inline( always) ]
494
524
fn deref ( & self ) -> & Self :: Target {
495
- unsafe { & * Self :: ptr ( ) }
525
+ unsafe { & * Self :: PTR }
496
526
}
497
527
}
498
528
@@ -505,10 +535,13 @@ unsafe impl Send for SAU {}
505
535
506
536
#[ cfg( armv8m) ]
507
537
impl SAU {
508
- /// Returns a pointer to the register block
538
+ /// Pointer to the register block
539
+ pub const PTR : * const sau:: RegisterBlock = 0xE000_EDD0 as * const _ ;
540
+
541
+ /// Returns a pointer to the register block (to be deprecated in 0.7)
509
542
#[ inline( always) ]
510
- pub fn ptr ( ) -> * const sau:: RegisterBlock {
511
- 0xE000_EDD0 as * const _
543
+ pub const fn ptr ( ) -> * const sau:: RegisterBlock {
544
+ Self :: PTR
512
545
}
513
546
}
514
547
@@ -518,7 +551,7 @@ impl ops::Deref for SAU {
518
551
519
552
#[ inline( always) ]
520
553
fn deref ( & self ) -> & Self :: Target {
521
- unsafe { & * Self :: ptr ( ) }
554
+ unsafe { & * Self :: PTR }
522
555
}
523
556
}
524
557
@@ -530,10 +563,13 @@ pub struct SCB {
530
563
unsafe impl Send for SCB { }
531
564
532
565
impl SCB {
533
- /// Returns a pointer to the register block
566
+ /// Pointer to the register block
567
+ pub const PTR : * const scb:: RegisterBlock = 0xE000_ED04 as * const _ ;
568
+
569
+ /// Returns a pointer to the register block (to be deprecated in 0.7)
534
570
#[ inline( always) ]
535
- pub fn ptr ( ) -> * const scb:: RegisterBlock {
536
- 0xE000_ED04 as * const _
571
+ pub const fn ptr ( ) -> * const scb:: RegisterBlock {
572
+ Self :: PTR
537
573
}
538
574
}
539
575
@@ -542,7 +578,7 @@ impl ops::Deref for SCB {
542
578
543
579
#[ inline( always) ]
544
580
fn deref ( & self ) -> & Self :: Target {
545
- unsafe { & * Self :: ptr ( ) }
581
+ unsafe { & * Self :: PTR }
546
582
}
547
583
}
548
584
@@ -554,10 +590,13 @@ pub struct SYST {
554
590
unsafe impl Send for SYST { }
555
591
556
592
impl SYST {
557
- /// Returns a pointer to the register block
593
+ /// Pointer to the register block
594
+ pub const PTR : * const syst:: RegisterBlock = 0xE000_E010 as * const _ ;
595
+
596
+ /// Returns a pointer to the register block (to be deprecated in 0.7)
558
597
#[ inline( always) ]
559
- pub fn ptr ( ) -> * const syst:: RegisterBlock {
560
- 0xE000_E010 as * const _
598
+ pub const fn ptr ( ) -> * const syst:: RegisterBlock {
599
+ Self :: PTR
561
600
}
562
601
}
563
602
@@ -566,7 +605,7 @@ impl ops::Deref for SYST {
566
605
567
606
#[ inline( always) ]
568
607
fn deref ( & self ) -> & Self :: Target {
569
- unsafe { & * Self :: ptr ( ) }
608
+ unsafe { & * Self :: PTR }
570
609
}
571
610
}
572
611
@@ -579,10 +618,13 @@ unsafe impl Send for TPIU {}
579
618
580
619
#[ cfg( not( armv6m) ) ]
581
620
impl TPIU {
582
- /// Returns a pointer to the register block
621
+ /// Pointer to the register block
622
+ pub const PTR : * const tpiu:: RegisterBlock = 0xE004_0000 as * const _ ;
623
+
624
+ /// Returns a pointer to the register block (to be deprecated in 0.7)
583
625
#[ inline( always) ]
584
- pub fn ptr ( ) -> * const tpiu:: RegisterBlock {
585
- 0xE004_0000 as * const _
626
+ pub const fn ptr ( ) -> * const tpiu:: RegisterBlock {
627
+ Self :: PTR
586
628
}
587
629
}
588
630
@@ -592,6 +634,6 @@ impl ops::Deref for TPIU {
592
634
593
635
#[ inline( always) ]
594
636
fn deref ( & self ) -> & Self :: Target {
595
- unsafe { & * Self :: ptr ( ) }
637
+ unsafe { & * Self :: PTR }
596
638
}
597
639
}
0 commit comments