void main (void)
{
platform_init_flags init_flags;
platform_init_config init_config;
/* Initialize main Platform lib */
memset(&init_config, 0, sizeof(platform_init_config));
memset(&init_flags, 1, sizeof(platform_init_flags));
platform_init(&init_flags, &init_config);
/* Initialize UART */
platform_uart_init();
platform_uart_set_baudrate(BOOT_UART_BAUDRATE);
DEVICE_REG32_W(MAGIC_ADDR, 0);
DEVICE_REG32_W(PCIE_LEGACY_A_IRQ_STATUS, 0x1);
/************************************************
*************** INTC Configuration *************
************************************************/
write_uart("Debug: GEM-INTC Configuration…\n\r");
/* INTC module initialization */
intcContext.eventhandlerRecord = EventHandler;
intcContext.numEvtEntries = 10;
if (CSL_intcInit(&intcContext) != CSL_SOK)
{
write_uart("Error: GEM-INTC initialization failed n\r");
return;
}
/* Enable NMIs */
if (CSL_intcGlobalNmiEnable() != CSL_SOK)
{
write_uart("Error: GEM-INTC global NMI enable failed n\r");
return;
}
/* Enable global interrupts */
if (CSL_intcGlobalEnable(&state) != CSL_SOK)
{
write_uart("Error: GEM-INTC global enable failed \n\r");
return;
}
/* Open the INTC Module for Vector ID: 4 and Event ID: 63 (C6678) 59 (C6670)
* Refer to the interrupt architecture and mapping document for the Event ID (INTC0_OUT3)*/
vectId = CSL_INTC_VECTID_4;
hTest = CSL_intcOpen (&intcObj, INTC0_OUT3, &vectId , NULL);
if (hTest == NULL)
{
write_uart("Error: GEM-INTC Open failed\n\r");
return;
}
/* Register an call-back handler which is invoked when the event occurs. */
EventRecord.handler = &test_isr_handler;
EventRecord.arg = 0;
if (CSL_intcPlugEventHandler(hTest,&EventRecord) != CSL_SOK)
{
write_uart("Error: GEM-INTC Plug event handler failed\n\r");
return;
}
/* Enabling the events. */
if (CSL_intcHwControl(hTest,CSL_INTC_CMD_EVTENABLE, NULL) != CSL_SOK)
{
write_uart("Error: GEM-INTC CSL_INTC_CMD_EVTENABLE command failed\n\r");
return;
}
write_uart("Debug: GEM-INTC Configuration Completed \n\r");
/**************************************************
************* CPINTC-0 Configuration *************
**************************************************/
write_uart("Debug: CPINTC-0 Configuration…\n\r");
/* Open the handle to the CPINT Instance */
hnd = CSL_CPINTC_open(0);
if (hnd == 0)
{
write_uart("Error: Unable to open CPINTC-0\n\r");
return;
}
/* Disable all host interrupts. */
CSL_CPINTC_disableAllHostInterrupt(hnd);
/* Configure no nesting support in the CPINTC Module. */
CSL_CPINTC_setNestingMode (hnd, CPINTC_NO_NESTING);
/* We now map System Interrupt 0 – 3 to channel 3 */
CSL_CPINTC_mapSystemIntrToChannel (hnd, PCIEXpress_Legacy_INTA, 3);
/* We now enable system interrupt 0 – 3 */
CSL_CPINTC_enableSysInterrupt (hnd, PCIEXpress_Legacy_INTA);
/* We enable host interrupts. */
CSL_CPINTC_enableHostInterrupt (hnd, 3);
/* Enable all host interrupts also. */
CSL_CPINTC_enableAllHostInterrupt(hnd);
write_uart("Debug: CPINTC-0 Configuration Completed\n\r");
start_boot();
}
Nancy Wang:
具体的芯片型号是什么?
user5301336:
回复 Nancy Wang:
DSP是6678,FPGA是V6,PCIE主要是接收主机中断,SRIO用在DSP和FPGA之间传输数据