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.

关于C6657的uPP连续中断问题

你好,

目前遇上一个问题, 在连续传送uPP

我们知道可以加大内存空间或采用中断程序来解决系统负载的问题

若采用加大内存空间, 会使用大量的内存空间, 目前没有足够空间使用

最后想以中断程序来执行

 

 寻找了论坛, 目前执行结果都稍微有些问题

这里将程序整理成适合我所需要的系统

附上程序如下:

 

目前只能产生一次中断, 无法连续中断

在重置系统后无法再产生中断, 只能重新上电, 才可再产生一次中断

 

这里有两个问题

1. 我这程序要如何能连续中断?

2. 要如何执行什么程序代码才能重置中断, 而不需要重上电?

 

附上部分程序代码

a. 中断设置

void upp_intc_setup()
{
    /***************** interrupt configration for UPP  **************************/
    /* open CPINTC0 to map the UPP completetion ISR event to the host interrupt */
    CSL_CPINTC_Handle hnd_UPP;
    CSL_CPINTCChannel chnId;
    CSL_CPINTCSystemInterrupt sysIntr;
    CSL_IntcEventHandlerRecord uppHandler;
    CSL_IntcHandle hIntcUpp;
    CSL_IntcObj intcObjUpp;
    CSL_IntcEventId eventId;
    CSL_IntcParam vectId;
    CSL_IntcContext intcContext;
    CSL_IntcEventHandlerRecord EventHandler[30];
    CSL_IntcGlobalEnableState state;
    CSL_Status intStat;
    CSL_Status s = 0;
    // 
    chnId = 9;
    eventId = CSL_GEM_INTC0_OUT_9_PLUS_20_MUL_N; // Interrupt Controller Output CIC0_OUT(9+20*n)
    vectId = CSL_INTC_VECTID_4;   // CPU interrupt number
    sysIntr = CSL_INTC0_RPINT;    // CIC0 Event Inputs - 156: UPPINT (uPP interrupt)

    CSL_intcGlobalNmiEnable();
    // Enable Global Interrupts
    CSL_intcGlobalEnable(&state);

    hnd_UPP = CSL_CPINTC_open(0);
    if (hnd_UPP == 0)
    {
        printf ("Error: Unable to open CPINTC instance 0\n");
        return;
    }

    // Intc Module Initialization
    intcContext.eventhandlerRecord = EventHandler;
    intcContext.numEvtEntries = 10;  // used to allocate isr table entries
    s = CSL_intcInit(&intcContext);
    if (s != CSL_SOK) {
           return;
    }
    CSL_intcInterruptEnable(vectId);

    hIntcUpp = CSL_intcOpen (&intcObjUpp, eventId, &vectId , NULL);

    /* Bind ISR to Interrupt */
    uppHandler.handler = (CSL_IntcEventHandler)&upp_isr;
    uppHandler.arg = 0;
    CSL_intcPlugEventHandler(hIntcUpp, &uppHandler);
    /* Event Clear */
    CSL_intcHwControl(hIntcUpp,CSL_INTC_CMD_EVTCLEAR,NULL);
    /* Event Enable */
    CSL_intcHwControl(hIntcUpp, CSL_INTC_CMD_EVTENABLE, NULL);
    /* */
    CSL_CPINTC_mapSystemIntrToChannel (hnd_UPP, sysIntr, chnId);
    CSL_CPINTC_clearSysInterrupt(hnd_UPP, CSL_INTC0_RPINT);
    CSL_CPINTC_enableSysInterrupt (hnd_UPP, sysIntr);
    CSL_CPINTC_enableHostInterrupt (hnd_UPP, chnId);
    CSL_CPINTC_enableAllHostInterrupt(hnd_UPP);
}

b. 中断程序

void upp_isr()
{
    int intStatus = upp_int_status();

    intCnt.ISR++;

    while (intStatus != 0)
    {
        intrFlag = 1;
        if (intStatus & upp_int_EOLI)
        {
            upp_int_clear(upp_int_EOLI);
            intCnt.EOLI++;
        }
        if (intStatus & upp_int_EOWI)
        {
            upp_int_clear(upp_int_EOWI);
            intCnt.EOWI++;
        }
        if (intStatus & upp_int_ERRI)
        {
            upp_int_clear(upp_int_ERRI);
            intCnt.ERRI++;
        }
        if (intStatus & upp_int_UORI)
        {
            upp_int_clear(upp_int_UORI);
            intCnt.UORI++;
        }
        if (intStatus & upp_int_DPEI)
        {
            upp_int_clear(upp_int_DPEI);
            intCnt.DPEI++;
        }

        if (intStatus & upp_int_EOLQ)
        {
            upp_int_clear(upp_int_EOLQ);
            intCnt.EOLQ++;
        }
        if (intStatus & upp_int_EOWQ)
        {
            upp_int_clear(upp_int_EOWQ);
            intCnt.EOWQ++;
        }
        if (intStatus & upp_int_ERRQ)
        {
            upp_int_clear(upp_int_ERRQ);
            intCnt.ERRQ++;
        }
        if (intStatus & upp_int_UORQ)
        {
            upp_int_clear(upp_int_UORQ);
            intCnt.UORQ++;
        }
        if (intStatus & upp_int_DPEQ)
        {
            upp_int_clear(upp_int_DPEQ);
            intCnt.DPEQ++;
        }

        // make sure all interrupts are handled     
        intStatus = upp_int_status();
    }

    // end of interrupt (is this necessary?)
    uppRegs->UPEOI = 0;
}

备注:

PDK版本为pdk_C6657_1_1_2_6

CCS版本为5.4

谢谢各位的观看及回复

 

  • 你看一下UPP user guide中关于中断服务程序处理,可能漏掉了某个中断状态寄存器的清楚,以及EOI的清楚。

  • 您好,

    已经确认中断状态寄存器(IER)及EOI的清除, 但还是无法解决问题.

    void upp_isr()
    {
        int intStatus = upp_int_status();
    
        intCnt.ISR++;
    
        while (intStatus != 0)
        {
            intrFlag = 1;
            if (intStatus & upp_int_EOLI)
            {
                upp_int_clear(upp_int_EOLI);
                intCnt.EOLI++;
            }
            if (intStatus & upp_int_EOWI)
            {
                upp_int_clear(upp_int_EOWI);
                intCnt.EOWI++;
            }
            if (intStatus & upp_int_ERRI)
            {
                upp_int_clear(upp_int_ERRI);
                intCnt.ERRI++;
            }
            if (intStatus & upp_int_UORI)
            {
                upp_int_clear(upp_int_UORI);
                intCnt.UORI++;
            }
            if (intStatus & upp_int_DPEI)
            {
                upp_int_clear(upp_int_DPEI);
                intCnt.DPEI++;
            }
    
            if (intStatus & upp_int_EOLQ)
            {
                upp_int_clear(upp_int_EOLQ);
                intCnt.EOLQ++;
            }
            if (intStatus & upp_int_EOWQ)
            {
                upp_int_clear(upp_int_EOWQ);
                intCnt.EOWQ++;
            }
            if (intStatus & upp_int_ERRQ)
            {
                upp_int_clear(upp_int_ERRQ);
                intCnt.ERRQ++;
            }
            if (intStatus & upp_int_UORQ)
            {
                upp_int_clear(upp_int_UORQ);
                intCnt.UORQ++;
            }
            if (intStatus & upp_int_DPEQ)
            {
                upp_int_clear(upp_int_DPEQ);
                intCnt.DPEQ++;
            }
    
            // make sure all interrupts are handled     
            intStatus = upp_int_status();
        }
    
        // end of interrupt (is this necessary?)
        uppRegs->UPEOI = 0;
    }
    int upp_int_status()
    {
        Uint32 token = uppRegs->UPIER;
        int returnT = 0;
    
        returnT |= CSL_FEXT(token, UPP_UPIER_EOLI) ? upp_int_EOLI : 0;  // mask end-of-line interrupt
        returnT |= CSL_FEXT(token, UPP_UPIER_EOWI) ? upp_int_EOWI : 0;  // mask end-of-transfer interrupt
        returnT |= CSL_FEXT(token, UPP_UPIER_ERRI) ? upp_int_ERRI : 0;  // mask I/O error interrupt (CBA?)
        returnT |= CSL_FEXT(token, UPP_UPIER_UORI) ? upp_int_UORI : 0;  // mask under/overrun interrupt
        returnT |= CSL_FEXT(token, UPP_UPIER_DPEI) ? upp_int_DPEI : 0;  // mask DMA programming error interrupt
    
        returnT |= CSL_FEXT(token, UPP_UPIER_EOLQ) ? upp_int_EOLQ : 0;  // mask end-of-line interrupt
        returnT |= CSL_FEXT(token, UPP_UPIER_EOWQ) ? upp_int_EOWQ : 0;  // mask end-of-transfer interrupt
        returnT |= CSL_FEXT(token, UPP_UPIER_ERRQ) ? upp_int_ERRQ : 0;  // mask I/O error interrupt (CBA?)
        returnT |= CSL_FEXT(token, UPP_UPIER_UORQ) ? upp_int_UORQ : 0;  // mask under/overrun interrupt
        returnT |= CSL_FEXT(token, UPP_UPIER_DPEQ) ? upp_int_DPEQ : 0;  // mask DMA programming error interrupt
    
        return returnT;
    }
    void upp_int_clear(int flags)
    {
        Uint32 token = 0;
    
        token |= (flags & upp_int_EOLI) ? CSL_FMKT(UPP_UPIER_EOLI, TRUE) : 0;  // clear end-of-line interrupt
        token |= (flags & upp_int_EOWI) ? CSL_FMKT(UPP_UPIER_EOWI, TRUE) : 0;  // clear end-of-transfer interrupt
        token |= (flags & upp_int_ERRI) ? CSL_FMKT(UPP_UPIER_ERRI, TRUE) : 0;  // clear I/O error interrupt (CBA?)
        token |= (flags & upp_int_UORI) ? CSL_FMKT(UPP_UPIER_UORI, TRUE) : 0;  // clear under/overrun interrupt
        token |= (flags & upp_int_DPEI) ? CSL_FMKT(UPP_UPIER_DPEI, TRUE) : 0;  // clear DMA programming error interrupt
    
        token |= (flags & upp_int_EOLQ) ? CSL_FMKT(UPP_UPIER_EOLQ, TRUE) : 0;  // clear end-of-line interrupt
        token |= (flags & upp_int_EOWQ) ? CSL_FMKT(UPP_UPIER_EOWQ, TRUE) : 0;  // clear end-of-transfer interrupt
        token |= (flags & upp_int_ERRQ) ? CSL_FMKT(UPP_UPIER_ERRQ, TRUE) : 0;  // clear I/O error interrupt (CBA?)
        token |= (flags & upp_int_UORQ) ? CSL_FMKT(UPP_UPIER_UORQ, TRUE) : 0;  // clear under/overrun interrupt
        token |= (flags & upp_int_DPEQ) ? CSL_FMKT(UPP_UPIER_DPEQ, TRUE) : 0;  // clear DMA programming error interrupt
    
        uppRegs->UPIER = token;
    }
  • 我也遇到了类似的问题,你可以在中断服务函数最后再映射一次upp(156号事件)中断事件。这样的话每次都能进去中断了。

  • 我也遇到了类似的问题,再把CIC中断标志清除就好了