This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

pcie中断



如何在CCS5.3自带的例程,就是挂bios的那个例程里加一个数据的中断啊。比如RC发送完数据以中断的方式告诉EP

  • 下面是个简单的例子 供参考 谢谢!

    void Pcie_init_interrupt()
    {
    printf("**************************************************\n");
    printf("****************** PCIE MSI Testing ****************\n");
    printf("**************************************************\n");

    /************************************************
    *************** INTC Configuration *************
    ************************************************/

    printf("Debug: GEM-INTC Configuration...\n");

    /* INTC module initialization */
    intcContext.eventhandlerRecord = EventHandler;
    intcContext.numEvtEntries = 10;
    if (CSL_intcInit(&intcContext) != CSL_SOK)
    {
    printf("Error: GEM-INTC initialization failed\n");
    return;
    }

    /* Enable NMIs */
    if (CSL_intcGlobalNmiEnable() != CSL_SOK)
    {
    printf("Error: GEM-INTC global NMI enable failed\n");
    return;
    }

    /* Enable global interrupts */
    if (CSL_intcGlobalEnable(&state) != CSL_SOK)
    {
    printf("Error: GEM-INTC global enable failed\n");
    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, 17, &vectId , NULL);
    if (hTest == NULL)
    {
    printf("Error: GEM-INTC Open failed\n");
    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)
    {
    printf("Error: GEM-INTC Plug event handler failed\n");
    return;
    }

    /* Enabling the events. */
    if (CSL_intcHwControl(hTest,CSL_INTC_CMD_EVTENABLE, NULL) != CSL_SOK)
    {
    printf("Error: GEM-INTC CSL_INTC_CMD_EVTENABLE command failed\n");
    return;
    }

    printf("Debug: GEM-INTC Configuration Completed\n");
    }
    /*
    * ======== main ========
    */
    void main()
    {

    //Task_Handle task;
    //Error_Block eb;

    pcieRet_e retVal;

    printf("enter main()\n");

    #if 0
    Error_init(&eb);
    task = Task_create(taskFxn, NULL, &eb);
    if (task == NULL) {
    System_printf("Task_create() failed!\n");
    BIOS_exit(0);
    }
    #endif

    Pcie_init_interrupt();
    //Hwi_enableInterrupt(5);

    //! initialize PCIe Module

    /* Set the PCIe mode*/
    if ((retVal = Pcie_setMode(PcieModeGbl)) != pcie_RET_OK) {
    printf("Set PCIe Mode failed (%d)\n", (int)retVal);
    exit(1);
    }

    /* Power up PCIe Module */
    if ((retVal = pciePowerCfg()) != pcie_RET_OK) {
    printf("PCIe Power Up failed (%d)\n", (int)retVal);
    exit(1);
    }

    //enable PCIe MSI Interrupt
    MSI0_IRQ_ENABLE_SET = 0xF; //enable MSI_0/8/16/24
    MSI_IRQ = 0x8;

    //BIOS_start(); /* enable interrupts and start SYS/BIOS */
    }

  • Thomas Yang1 你好,

    请问我在收到这个中断之后,我把数据完成了处理,想回发一个中断给PC端,怎么回发一个中断呢?

    我使用的是c6678,请问c6678是作为EP端是吧?PC是RC端?

  • 您好@Thomas Yang1 

    能否将这个例子的工程发上来,目前本人正在调试这个MSI功能,遇到了点困难,感谢!

  • 您好,我现在想要调试PCIe遇到点麻烦,电脑主板上只有一个PCIe插槽并被显卡占用,市场上也找不到PCI转PCIe的转接板,请问您有什么好的建议吗?