@@ -297,12 +297,6 @@ impl VectActive {
297
297
mod scb_consts {
298
298
pub const SCB_CCR_IC_MASK : u32 = ( 1 << 17 ) ;
299
299
pub const SCB_CCR_DC_MASK : u32 = ( 1 << 16 ) ;
300
-
301
- pub const SCB_ICSR_PENDSVSET_MASK : u32 = 1 << 28 ;
302
- pub const SCB_ICSR_PENDSVCLR_MASK : u32 = 1 << 27 ;
303
-
304
- pub const SCB_ICSR_PENDSTSET_MASK : u32 = 1 << 26 ;
305
- pub const SCB_ICSR_PENDSTCLR_MASK : u32 = 1 << 25 ;
306
300
}
307
301
308
302
#[ cfg( not( armv6m) ) ]
@@ -582,56 +576,6 @@ impl SCB {
582
576
:: asm:: dsb ( ) ;
583
577
:: asm:: isb ( ) ;
584
578
}
585
-
586
- /// Pending SV Flag
587
- ///
588
- /// return true if PendSV exception is pending, otherwise false
589
- #[ inline]
590
- pub fn is_pendsv ( ) -> bool {
591
- // NOTE(unsafe) atomic read with no side effects
592
- unsafe { ( * Self :: ptr ( ) ) . icsr . read ( ) & SCB_ICSR_PENDSVSET_MASK != 0 }
593
- }
594
-
595
- /// Changes PendSV exception state to pending Set Pending SV Flag
596
- #[ inline]
597
- pub fn set_pendsv ( & mut self ) {
598
- unsafe {
599
- self . icsr . write ( SCB_ICSR_PENDSVSET_MASK ) ;
600
- }
601
- }
602
-
603
- /// Removes the pending state from the PendSV exception
604
- #[ inline]
605
- pub fn clear_pendsv ( & mut self ) {
606
- unsafe {
607
- self . icsr . write ( SCB_ICSR_PENDSVCLR_MASK ) ;
608
- }
609
- }
610
-
611
- /// ICSR SysTick flag
612
- ///
613
- /// return true if SysTick exception is pending, otherwise false
614
- #[ inline]
615
- pub fn is_systick_pending ( ) -> bool {
616
- // NOTE(unsafe) atomic read with no side effects
617
- unsafe { ( * Self :: ptr ( ) ) . icsr . read ( ) & SCB_ICSR_PENDSTSET_MASK != 0 }
618
- }
619
-
620
- /// Changes SysTick exception state to pending
621
- #[ inline]
622
- pub fn set_systick_pending ( & mut self ) {
623
- unsafe {
624
- self . icsr . write ( SCB_ICSR_PENDSTSET_MASK ) ;
625
- }
626
- }
627
-
628
- /// Removes the pending state from the SysTick exception
629
- #[ inline]
630
- pub fn clear_systick_pending ( & mut self ) {
631
- unsafe {
632
- self . icsr . write ( SCB_ICSR_PENDSTCLR_MASK ) ;
633
- }
634
- }
635
579
}
636
580
637
581
const SCB_SCR_SLEEPDEEP : u32 = 0x1 << 2 ;
@@ -675,6 +619,9 @@ impl SCB {
675
619
const SCB_ICSR_PENDSVSET : u32 = 1 << 28 ;
676
620
const SCB_ICSR_PENDSVCLR : u32 = 1 << 27 ;
677
621
622
+ const SCB_ICSR_PENDSTSET : u32 = 1 << 26 ;
623
+ const SCB_ICSR_PENDSTCLR : u32 = 1 << 25 ;
624
+
678
625
impl SCB {
679
626
/// Set the PENDSVSET bit in the ICSR register which will pend the PendSV interrupt
680
627
pub fn set_pendsv ( ) {
@@ -696,4 +643,29 @@ impl SCB {
696
643
( * Self :: ptr ( ) ) . icsr . write ( SCB_ICSR_PENDSVCLR ) ;
697
644
}
698
645
}
646
+
647
+ /// Set the PENDSTCLR bit in the ICSR register which will clear a pending SysTick interrupt
648
+ #[ inline]
649
+ pub fn set_systick ( & mut self ) {
650
+ unsafe {
651
+ ( * Self :: ptr ( ) ) . icsr . write ( SCB_ICSR_PENDSTSET ) ;
652
+ }
653
+ }
654
+
655
+ /// Check if PENDSTSET bit in the ICSR register is set meaning SysTick interrupt is pending
656
+ #[ inline]
657
+ pub fn is_systick_pending ( ) -> bool {
658
+ unsafe {
659
+ ( * Self :: ptr ( ) ) . icsr . read ( ) & SCB_ICSR_PENDSTSET == SCB_ICSR_PENDSTSET
660
+ }
661
+ }
662
+
663
+
664
+ /// Set the PENDSTCLR bit in the ICSR register which will clear a pending SysTick interrupt
665
+ #[ inline]
666
+ pub fn clear_systick_pending ( & mut self ) {
667
+ unsafe {
668
+ ( * Self :: ptr ( ) ) . icsr . write ( SCB_ICSR_PENDSTCLR ) ;
669
+ }
670
+ }
699
671
}
0 commit comments