Skip to main content

strat9_bus_drivers/
stm32_firewall.rs

1use crate::BusError;
2use alloc::{string::String, vec::Vec};
3
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub enum FirewallType {
6    Peripheral,
7    Memory,
8    NoType,
9}
10
11pub struct FirewallEntry {
12    pub firewall_id: u32,
13    pub extra_args: [u32; 4],
14    pub extra_args_count: usize,
15}
16
17pub trait FirewallController: Send + Sync {
18    /// Performs the name operation.
19    fn name(&self) -> &str;
20    /// Performs the firewall type operation.
21    fn firewall_type(&self) -> FirewallType;
22    /// Performs the max entries operation.
23    fn max_entries(&self) -> u32;
24    /// Performs the grant access operation.
25    fn grant_access(&self, firewall_id: u32) -> Result<(), BusError>;
26    /// Performs the release access operation.
27    fn release_access(&self, firewall_id: u32) -> Result<(), BusError>;
28    /// Performs the grant memory range operation.
29    fn grant_memory_range(&self, _start: u64, _size: u64) -> Result<(), BusError> {
30        Err(BusError::NotSupported)
31    }
32}