1cc36cf4aSYJwu2023 use crate::driver::pci::pci_irq::TriggerMode; 2cc36cf4aSYJwu2023 /// @brief 获得MSI Message Address 3cc36cf4aSYJwu2023 /// @param processor 目标CPU ID号 4cc36cf4aSYJwu2023 /// @return MSI Message Address arch_msi_message_address(processor: u16) -> u325*4fda81ceSLoGinpub fn arch_msi_message_address(processor: u16) -> u32 { 60dd8ff43SYJwu2023 0xfee00000 | ((processor as u32) << 12) 7cc36cf4aSYJwu2023 } 8cc36cf4aSYJwu2023 /// @brief 获得MSI Message Data 9cc36cf4aSYJwu2023 /// @param vector 分配的中断向量号 10cc36cf4aSYJwu2023 /// @param processor 目标CPU ID号 11cc36cf4aSYJwu2023 /// @param trigger 申请中断的触发模式,MSI默认为边沿触发 12cc36cf4aSYJwu2023 /// @return MSI Message Address arch_msi_message_data(vector: u16, _processor: u16, trigger: TriggerMode) -> u3213*4fda81ceSLoGinpub fn arch_msi_message_data(vector: u16, _processor: u16, trigger: TriggerMode) -> u32 { 14cc36cf4aSYJwu2023 match trigger { 15cc36cf4aSYJwu2023 TriggerMode::EdgeTrigger => vector as u32, 16cc36cf4aSYJwu2023 TriggerMode::AssertHigh => vector as u32 | 1 << 15 | 1 << 14, 17cc36cf4aSYJwu2023 TriggerMode::AssertLow => vector as u32 | 1 << 15, 18cc36cf4aSYJwu2023 } 19cc36cf4aSYJwu2023 } 20