stm32f446re/
interrupt_service.rs

1// Licensed under the Apache License, Version 2.0 or the MIT License.
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3// Copyright Tock Contributors 2022.
4
5use crate::chip_specs::Stm32f446Specs;
6use stm32f4xx::chip::Stm32f4xxDefaultPeripherals;
7
8pub struct Stm32f446reDefaultPeripherals<'a> {
9    pub stm32f4: Stm32f4xxDefaultPeripherals<'a, Stm32f446Specs>,
10    // Once implemented, place Stm32f446re specific peripherals here
11}
12
13impl<'a> Stm32f446reDefaultPeripherals<'a> {
14    pub unsafe fn new(
15        clocks: &'a crate::clocks::Clocks<'a, Stm32f446Specs>,
16        exti: &'a crate::exti::Exti<'a>,
17        dma1: &'a crate::dma::Dma1<'a>,
18        dma2: &'a crate::dma::Dma2<'a>,
19    ) -> Self {
20        Self {
21            stm32f4: Stm32f4xxDefaultPeripherals::new(clocks, exti, dma1, dma2),
22        }
23    }
24    // Necessary for setting up circular dependencies & registering deferred
25    // calls
26    pub fn init(&'static self) {
27        self.stm32f4.setup_circular_deps();
28    }
29}
30impl kernel::platform::chip::InterruptService for Stm32f446reDefaultPeripherals<'_> {
31    unsafe fn service_interrupt(&self, interrupt: u32) -> bool {
32        #[allow(clippy::match_single_binding)]
33        match interrupt {
34            // put Stm32f446re specific interrupts here
35            _ => self.stm32f4.service_interrupt(interrupt),
36        }
37    }
38}