Other Parts Discussed in Thread: SYSBIOS
工具/软件:Code Composer Studio
您好、TI 工程师:
由于引导模式为 PCIe、因此应已在引导加载程序中实现与 PCIe 相关的初始化。 以下代码是与 PCIe 相关的配置、但无法在 Windows 下补充 MSI 中断。 我不知道配置有问题。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include <ti/sysbios/family/c64p/Hwi.h>
CSL_CPINTCRegs* gpCIC1_regs =(CSL_CPINTCRegs*) CSL_CIC_1_regs;
/* CIC 路由事件 CPU 的寄存器指针。
默认情况下,它是 CIC0;但对于内核4~7,它是 CIC1*/
CSL_CPINTCRegs* gpCIC 寄存器=(CSL_CPINTCRegs*) CSL_CIC 寄存器0_regs;
CSL_CPINTCRegs* gpCIC0_regs =(CSL_CPINTCRegs*) CSL_CIC_0_regs;
CSL_CgemRegs * gpCgem_regs =(CSL_CgemRegs *) CSL_C66X_COREPAC_REG_BASE_ADDRESS_REGS;
静态内联 unsigned int swap_ENDIAN (unsigned int byte_index)
{
此处需要注意 μ s
#ifdef _big_ENDIAN
返回((byte_index&0xFFFFFFFC)+(3-byte_index&3));
其他
返回 byte_index;
#endif
}
/*启用到 CPU 的中断:IER |= uiIER_en_MASK;GIE=1*/
void cpu_interrupt_enable (uint32 uiir_en_mask)
{
IER |= uiIER en_mask;
//启用 GIE
TSR = TSR|1;
}
静态内联 void keyston_CIC_EVENT_MAP (CSL_CPINTCRegs* cpIntcRegs、int input_event_num、int out_num)
{
/*将输入事件映射到输出*/
cpIntcRegs->ch_map[swap_ENDIAN (input_event_num)]= out_num;
/*清除输入中断事件*/
cpIntcRegs->STATUS_CLR_index_REG= INPUT_EVENT_num;
/*启用输入中断事件*/
cpIntcRegs->enable_set_index_REG= input_event_num;
/*启用输出*/
cpIntcRegs->hin_enable_set_index_REG= out_num;
}
int uiPCIE_ERROR_HOST_EVENT_num=0;
int uiPCIE_MSI_HOST_EVENT_num=1;
void PCIe_interrupts_Init (void)
{
/*禁用全局主机中断。 *
gpCIC0_regs->global_enable_hint_REG=0;
/*将 PCIe 错误/PM/复位中断事件映射到 CIC0 out0*/
PCIE的普通事件中断 μ s
KeySton_CIC_EVENT_MAP (gpCIC0_regs、CSL_CIC0_PCIe_INT12、uiPCIE_ERROR_HOST_EVENT_num);
KeySton_CIC_EVENT_MAP (gpCIC0_regs、CSL_CIC0_PCIe_INT13、uiPCIE_ERROR_HOST_EVENT_num);
/*启用全局主机中断。 *
gpCIC0_regs->global_enable_hint_REG= 1;
/*MAP PCIe ERROR/PM/复位中断表单 CICO 到 INT5;
将 PCIe MSI 中断映射到 int4 */
PCIE的MIS事件中断 μ s
gpCgem regs->INTMUX1 =<CSL_CGEM_INTMUX1_INTSEL5_SHIFT)
|(CSL_C66X_COREPAC_PCIe_INT4_PLUS_N<<CSL_CGEM_INTMUX1_INTSEL4_SHIFT)
|(CSL_C66X_COREPAC_CIC_OUT1<CSL_C66X_COREPAC_CIC_OUT1<<CSL_CGEM_INTMUX1_INTSEL6_SHIFT);
//启用 int4~int6
CPU_INTERRUPT_ENABLE ((1<<4)|(1<<5)|(1<<6));
}
int main (vod)
{
PCIe_interrupts_Init();
*(unsigned int*) 0x21800200 = 0xF7100001;//RC bar0 addr 0xF7100000带外 OB_OFFSET_INDEX
*(unsigned int*)(0x21800204)= 0x00;//OB_OFFSET_HI
*(unsigned int*) 0x21801050=0x417050;//MSI_CAP
*(unsigned int*) 0x21801054=0xF7100054;//MSI_LOW32
*(unsigned int*) 0x21801058=0x00;//MSI_UP32
*(unsigned int*) 0x2180105c=16;//MSI_DATA
放置("PCIe test msi start.");
*(unsigned int*)(0x50000108)=0xF;//MSI_IRQ_ENABLE_SET
*(unsigned int*)(0x50000054)=16;//MSI_IRQ
*(unsigned int*)(0x5000010C)=0xF;//MSI_IRQ_ENABLE_CLR
放置("PCIe test msi les.");
}
(1).MSI 中断不能通过 Windows 在 BAR0地址0xF7100000 Windows 上查找 PCIe 来捕获。 我不知道配置有问题
(2).在我初始化0x21801054 MSI_LOW32后、查询地址为0xFEE00318、我不知道该地址与 BAR0起始地址有什么关系、也不知道我将使用什么地址进行 OUTBAND 处理
(3)。