|
你好!
你们有做过AM5728的DSP端的GPIO外部中断的例程吗?我现在用DSP做GPIO的外部中断,总是进去不中断,不知道是不是中断的参数不对。以下是我的配置代码,代码是基于SYSBIOS 的
uint32_t gpio_base_address = 0x4805D000; //GPIO6
uint32_t *p_mmc3_dat4 = (uint32_t*)0x4A0036E8; //GPIO6_4
#define GPIO_PIN 4
uint32_t intrRegister=0;
#define rawDebug System_printf
/*****************************************************************************
功 能: GPIO6_4_IRQHandler
参 数: 无
返 回 值: 无
*****************************************************************************/
void GPIO6_4_IRQHandler(void)
{
GPIOPinIntClear(gpio_base_address, GPIO_INT_LINE_1, GPIO_PIN);
rawDebug("GPIO6_4_IRQHandler \r\n");
}
/*****************************************************************************
功 能: 初始化
参 数: 无
返 回 值: 无
*****************************************************************************/
void GPIO6_4_Init(void)
{
//配置复用引脚为gpio输入模式,并且上拉并上拉使能
//uint32_t *p_mmc3_dat4 = (uint32_t*)0x6A003794;
*p_mmc3_dat4 &= ~1;
*p_mmc3_dat4 |= (0x3<<17) | 0xe;
/* Initialize with defaults */
int32_t retVal = 0;
OsalRegisterIntrParams_t interruptRegParams;
HwiP_Handle hwiPHandlePtr;
Osal_RegisterInterrupt_initParams(&interruptRegParams);
/* Populate the interrupt parameters */
interruptRegParams.corepacConfig.arg = NULL;
file:///C:\Users\ADMINI~1\AppData\Local\Temp\%W@GJ$ACOF(TYDYECOKVDYB.pnginterruptRegParams.corepacConfig.name = NULL;
interruptRegParams.corepacConfig.isrRoutine = GPIO6_4_IRQHandler;
interruptRegParams.corepacConfig.priority = 0x1U;
interruptRegParams.corepacConfig.intVecNum = 60;
interruptRegParams.corepacConfig.corepacEventNum = 0;
/* Register interrupts */
if( !intrRegister )
{
retVal = Osal_RegisterInterrupt(&interruptRegParams, &hwiPHandlePtr);
if(retVal != OSAL_INT_SUCCESS) {
Log_print0(Diags_INFO,"Osal_RegisterInterrupt Failed!!!");
}
else
intrRegister = (uint32_t) TRUE;
}
/*Reset GPIO*/
GPIOModuleReset(gpio_base_address);
/*Enable GPIO*/
GPIOModuleEnable(gpio_base_address);
GPIOIntTypeSet(gpio_base_address, GPIO_PIN, 0x20); //设置下降沿
GPIODirModeSet(gpio_base_address, GPIO_PIN, 1); //设置为输入模式
GPIOPinIntDisable(gpio_base_address, GPIO_INT_LINE_1, GPIO_PIN);
GPIOPinIntClear(gpio_base_address, GPIO_INT_LINE_1, GPIO_PIN);
/*Enable interrupt*/
GPIOPinIntEnable(gpio_base_address, GPIO_INT_LINE_1, GPIO_PIN);
}
|
|