你好,
目前遇上一个问题, 在连续传送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
谢谢各位的观看及回复