1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//! Advanced Programmable Interrupt Controller (APIC).
pub mod io;
pub mod local;
pub use io::IoApic;
pub use local::LocalApic;

use mycelium_util::bits::enum_from_bits;
use raw_cpuid::CpuId;

pub fn is_supported() -> bool {
    CpuId::new()
        .get_feature_info()
        .map(|features| features.has_apic())
        .unwrap_or(false)
}

enum_from_bits! {
    #[derive(Debug, PartialEq, Eq)]
    pub enum PinPolarity<u8> {
        High = 0,
        Low = 1,
    }
}

enum_from_bits! {
    #[derive(Debug, PartialEq, Eq)]
    pub enum TriggerMode<u8> {
        Edge = 0,
        Level = 1,
    }
}