TI论坛
直播中

郝汉

7年用户 249经验值
私信 关注
[问答]

C6748外部中断运行时按按钮无法进入中断服务程序

以下是我写的外部中断程序,运行时按按钮无法进入中断服务程序。请给位帮忙看一下,程序有没有问题。
#include "gpio.h"
#include "interrupt.h"
#include "psc.h"
//#include "Sys_Init.h"
#include "soc_C6748.h"
#include "lcdkC6748.h"
volatile 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************************************/

回帖(5)

李波

2020-5-26 15:31:01
参考中断例程:
http://www.deyisupport.com/question_answer/dsp_arm/omap_l1x/f/54/t/12550.aspx
 
                                                                         http://processors.wiki.ti.com/index.php/Main_Page
Think Over Before Asking.
http://www.catb.org/~esr/faqs/smart-questions.html#goal
举报

王亮

2020-5-26 15:46:56
受到警告
提示: 作者被禁止或删除 内容自动屏蔽
举报

李波

2020-5-26 16:00:24
引用: ***5 发表于 2020-5-26 17:37
while(1)
[
i ++ ;

嵌入式编译不同于PC编程,嵌入式程序都是一个死循环。PC程序退出是交给操作系统,嵌入式程序退出就没有了,飞了。
                                                                         http://processors.wiki.ti.com/index.php/Main_Page
Think Over Before Asking.
http://www.catb.org/~esr/faqs/smart-questions.html#goal
举报

王亮

2020-5-26 16:09:41
受到警告
提示: 作者被禁止或删除 内容自动屏蔽
举报

更多回帖

发帖
×
20
完善资料,
赚取积分