1 #include "ia64_msi.h"
2 
3 /**
4  * @brief 生成架构相关的msi的message address
5  *
6  */
7 #define ia64_pci_get_arch_msi_message_address(processor) ((0xfee00000UL | (processor << 12)))
8 
9 /**
10  * @brief 生成架构相关的message data
11  *
12  */
13 #define ia64_pci_get_arch_msi_message_data(vector, processor, edge_trigger, assert) ((uint32_t)((vector & 0xff) | (edge_trigger == 1 ? 0 : (1 << 15)) | ((assert == 0) ? 0 : (1 << 14))))
14 
15 /**
16  * @brief 生成msi消息
17  *
18  * @param msi_desc msi描述符
19  * @return struct msi_msg_t* msi消息指针(在描述符内)
20  */
msi_arch_get_msg(struct msi_desc_t * msi_desc)21 struct msi_msg_t *msi_arch_get_msg(struct msi_desc_t *msi_desc)
22 {
23     msi_desc->msg.address_hi = 0;
24     msi_desc->msg.address_lo = ia64_pci_get_arch_msi_message_address(msi_desc->processor);
25     msi_desc->msg.data = ia64_pci_get_arch_msi_message_data(msi_desc->irq_num, msi_desc->processor, msi_desc->edge_trigger, msi_desc->assert);
26     msi_desc->msg.vector_control = 0;
27     return &(msi_desc->msg);
28 }
29