@@ -648,8 +648,10 @@ impl SCB {
648
648
/// a runtime-dependent `panic!()` call.
649
649
#[ inline]
650
650
pub unsafe fn invalidate_dcache_by_slice < T > ( & mut self , slice : & mut [ T ] ) {
651
- self . invalidate_dcache_by_address ( slice. as_ptr ( ) as usize ,
652
- slice. len ( ) * core:: mem:: size_of :: < T > ( ) ) ;
651
+ self . invalidate_dcache_by_address (
652
+ slice. as_ptr ( ) as usize ,
653
+ slice. len ( ) * core:: mem:: size_of :: < T > ( ) ,
654
+ ) ;
653
655
}
654
656
655
657
/// Cleans D-cache by address.
@@ -732,8 +734,10 @@ impl SCB {
732
734
/// to main memory, overwriting whatever was in main memory.
733
735
#[ inline]
734
736
pub fn clean_dcache_by_slice < T > ( & mut self , slice : & [ T ] ) {
735
- self . clean_dcache_by_address ( slice. as_ptr ( ) as usize ,
736
- slice. len ( ) * core:: mem:: size_of :: < T > ( ) ) ;
737
+ self . clean_dcache_by_address (
738
+ slice. as_ptr ( ) as usize ,
739
+ slice. len ( ) * core:: mem:: size_of :: < T > ( ) ,
740
+ ) ;
737
741
}
738
742
739
743
/// Cleans and invalidates D-cache by address.
@@ -899,57 +903,38 @@ impl SCB {
899
903
/// System handlers, exceptions with configurable priority
900
904
#[ allow( clippy:: missing_inline_in_public_items) ]
901
905
#[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
906
+ #[ repr( u8 ) ]
902
907
pub enum SystemHandler {
903
908
// NonMaskableInt, // priority is fixed
904
909
// HardFault, // priority is fixed
905
910
/// Memory management interrupt (not present on Cortex-M0 variants)
906
911
#[ cfg( not( armv6m) ) ]
907
- MemoryManagement ,
912
+ MemoryManagement = 4 ,
908
913
909
914
/// Bus fault interrupt (not present on Cortex-M0 variants)
910
915
#[ cfg( not( armv6m) ) ]
911
- BusFault ,
916
+ BusFault = 5 ,
912
917
913
918
/// Usage fault interrupt (not present on Cortex-M0 variants)
914
919
#[ cfg( not( armv6m) ) ]
915
- UsageFault ,
920
+ UsageFault = 6 ,
916
921
917
922
/// Secure fault interrupt (only on ARMv8-M)
918
923
#[ cfg( any( armv8m, target_arch = "x86_64" ) ) ]
919
- SecureFault ,
924
+ SecureFault = 7 ,
920
925
921
926
/// SV call interrupt
922
- SVCall ,
927
+ SVCall = 11 ,
923
928
924
929
/// Debug monitor interrupt (not present on Cortex-M0 variants)
925
930
#[ cfg( not( armv6m) ) ]
926
- DebugMonitor ,
931
+ DebugMonitor = 12 ,
927
932
928
933
/// Pend SV interrupt
929
- PendSV ,
934
+ PendSV = 14 ,
930
935
931
936
/// System Tick interrupt
932
- SysTick ,
933
- }
934
-
935
- impl SystemHandler {
936
- fn index ( self ) -> u8 {
937
- match self {
938
- #[ cfg( not( armv6m) ) ]
939
- SystemHandler :: MemoryManagement => 4 ,
940
- #[ cfg( not( armv6m) ) ]
941
- SystemHandler :: BusFault => 5 ,
942
- #[ cfg( not( armv6m) ) ]
943
- SystemHandler :: UsageFault => 6 ,
944
- #[ cfg( any( armv8m, target_arch = "x86_64" ) ) ]
945
- SystemHandler :: SecureFault => 7 ,
946
- SystemHandler :: SVCall => 11 ,
947
- #[ cfg( not( armv6m) ) ]
948
- SystemHandler :: DebugMonitor => 12 ,
949
- SystemHandler :: PendSV => 14 ,
950
- SystemHandler :: SysTick => 15 ,
951
- }
952
- }
937
+ SysTick = 15 ,
953
938
}
954
939
955
940
impl SCB {
@@ -959,7 +944,7 @@ impl SCB {
959
944
/// [`NVIC.get_priority`](struct.NVIC.html#method.get_priority) for more details.
960
945
#[ inline]
961
946
pub fn get_priority ( system_handler : SystemHandler ) -> u8 {
962
- let index = system_handler. index ( ) ;
947
+ let index = system_handler as u8 ;
963
948
964
949
#[ cfg( not( armv6m) ) ]
965
950
{
@@ -990,7 +975,7 @@ impl SCB {
990
975
/// [`register::basepri`](../register/basepri/index.html)) and compromise memory safety.
991
976
#[ inline]
992
977
pub unsafe fn set_priority ( & mut self , system_handler : SystemHandler , prio : u8 ) {
993
- let index = system_handler. index ( ) ;
978
+ let index = system_handler as u8 ;
994
979
995
980
#[ cfg( not( armv6m) ) ]
996
981
{
0 commit comments