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.

6678不进GPIO0中断



大家好,

DSP6678设置GPO0中断,在中断内部设置一个计数器记下中断的次数。下载到核心0之后,直接运行,会程序死在_csl_intcIsrdispatch里面,计数器的值为2,说明程序进入中断2次。这是为什么?而我如果下载到核0之后,在中断函数里设置断点,单步执行,则可以看到计数器的值每次都会加一。我的代码如下,请问这是什么原因?是不是哪里错了?谢谢

void setgpio()
{


CSL_GpioHandle hGpio;
CSL_IntcContext intcContext;
CSL_IntcEventHandlerRecord EventHandler[3];
CSL_IntcObj intcObj0, intcobj8;
CSL_IntcHandle hTest0;
CSL_IntcGlobalEnableState state;
CSL_IntcEventHandlerRecord EventRecord0, EventRecord8;
CSL_IntcParam vectId;

Uint8 bankNum = 0;
// Open the CSL GPIO Module 0
hGpio = CSL_GPIO_open (0);
// Enable GPIO per bank interrupt for bank zero
CSL_GPIO_bankInterruptEnable (hGpio, bankNum);
CSL_GPIO_setRisingEdgeDetect (hGpio, 0); // Set interrupt detection on GPIO pin 1 to rising edge
CSL_GPIO_setPinDirInput ( hGpio, 0 ) ; //set pin as input
intcContext.eventhandlerRecord = EventHandler;
intcContext.numEvtEntries = 3;
if (CSL_intcInit(&intcContext) != CSL_SOK)
{
return;
}

if (CSL_intcGlobalNmiEnable() != CSL_SOK)
{/* Enable NMIs */
return;
}
if (CSL_intcGlobalEnable(&state) != CSL_SOK)
{ /* Enable global interrupts */
return;
}

/* Open the INTC Module for Vector ID: 4 and Event ID: 90 (GPIO_n in C6678)*/
vectId = CSL_INTC_VECTID_6; //
hTest0 = CSL_intcOpen (&intcObj0, 90, &vectId , NULL);
if (hTest0 == NULL)
{
return;
}

EventRecord0.handler = &gpio0_Isr; //bind interupt function to gpio0 interrupt
// EventRecord0.arg = 0;
EventRecord0.arg = hTest0;
if (CSL_intcPlugEventHandler(hTest0,&EventRecord0) != CSL_SOK)
{
return;
}
if (CSL_intcHwControl(hTest0,CSL_INTC_CMD_EVTENABLE, NULL) != CSL_SOK)
{
return;
}
printf ("Debug: gpio0 int config Completed\n");

}

volatile int gio0Cnt=0;
interrupt void gpio0_Isr()
{
gio0Cnt++;
}

下面是中断的汇编文件

vect.asm
;--------------------------------------------------------------

;reference to the externally defined ISR
.ref _c_int00
.ref SRIO_Doorbell_ISR
.ref SRIO_Message_ISR
.ref Exception_service_routine
.ref exception_record
.global vectors

;--------------------------------------------------------------
.sect ".text"
;create interrupt vector for NMI
NMI_ISR:
STW B1,*-B15[1]

;save some key registers when exception happens
MVKL exception_record,B1
MVKH exception_record,B1

STW B3, *+B1[0]
STW A4, *+B1[1]
STW B4, *+B1[2]
STW B14, *+B1[3]
STW B15, *+B1[4]

;jump to exception service routine
MVKL Exception_service_routine, B1
MVKH Exception_service_routine, B1
B B1

LDW *-B15[1],B1
NOP 4

;--------------------------------------------------------------
;create interrupt vector for reset (interrupt 0)
VEC_RESET .macro addr
MVKL addr,B0
MVKH addr,B0
B B0
MVC PCE1,B0
NOP 4
.align 32
.endm

;create interrupt vector for other used interrupts
VEC_ENTRY .macro addr
STW B0,*--B15
MVKL addr,B0
MVKH addr,B0
B B0
LDW *B15++,B0
NOP 4
.align 32
.endm

;create interrupt vector for unused interrupts
VEC_DUMMY .macro
unused_int?:
B unused_int? ;dead loop for unused interrupts
NOP 5
.align 32
.endm


;--------------------------------------------------------------
;interrupt vector table
.sect "vecs"
.align 1024

vectors:
VEC_RESET _c_int00 ;RESET
VEC_ENTRY NMI_ISR ;NMI/Exception
VEC_DUMMY ;RSVD
VEC_DUMMY ;RSVD
VEC_ENTRY SRIO_Doorbell_ISR ;interrupt 4
VEC_ENTRY SRIO_Message_ISR ;interrupt 5
VEC_DUMMY
VEC_DUMMY ;interrupt 7
VEC_DUMMY ;interrupt 8
VEC_DUMMY ;interrupt 9
VEC_DUMMY ;interrupt 10
VEC_DUMMY ;interrupt 11
VEC_DUMMY ;interrupt 12
VEC_DUMMY ;interrupt 13
VEC_DUMMY ;interrupt 14
VEC_DUMMY ;interrupt 15

.end