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