Skip to content

Commit 881620c

Browse files
committed
Peipheral deref/ptr APIs now use associated const PTR
1 parent 8c77af3 commit 881620c

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

src/peripheral/mod.rs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ impl CBP {
243243
/// Returns a pointer to the register block (to be deprecated in 0.7)
244244
#[inline(always)]
245245
pub const fn ptr() -> *const self::cbp::RegisterBlock {
246-
0xE000_EF50 as *const _
246+
Self::PTR
247247
}
248248
}
249249

@@ -253,7 +253,7 @@ impl ops::Deref for CBP {
253253

254254
#[inline(always)]
255255
fn deref(&self) -> &Self::Target {
256-
unsafe { &*Self::ptr() }
256+
unsafe { &*Self::PTR }
257257
}
258258
}
259259

@@ -271,7 +271,7 @@ impl CPUID {
271271
/// Returns a pointer to the register block (to be deprecated in 0.7)
272272
#[inline(always)]
273273
pub const fn ptr() -> *const self::cpuid::RegisterBlock {
274-
0xE000_ED00 as *const _
274+
Self::PTR
275275
}
276276
}
277277

@@ -280,7 +280,7 @@ impl ops::Deref for CPUID {
280280

281281
#[inline(always)]
282282
fn deref(&self) -> &Self::Target {
283-
unsafe { &*Self::ptr() }
283+
unsafe { &*Self::PTR }
284284
}
285285
}
286286

@@ -298,7 +298,7 @@ impl DCB {
298298
/// Returns a pointer to the register block (to be deprecated in 0.7)
299299
#[inline(always)]
300300
pub const fn ptr() -> *const dcb::RegisterBlock {
301-
0xE000_EDF0 as *const _
301+
Self::PTR
302302
}
303303
}
304304

@@ -307,7 +307,7 @@ impl ops::Deref for DCB {
307307

308308
#[inline(always)]
309309
fn deref(&self) -> &Self::Target {
310-
unsafe { &*DCB::ptr() }
310+
unsafe { &*DCB::PTR }
311311
}
312312
}
313313

@@ -325,7 +325,7 @@ impl DWT {
325325
/// Returns a pointer to the register block (to be deprecated in 0.7)
326326
#[inline(always)]
327327
pub const fn ptr() -> *const dwt::RegisterBlock {
328-
0xE000_1000 as *const _
328+
Self::PTR
329329
}
330330
}
331331

@@ -334,7 +334,7 @@ impl ops::Deref for DWT {
334334

335335
#[inline(always)]
336336
fn deref(&self) -> &Self::Target {
337-
unsafe { &*Self::ptr() }
337+
unsafe { &*Self::PTR }
338338
}
339339
}
340340

@@ -353,7 +353,7 @@ impl FPB {
353353
/// Returns a pointer to the register block (to be deprecated in 0.7)
354354
#[inline(always)]
355355
pub const fn ptr() -> *const fpb::RegisterBlock {
356-
0xE000_2000 as *const _
356+
Self::PTR
357357
}
358358
}
359359

@@ -363,7 +363,7 @@ impl ops::Deref for FPB {
363363

364364
#[inline(always)]
365365
fn deref(&self) -> &Self::Target {
366-
unsafe { &*Self::ptr() }
366+
unsafe { &*Self::PTR }
367367
}
368368
}
369369

@@ -382,7 +382,7 @@ impl FPU {
382382
/// Returns a pointer to the register block (to be deprecated in 0.7)
383383
#[inline(always)]
384384
pub const fn ptr() -> *const fpu::RegisterBlock {
385-
0xE000_EF30 as *const _
385+
Self::PTR
386386
}
387387
}
388388

@@ -392,7 +392,7 @@ impl ops::Deref for FPU {
392392

393393
#[inline(always)]
394394
fn deref(&self) -> &Self::Target {
395-
unsafe { &*Self::ptr() }
395+
unsafe { &*Self::PTR }
396396
}
397397
}
398398

@@ -415,7 +415,7 @@ impl ICB {
415415
/// Returns a pointer to the register block (to be deprecated in 0.7)
416416
#[inline(always)]
417417
pub const fn ptr() -> *mut icb::RegisterBlock {
418-
0xE000_E004 as *mut _
418+
Self::PTR
419419
}
420420
}
421421

@@ -424,14 +424,14 @@ impl ops::Deref for ICB {
424424

425425
#[inline(always)]
426426
fn deref(&self) -> &Self::Target {
427-
unsafe { &*Self::ptr() }
427+
unsafe { &*Self::PTR }
428428
}
429429
}
430430

431431
impl ops::DerefMut for ICB {
432432
#[inline(always)]
433433
fn deref_mut(&mut self) -> &mut Self::Target {
434-
unsafe { &mut *Self::ptr() }
434+
unsafe { &mut *Self::PTR }
435435
}
436436
}
437437

@@ -450,7 +450,7 @@ impl ITM {
450450
/// Returns a pointer to the register block (to be deprecated in 0.7)
451451
#[inline(always)]
452452
pub const fn ptr() -> *mut itm::RegisterBlock {
453-
0xE000_0000 as *mut _
453+
Self::PTR
454454
}
455455
}
456456

@@ -460,15 +460,15 @@ impl ops::Deref for ITM {
460460

461461
#[inline(always)]
462462
fn deref(&self) -> &Self::Target {
463-
unsafe { &*Self::ptr() }
463+
unsafe { &*Self::PTR }
464464
}
465465
}
466466

467467
#[cfg(all(not(armv6m), not(armv8m_base)))]
468468
impl ops::DerefMut for ITM {
469469
#[inline(always)]
470470
fn deref_mut(&mut self) -> &mut Self::Target {
471-
unsafe { &mut *Self::ptr() }
471+
unsafe { &mut *Self::PTR }
472472
}
473473
}
474474

@@ -486,7 +486,7 @@ impl MPU {
486486
/// Returns a pointer to the register block (to be deprecated in 0.7)
487487
#[inline(always)]
488488
pub const fn ptr() -> *const mpu::RegisterBlock {
489-
0xE000_ED90 as *const _
489+
Self::PTR
490490
}
491491
}
492492

@@ -495,7 +495,7 @@ impl ops::Deref for MPU {
495495

496496
#[inline(always)]
497497
fn deref(&self) -> &Self::Target {
498-
unsafe { &*Self::ptr() }
498+
unsafe { &*Self::PTR }
499499
}
500500
}
501501

@@ -513,7 +513,7 @@ impl NVIC {
513513
/// Returns a pointer to the register block (to be deprecated in 0.7)
514514
#[inline(always)]
515515
pub const fn ptr() -> *const nvic::RegisterBlock {
516-
0xE000_E100 as *const _
516+
Self::PTR
517517
}
518518
}
519519

@@ -522,7 +522,7 @@ impl ops::Deref for NVIC {
522522

523523
#[inline(always)]
524524
fn deref(&self) -> &Self::Target {
525-
unsafe { &*Self::ptr() }
525+
unsafe { &*Self::PTR }
526526
}
527527
}
528528

@@ -541,7 +541,7 @@ impl SAU {
541541
/// Returns a pointer to the register block (to be deprecated in 0.7)
542542
#[inline(always)]
543543
pub const fn ptr() -> *const sau::RegisterBlock {
544-
0xE000_EDD0 as *const _
544+
Self::PTR
545545
}
546546
}
547547

@@ -551,7 +551,7 @@ impl ops::Deref for SAU {
551551

552552
#[inline(always)]
553553
fn deref(&self) -> &Self::Target {
554-
unsafe { &*Self::ptr() }
554+
unsafe { &*Self::PTR }
555555
}
556556
}
557557

@@ -569,7 +569,7 @@ impl SCB {
569569
/// Returns a pointer to the register block (to be deprecated in 0.7)
570570
#[inline(always)]
571571
pub const fn ptr() -> *const scb::RegisterBlock {
572-
0xE000_ED04 as *const _
572+
Self::PTR
573573
}
574574
}
575575

@@ -578,7 +578,7 @@ impl ops::Deref for SCB {
578578

579579
#[inline(always)]
580580
fn deref(&self) -> &Self::Target {
581-
unsafe { &*Self::ptr() }
581+
unsafe { &*Self::PTR }
582582
}
583583
}
584584

@@ -596,7 +596,7 @@ impl SYST {
596596
/// Returns a pointer to the register block (to be deprecated in 0.7)
597597
#[inline(always)]
598598
pub const fn ptr() -> *const syst::RegisterBlock {
599-
0xE000_E010 as *const _
599+
Self::PTR
600600
}
601601
}
602602

@@ -605,7 +605,7 @@ impl ops::Deref for SYST {
605605

606606
#[inline(always)]
607607
fn deref(&self) -> &Self::Target {
608-
unsafe { &*Self::ptr() }
608+
unsafe { &*Self::PTR }
609609
}
610610
}
611611

@@ -624,7 +624,7 @@ impl TPIU {
624624
/// Returns a pointer to the register block (to be deprecated in 0.7)
625625
#[inline(always)]
626626
pub const fn ptr() -> *const tpiu::RegisterBlock {
627-
0xE004_0000 as *const _
627+
Self::PTR
628628
}
629629
}
630630

@@ -634,6 +634,6 @@ impl ops::Deref for TPIU {
634634

635635
#[inline(always)]
636636
fn deref(&self) -> &Self::Target {
637-
unsafe { &*Self::ptr() }
637+
unsafe { &*Self::PTR }
638638
}
639639
}

0 commit comments

Comments
 (0)