Merge pull request #4227 from i509VCB/mspm0-group-int-v2
mspm0: generate interrupt group handlers
This commit is contained in:
		
						commit
						e08b0aecb5
					
				| @ -46,14 +46,14 @@ cortex-m = "0.7.6" | |||||||
| critical-section = "1.2.0" | critical-section = "1.2.0" | ||||||
| 
 | 
 | ||||||
| # mspm0-metapac = { version = "" } | # mspm0-metapac = { version = "" } | ||||||
| mspm0-metapac = { git = "https://github.com/mspm0-rs/mspm0-data-generated/", tag = "mspm0-data-66a55c7bf38a2201ff48c299843e741f2d537f0b" } | mspm0-metapac = { git = "https://github.com/mspm0-rs/mspm0-data-generated/", tag = "mspm0-data-26a6f681eda4ef120e8cb614a1631727c848590f" } | ||||||
| 
 | 
 | ||||||
| [build-dependencies] | [build-dependencies] | ||||||
| proc-macro2 = "1.0.94" | proc-macro2 = "1.0.94" | ||||||
| quote = "1.0.40" | quote = "1.0.40" | ||||||
| 
 | 
 | ||||||
| # mspm0-metapac = { version = "", default-features = false, features = ["metadata"] } | # mspm0-metapac = { version = "", default-features = false, features = ["metadata"] } | ||||||
| mspm0-metapac = { git = "https://github.com/mspm0-rs/mspm0-data-generated/", tag = "mspm0-data-66a55c7bf38a2201ff48c299843e741f2d537f0b", default-features = false, features = ["metadata"] } | mspm0-metapac = { git = "https://github.com/mspm0-rs/mspm0-data-generated/", tag = "mspm0-data-26a6f681eda4ef120e8cb614a1631727c848590f", default-features = false, features = ["metadata"] } | ||||||
| 
 | 
 | ||||||
| [features] | [features] | ||||||
| default = ["rt"] | default = ["rt"] | ||||||
|  | |||||||
| @ -1,6 +1,7 @@ | |||||||
| use std::cmp::Ordering; | use std::cmp::Ordering; | ||||||
| use std::collections::{BTreeSet, HashMap}; | use std::collections::{BTreeSet, HashMap}; | ||||||
| use std::io::Write; | use std::fmt::Write; | ||||||
|  | use std::io::Write as _; | ||||||
| use std::path::{Path, PathBuf}; | use std::path::{Path, PathBuf}; | ||||||
| use std::process::Command; | use std::process::Command; | ||||||
| use std::sync::LazyLock; | use std::sync::LazyLock; | ||||||
| @ -16,12 +17,19 @@ mod common; | |||||||
| 
 | 
 | ||||||
| fn main() { | fn main() { | ||||||
|     generate_code(); |     generate_code(); | ||||||
|  |     interrupt_group_linker_magic(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| fn generate_code() { | fn generate_code() { | ||||||
|     let mut cfgs = common::CfgSet::new(); |     let mut cfgs = common::CfgSet::new(); | ||||||
|     common::set_target_cfgs(&mut cfgs); |     common::set_target_cfgs(&mut cfgs); | ||||||
| 
 | 
 | ||||||
|  |     #[cfg(any(feature = "rt"))] | ||||||
|  |     println!( | ||||||
|  |         "cargo:rustc-link-search={}", | ||||||
|  |         PathBuf::from(env::var_os("OUT_DIR").unwrap()).display(), | ||||||
|  |     ); | ||||||
|  | 
 | ||||||
|     cfgs.declare_all(&["gpio_pb", "gpio_pc", "int_group1"]); |     cfgs.declare_all(&["gpio_pb", "gpio_pc", "int_group1"]); | ||||||
| 
 | 
 | ||||||
|     let chip_name = match env::vars() |     let chip_name = match env::vars() | ||||||
| @ -58,6 +66,7 @@ fn generate_code() { | |||||||
|     g.extend(generate_interrupts()); |     g.extend(generate_interrupts()); | ||||||
|     g.extend(generate_peripheral_instances()); |     g.extend(generate_peripheral_instances()); | ||||||
|     g.extend(generate_pin_trait_impls()); |     g.extend(generate_pin_trait_impls()); | ||||||
|  |     g.extend(generate_groups()); | ||||||
| 
 | 
 | ||||||
|     let out_dir = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); |     let out_dir = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); | ||||||
|     let out_file = out_dir.join("_generated.rs").to_string_lossy().to_string(); |     let out_file = out_dir.join("_generated.rs").to_string_lossy().to_string(); | ||||||
| @ -123,6 +132,83 @@ fn get_chip_cfgs(chip_name: &str) -> Vec<String> { | |||||||
|     cfgs |     cfgs | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /// Interrupt groups use a weakly linked symbols and #[linkage = "extern_weak"] is nightly we need to
 | ||||||
|  | /// do some linker magic to create weak linkage.
 | ||||||
|  | fn interrupt_group_linker_magic() { | ||||||
|  |     let mut file = String::new(); | ||||||
|  | 
 | ||||||
|  |     for group in METADATA.interrupt_groups { | ||||||
|  |         for interrupt in group.interrupts.iter() { | ||||||
|  |             let name = interrupt.name; | ||||||
|  | 
 | ||||||
|  |             writeln!(&mut file, "PROVIDE({name} = DefaultHandler);").unwrap(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     let out_dir = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); | ||||||
|  |     let out_file = out_dir.join("interrupt_group.x"); | ||||||
|  |     fs::write(&out_file, file).unwrap(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | fn generate_groups() -> TokenStream { | ||||||
|  |     let group_vectors = METADATA.interrupt_groups.iter().map(|group| { | ||||||
|  |         let vectors = group.interrupts.iter().map(|interrupt| { | ||||||
|  |             let fn_name = Ident::new(interrupt.name, Span::call_site()); | ||||||
|  | 
 | ||||||
|  |             quote! { | ||||||
|  |                 pub(crate) fn #fn_name(); | ||||||
|  |             } | ||||||
|  |         }); | ||||||
|  | 
 | ||||||
|  |         quote! { #(#vectors)* } | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     let groups = METADATA.interrupt_groups.iter().map(|group| { | ||||||
|  |         let interrupt_group_name = Ident::new(group.name, Span::call_site()); | ||||||
|  |         let group_enum = Ident::new(&format!("Group{}", &group.name[5..]), Span::call_site()); | ||||||
|  |         let group_number = Literal::u32_unsuffixed(group.number); | ||||||
|  | 
 | ||||||
|  |         let matches = group.interrupts.iter().map(|interrupt| { | ||||||
|  |             let variant = Ident::new(&interrupt.name, Span::call_site()); | ||||||
|  | 
 | ||||||
|  |             quote! { | ||||||
|  |                 #group_enum::#variant => unsafe { group_vectors::#variant() }, | ||||||
|  |             } | ||||||
|  |         }); | ||||||
|  | 
 | ||||||
|  |         quote! { | ||||||
|  |             #[cfg(feature = "rt")] | ||||||
|  |             #[crate::pac::interrupt] | ||||||
|  |             fn #interrupt_group_name() { | ||||||
|  |                 use crate::pac::#group_enum; | ||||||
|  | 
 | ||||||
|  |                 let group = crate::pac::CPUSS.int_group(#group_number); | ||||||
|  |                 // MUST subtract by 1 since 0 is NO_INTR
 | ||||||
|  |                 let iidx = group.iidx().read().stat().to_bits() - 1; | ||||||
|  | 
 | ||||||
|  |                 let Ok(group) = #group_enum::try_from(iidx as u8) else { | ||||||
|  |                     return; | ||||||
|  |                 }; | ||||||
|  | 
 | ||||||
|  |                 match group { | ||||||
|  |                     #(#matches)* | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     quote! { | ||||||
|  |         #(#groups)* | ||||||
|  | 
 | ||||||
|  |         #[cfg(feature = "rt")] | ||||||
|  |         mod group_vectors { | ||||||
|  |             extern "Rust" { | ||||||
|  |                 #(#group_vectors)* | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| #[derive(Debug, Clone)] | #[derive(Debug, Clone)] | ||||||
| struct Singleton { | struct Singleton { | ||||||
|     name: String, |     name: String, | ||||||
|  | |||||||
| @ -1119,24 +1119,36 @@ impl Iterator for BitIter { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // C110x has a dedicated interrupt just for GPIOA, as it does not have a GROUP1 interrupt.
 | // C110x and L110x have a dedicated interrupts just for GPIOA.
 | ||||||
|  | //
 | ||||||
|  | // These chips do not have a GROUP1 interrupt.
 | ||||||
| #[cfg(all(feature = "rt", any(mspm0c110x, mspm0l110x)))] | #[cfg(all(feature = "rt", any(mspm0c110x, mspm0l110x)))] | ||||||
| #[interrupt] | #[interrupt] | ||||||
| fn GPIOA() { | fn GPIOA() { | ||||||
|     gpioa_interrupt(); |     irq_handler(pac::GPIOA, &PORTA_WAKERS); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #[cfg(feature = "rt")] | // These symbols are weakly defined as DefaultHandler and are called by the interrupt group implementation.
 | ||||||
| pub(crate) fn gpioa_interrupt() { | //
 | ||||||
|  | // Defining these as no_mangle is required so that the linker will pick these over the default handler.
 | ||||||
|  | 
 | ||||||
|  | #[cfg(all(feature = "rt", not(any(mspm0c110x, mspm0l110x))))] | ||||||
|  | #[no_mangle] | ||||||
|  | #[allow(non_snake_case)] | ||||||
|  | fn GPIOA() { | ||||||
|     irq_handler(pac::GPIOA, &PORTA_WAKERS); |     irq_handler(pac::GPIOA, &PORTA_WAKERS); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #[cfg(all(feature = "rt", gpio_pb))] | #[cfg(all(feature = "rt", gpio_pb))] | ||||||
| pub(crate) fn gpiob_interrupt() { | #[no_mangle] | ||||||
|  | #[allow(non_snake_case)] | ||||||
|  | fn GPIOB() { | ||||||
|     irq_handler(pac::GPIOB, &PORTB_WAKERS); |     irq_handler(pac::GPIOB, &PORTB_WAKERS); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #[cfg(all(feature = "rt", gpio_pc))] | #[cfg(all(feature = "rt", gpio_pc))] | ||||||
| pub(crate) fn gpioc_interrupt() { | #[allow(non_snake_case)] | ||||||
|  | #[no_mangle] | ||||||
|  | fn GPIOC() { | ||||||
|     irq_handler(pac::GPIOC, &PORTC_WAKERS); |     irq_handler(pac::GPIOC, &PORTC_WAKERS); | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,25 +0,0 @@ | |||||||
| use crate::pac; |  | ||||||
| use crate::pac::interrupt; |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP0() { |  | ||||||
|     use mspm0_metapac::Group0; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(0); |  | ||||||
| 
 |  | ||||||
|     // TODO: Decompose to direct u8
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits(); |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group0::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 0: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group0::WWDT0 => todo!("implement WWDT0"), |  | ||||||
|         Group0::DEBUGSS => todo!("implement DEBUGSS"), |  | ||||||
|         Group0::FLASHCTL => todo!("implement FLASHCTL"), |  | ||||||
|         Group0::SYSCTL => todo!("implement SYSCTL"), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,47 +0,0 @@ | |||||||
| use crate::pac; |  | ||||||
| use crate::pac::interrupt; |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP0() { |  | ||||||
|     use mspm0_metapac::Group0; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(0); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group0::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 0: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group0::WWDT0 => todo!("implement WWDT0"), |  | ||||||
|         Group0::WWDT1 => todo!("implement WWDT1"), |  | ||||||
|         Group0::DEBUGSS => todo!("implement DEBUGSS"), |  | ||||||
|         Group0::FLASHCTL => todo!("implement FLASHCTL"), |  | ||||||
|         Group0::SYSCTL => todo!("implement SYSCTL"), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP1() { |  | ||||||
|     use mspm0_metapac::Group1; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(1); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group1::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 1: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group1::GPIOA => crate::gpio::gpioa_interrupt(), |  | ||||||
|         Group1::GPIOB => crate::gpio::gpiob_interrupt(), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,51 +0,0 @@ | |||||||
| use crate::pac; |  | ||||||
| use crate::pac::interrupt; |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP0() { |  | ||||||
|     use mspm0_metapac::Group0; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(0); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group0::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 0: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group0::WWDT0 => todo!("implement WWDT0"), |  | ||||||
|         Group0::WWDT1 => todo!("implement WWDT1"), |  | ||||||
|         Group0::DEBUGSS => todo!("implement DEBUGSS"), |  | ||||||
|         Group0::FLASHCTL => todo!("implement FLASHCTL"), |  | ||||||
|         Group0::SYSCTL => todo!("implement SYSCTL"), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP1() { |  | ||||||
|     use mspm0_metapac::Group1; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(1); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group1::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 1: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group1::GPIOA => crate::gpio::gpioa_interrupt(), |  | ||||||
|         Group1::GPIOB => crate::gpio::gpiob_interrupt(), |  | ||||||
|         Group1::COMP0 => todo!("implement COMP0"), |  | ||||||
|         Group1::COMP1 => todo!("implement COMP1"), |  | ||||||
|         Group1::COMP2 => todo!("implement COMP2"), |  | ||||||
|         Group1::TRNG => todo!("implement TRNG"), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,52 +0,0 @@ | |||||||
| use crate::pac; |  | ||||||
| use crate::pac::interrupt; |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP0() { |  | ||||||
|     use mspm0_metapac::Group0; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(0); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group0::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 0: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group0::WWDT0 => todo!("implement WWDT0"), |  | ||||||
|         Group0::WWDT1 => todo!("implement WWDT1"), |  | ||||||
|         Group0::DEBUGSS => todo!("implement DEBUGSS"), |  | ||||||
|         Group0::FLASHCTL => todo!("implement FLASHCTL"), |  | ||||||
|         Group0::SYSCTL => todo!("implement SYSCTL"), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP1() { |  | ||||||
|     use mspm0_metapac::Group1; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(1); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group1::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 1: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group1::GPIOA => crate::gpio::gpioa_interrupt(), |  | ||||||
|         Group1::GPIOB => crate::gpio::gpiob_interrupt(), |  | ||||||
|         Group1::COMP0 => todo!("implement COMP0"), |  | ||||||
|         Group1::COMP1 => todo!("implement COMP1"), |  | ||||||
|         Group1::COMP2 => todo!("implement COMP2"), |  | ||||||
|         Group1::TRNG => todo!("implement TRNG"), |  | ||||||
|         Group1::GPIOC => crate::gpio::gpioc_interrupt(), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,48 +0,0 @@ | |||||||
| use crate::pac; |  | ||||||
| use crate::pac::interrupt; |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP0() { |  | ||||||
|     use mspm0_metapac::Group0; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(0); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group0::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 0: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group0::WWDT0 => todo!("implement WWDT0"), |  | ||||||
|         Group0::WWDT1 => todo!("implement WWDT1"), |  | ||||||
|         Group0::DEBUGSS => todo!("implement DEBUGSS"), |  | ||||||
|         Group0::FLASHCTL => todo!("implement FLASHCTL"), |  | ||||||
|         Group0::SYSCTL => todo!("implement SYSCTL"), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP1() { |  | ||||||
|     use mspm0_metapac::Group1; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(1); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group1::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 1: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group1::GPIOA => crate::gpio::gpioa_interrupt(), |  | ||||||
|         Group1::GPIOB => crate::gpio::gpiob_interrupt(), |  | ||||||
|         Group1::TRNG => todo!("implement TRNG"), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,51 +0,0 @@ | |||||||
| use crate::pac; |  | ||||||
| use crate::pac::interrupt; |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP0() { |  | ||||||
|     use mspm0_metapac::Group0; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(0); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group0::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 0: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group0::WWDT0 => todo!("implement WWDT0"), |  | ||||||
|         Group0::WWDT1 => todo!("implement WWDT1"), |  | ||||||
|         Group0::DEBUGSS => todo!("implement DEBUGSS"), |  | ||||||
|         Group0::FLASHCTL => todo!("implement FLASHCTL"), |  | ||||||
|         Group0::SYSCTL => todo!("implement SYSCTL"), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP1() { |  | ||||||
|     use mspm0_metapac::Group1; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(1); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group1::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 1: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group1::GPIOA => crate::gpio::gpioa_interrupt(), |  | ||||||
|         Group1::GPIOB => crate::gpio::gpiob_interrupt(), |  | ||||||
|         Group1::COMP0 => todo!("implement COMP0"), |  | ||||||
|         Group1::COMP1 => todo!("implement COMP1"), |  | ||||||
|         Group1::COMP2 => todo!("implement COMP2"), |  | ||||||
|         Group1::TRNG => todo!("implement TRNG"), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,52 +0,0 @@ | |||||||
| use crate::pac; |  | ||||||
| use crate::pac::interrupt; |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP0() { |  | ||||||
|     use mspm0_metapac::Group0; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(0); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group0::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 0: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group0::WWDT0 => todo!("implement WWDT0"), |  | ||||||
|         Group0::WWDT1 => todo!("implement WWDT1"), |  | ||||||
|         Group0::DEBUGSS => todo!("implement DEBUGSS"), |  | ||||||
|         Group0::FLASHCTL => todo!("implement FLASHCTL"), |  | ||||||
|         Group0::SYSCTL => todo!("implement SYSCTL"), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP1() { |  | ||||||
|     use mspm0_metapac::Group1; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(1); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group1::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 1: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group1::GPIOA => crate::gpio::gpioa_interrupt(), |  | ||||||
|         Group1::GPIOB => crate::gpio::gpiob_interrupt(), |  | ||||||
|         Group1::COMP0 => todo!("implement COMP0"), |  | ||||||
|         Group1::COMP1 => todo!("implement COMP1"), |  | ||||||
|         Group1::COMP2 => todo!("implement COMP2"), |  | ||||||
|         Group1::TRNG => todo!("implement TRNG"), |  | ||||||
|         Group1::GPIOC => crate::gpio::gpioc_interrupt(), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,25 +0,0 @@ | |||||||
| use crate::pac; |  | ||||||
| use crate::pac::interrupt; |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP0() { |  | ||||||
|     use mspm0_metapac::Group0; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(0); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group0::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 0: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group0::WWDT0 => todo!("implement WWDT0"), |  | ||||||
|         Group0::DEBUGSS => todo!("implement DEBUGSS"), |  | ||||||
|         Group0::FLASHCTL => todo!("implement FLASHCTL"), |  | ||||||
|         Group0::SYSCTL => todo!("implement SYSCTL"), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,49 +0,0 @@ | |||||||
| use crate::pac; |  | ||||||
| use crate::pac::interrupt; |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP0() { |  | ||||||
|     use mspm0_metapac::Group0; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(0); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group0::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 0: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group0::WWDT0 => todo!("implement WWDT0"), |  | ||||||
|         Group0::DEBUGSS => todo!("implement DEBUGSS"), |  | ||||||
|         Group0::FLASHCTL => todo!("implement FLASHCTL"), |  | ||||||
|         Group0::SYSCTL => todo!("implement SYSCTL"), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP1() { |  | ||||||
|     use mspm0_metapac::Group1; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(1); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group1::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 1: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group1::GPIOA => crate::gpio::gpioa_interrupt(), |  | ||||||
|         Group1::GPIOB => crate::gpio::gpiob_interrupt(), |  | ||||||
|         Group1::COMP0 => todo!("implement COMP0"), |  | ||||||
|         Group1::TRNG => todo!("implement TRNG"), |  | ||||||
|         Group1::GPIOC => crate::gpio::gpioc_interrupt(), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,46 +0,0 @@ | |||||||
| use crate::pac; |  | ||||||
| use crate::pac::interrupt; |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP0() { |  | ||||||
|     use mspm0_metapac::Group0; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(0); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group0::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 0: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group0::WWDT0 => todo!("implement WWDT0"), |  | ||||||
|         Group0::DEBUGSS => todo!("implement DEBUGSS"), |  | ||||||
|         Group0::FLASHCTL => todo!("implement FLASHCTL"), |  | ||||||
|         Group0::SYSCTL => todo!("implement SYSCTL"), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP1() { |  | ||||||
|     use mspm0_metapac::Group1; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(1); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group1::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 1: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group1::GPIOA => crate::gpio::gpioa_interrupt(), |  | ||||||
|         Group1::COMP0 => todo!("implement COMP0"), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,49 +0,0 @@ | |||||||
| use crate::pac; |  | ||||||
| use crate::pac::interrupt; |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP0() { |  | ||||||
|     use mspm0_metapac::Group0; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(0); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group0::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 0: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group0::WWDT0 => todo!("implement WWDT0"), |  | ||||||
|         Group0::DEBUGSS => todo!("implement DEBUGSS"), |  | ||||||
|         Group0::FLASHCTL => todo!("implement FLASHCTL"), |  | ||||||
|         Group0::SYSCTL => todo!("implement SYSCTL"), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "rt")] |  | ||||||
| #[interrupt] |  | ||||||
| fn GROUP1() { |  | ||||||
|     use mspm0_metapac::Group1; |  | ||||||
| 
 |  | ||||||
|     let group = pac::CPUSS.int_group(1); |  | ||||||
| 
 |  | ||||||
|     // Must subtract by 1 since NO_INTR is value 0
 |  | ||||||
|     let iidx = group.iidx().read().stat().to_bits() - 1; |  | ||||||
| 
 |  | ||||||
|     let Ok(group) = pac::Group1::try_from(iidx as u8) else { |  | ||||||
|         debug!("Invalid IIDX for group 1: {}", iidx); |  | ||||||
|         return; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     match group { |  | ||||||
|         Group1::GPIOA => crate::gpio::gpioa_interrupt(), |  | ||||||
|         Group1::GPIOB => crate::gpio::gpiob_interrupt(), |  | ||||||
|         Group1::COMP0 => todo!("implement COMP0"), |  | ||||||
|         Group1::TRNG => todo!("implement TRNG"), |  | ||||||
|         Group1::GPIOC => crate::gpio::gpioc_interrupt(), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -39,20 +39,6 @@ pub mod mode { | |||||||
| #[cfg(feature = "_time-driver")] | #[cfg(feature = "_time-driver")] | ||||||
| mod time_driver; | mod time_driver; | ||||||
| 
 | 
 | ||||||
| // Interrupt group handlers.
 |  | ||||||
| #[cfg_attr(mspm0c110x, path = "int_group/c110x.rs")] |  | ||||||
| #[cfg_attr(mspm0g110x, path = "int_group/g110x.rs")] |  | ||||||
| #[cfg_attr(mspm0g150x, path = "int_group/g150x.rs")] |  | ||||||
| #[cfg_attr(mspm0g350x, path = "int_group/g350x.rs")] |  | ||||||
| #[cfg_attr(mspm0g151x, path = "int_group/g151x.rs")] |  | ||||||
| #[cfg_attr(mspm0g351x, path = "int_group/g351x.rs")] |  | ||||||
| #[cfg_attr(mspm0g310x, path = "int_group/g310x.rs")] |  | ||||||
| #[cfg_attr(mspm0l110x, path = "int_group/l11xx.rs")] |  | ||||||
| #[cfg_attr(mspm0l122x, path = "int_group/l12xx.rs")] |  | ||||||
| #[cfg_attr(any(mspm0l130x, mspm0l134x), path = "int_group/l13xx.rs")] |  | ||||||
| #[cfg_attr(mspm0l222x, path = "int_group/l222x.rs")] |  | ||||||
| mod int_group; |  | ||||||
| 
 |  | ||||||
| pub(crate) mod _generated { | pub(crate) mod _generated { | ||||||
|     #![allow(dead_code)] |     #![allow(dead_code)] | ||||||
|     #![allow(unused_imports)] |     #![allow(unused_imports)] | ||||||
|  | |||||||
| @ -32,4 +32,6 @@ fn main() { | |||||||
|     println!("cargo:rustc-link-arg-bins=--nmagic"); |     println!("cargo:rustc-link-arg-bins=--nmagic"); | ||||||
|     println!("cargo:rustc-link-arg-bins=-Tlink.x"); |     println!("cargo:rustc-link-arg-bins=-Tlink.x"); | ||||||
|     println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); |     println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); | ||||||
|  |     // You must tell cargo to link interrupt groups if the rt feature is enabled.
 | ||||||
|  |     println!("cargo:rustc-link-arg-bins=-Tinterrupt_group.x"); | ||||||
| } | } | ||||||
|  | |||||||
| @ -32,4 +32,6 @@ fn main() { | |||||||
|     println!("cargo:rustc-link-arg-bins=--nmagic"); |     println!("cargo:rustc-link-arg-bins=--nmagic"); | ||||||
|     println!("cargo:rustc-link-arg-bins=-Tlink.x"); |     println!("cargo:rustc-link-arg-bins=-Tlink.x"); | ||||||
|     println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); |     println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); | ||||||
|  |     // You must tell cargo to link interrupt groups if the rt feature is enabled.
 | ||||||
|  |     println!("cargo:rustc-link-arg-bins=-Tinterrupt_group.x"); | ||||||
| } | } | ||||||
|  | |||||||
| @ -32,4 +32,6 @@ fn main() { | |||||||
|     println!("cargo:rustc-link-arg-bins=--nmagic"); |     println!("cargo:rustc-link-arg-bins=--nmagic"); | ||||||
|     println!("cargo:rustc-link-arg-bins=-Tlink.x"); |     println!("cargo:rustc-link-arg-bins=-Tlink.x"); | ||||||
|     println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); |     println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); | ||||||
|  |     // You must tell cargo to link interrupt groups if the rt feature is enabled.
 | ||||||
|  |     println!("cargo:rustc-link-arg-bins=-Tinterrupt_group.x"); | ||||||
| } | } | ||||||
|  | |||||||
| @ -32,4 +32,6 @@ fn main() { | |||||||
|     println!("cargo:rustc-link-arg-bins=--nmagic"); |     println!("cargo:rustc-link-arg-bins=--nmagic"); | ||||||
|     println!("cargo:rustc-link-arg-bins=-Tlink.x"); |     println!("cargo:rustc-link-arg-bins=-Tlink.x"); | ||||||
|     println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); |     println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); | ||||||
|  |     // You must tell cargo to link interrupt groups if the rt feature is enabled.
 | ||||||
|  |     println!("cargo:rustc-link-arg-bins=-Tinterrupt_group.x"); | ||||||
| } | } | ||||||
|  | |||||||
| @ -32,4 +32,6 @@ fn main() { | |||||||
|     println!("cargo:rustc-link-arg-bins=--nmagic"); |     println!("cargo:rustc-link-arg-bins=--nmagic"); | ||||||
|     println!("cargo:rustc-link-arg-bins=-Tlink.x"); |     println!("cargo:rustc-link-arg-bins=-Tlink.x"); | ||||||
|     println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); |     println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); | ||||||
|  |     // You must tell cargo to link interrupt groups if the rt feature is enabled.
 | ||||||
|  |     println!("cargo:rustc-link-arg-bins=-Tinterrupt_group.x"); | ||||||
| } | } | ||||||
|  | |||||||
| @ -19,6 +19,8 @@ fn main() -> Result<(), Box<dyn Error>> { | |||||||
|     println!("cargo:rustc-link-arg-bins=-Tlink_ram.x"); |     println!("cargo:rustc-link-arg-bins=-Tlink_ram.x"); | ||||||
|     println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); |     println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); | ||||||
|     println!("cargo:rustc-link-arg-bins=-Tteleprobe.x"); |     println!("cargo:rustc-link-arg-bins=-Tteleprobe.x"); | ||||||
|  |     // You must tell cargo to link interrupt groups if the rt feature is enabled.
 | ||||||
|  |     println!("cargo:rustc-link-arg-bins=-Tinterrupt_group.x"); | ||||||
| 
 | 
 | ||||||
|     Ok(()) |     Ok(()) | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user