以下是我写的外部中断程序,运行时按按钮无法进入中断服务程序。请给位帮忙看一下,程序有没有问题。
#include "gpio.h"
#include "interrupt.h"
#include "psc.h"
//#include "Sys_Init.h"
#include "soc_C6748.h"
#include "lcdkC6748.h"
vola
tile unsigned char flag = 0;
/****************************************************************************/
/* LOCAL FUNCTION PROTOTYPES */
/****************************************************************************/
static void Delay(volatile unsigned int delay);
void EVMC6748_pinmuxConfig(unsigned int in_reg, unsigned int in_mask, unsigned int in_val) ;
static void InitDspIntc(void) ;
static void GPIOIsr(void) ;
/****************************************************************************/
/* GLOBAL VARIABLES */
/****************************************************************************/
/****************************************************************************/
/* LOCAL FUNCTION DEFINITIONS */
/****************************************************************************/
int main(void)
[
int i = 0 ;
PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_GPIO, PSC_POWERDOMAIN_ALWAYS_ON,
PSC_MDCTL_NEXT_ENABLE);
EVMC6748_pinmuxConfig(6,0xF000,0x8000);
GPIODirModeSet(SOC_GPIO_0_REGS, 37, GPIO_DIR_INPUT);
GPIODirModeSet(SOC_GPIO_0_REGS, 37, GPIO_INT_TYPE_RISEDGE);
GPIOBankIntEnable(SOC_GPIO_0_REGS, 2);
InitDspIntc() ;
while(1)
[
i ++ ;
Delay(1000000);
]
]
/*
** brief This function sets up the status of interrupt.
**
*/
static void InitDspIntc(void)
[
IntDSPINTCInit(); //initialize the interrupt controller
IntGlobalEnable(); //enable DSP CPU interrupts globally
IntRegister(C674X_MASK_INT4, GPIOIsr); //register the ISR in the interrupt vector table
IntEventMap(C674X_MASK_INT4, SYS_INT_GPIO_B2INT); //map the system event GPIO_Bank2(BUTTON) to CPU INT4
IntEnable(C674X_MASK_INT4); //enable the CPU masked INT4
IntEventSet(SYS_INT_GPIO_B2INT); //set the EVTFLAG register of GPIO_Bank2
]
/*
** brief Interrupt Service Routine to be executed on GPIO interrupts.
** This disables the bank interrupts, clears the system interrupt
** status and pin interrupt status. This also sets flag as 1.
*/
static void GPIOIsr(void)
[
/* Disable the interrupts for pins of bank 2 in GPIO.*/
GPIOBankIntDisable(SOC_GPIO_0_REGS, 2);
/* Clear the system interrupt status in the DSPINTC*/
IntEventClear(SYS_INT_GPIO_B2INT);
/* Clears the Interrupt Status of GP2[4] in GPIO.*/
GPIOPinIntClear(SOC_GPIO_0_REGS, 37);
flag = 1;
]
/*
** brief This function checks the insertion status of the MMC/SD card
** in the device and prints related statements on the serial
** commuincation console of the external device.
**
*/
/*
** brief This function can be called to generate a delay.
*/
static void Delay(volatile unsigned int delay)
[
while(delay--);
]
void EVMC6748_pinmuxConfig(unsigned int in_reg, unsigned int in_mask, unsigned int in_val)
[
// unlock the system config registers.
SYSCONFIG->KICKR[0] = KICK0R_UNLOCK;
SYSCONFIG->KICKR[1] = KICK1R_UNLOCK;
// make sure the pinmux register is cleared for the mask bits before
// setting the value.
CLRBIT(SYSCONFIG->PINMUX[in_reg], in_mask);
SETBIT(SYSCONFIG->PINMUX[in_reg], in_val);
// lock the system config registers.
SYSCONFIG->KICKR[0] = KICK0R_LOCK;
SYSCONFIG->KICKR[1] = KICK1R_LOCK;
]
/*****************************END OF FILE************************************/