Other Parts Discussed in Thread: OMAPL138
Tool/software: TI-RTOS
I have a problem while configuring GP1 [13]. There is no interruption when the status changes. What is wrong?
btw what does "index" mean in GPIO_read (index) functions?
//***
typedef enum GPIO_PIN {
GPIO_PIN_MMC_SDCD = 0U,
GPIO_PIN_SWITCH,
GPIO_PIN_COUNT
}GPIO_PIN;
#define GPIO_SWITCH_PORT_NUM (0U)
#define GPIO_SWITCH_PIN_NUM (29U) //GP1[13]
/* GPIO Driver board specific pin configuration structure */
GPIO_PinConfig gpioPinConfigs[] = {
/* Output pin : AM335X_ICE V2_LD_PIN */
GPIO_DEVICE_CONFIG(GPIO_MMC_SDCD_PORT_NUM, GPIO_MMC_SDCD_PIN_NUM) |
GPIO_CFG_IN_INT_BOTH_EDGES | GPIO_CFG_INPUT,
GPIO_DEVICE_CONFIG(GPIO_SWITCH_PORT_NUM, GPIO_SWITCH_PIN_NUM) |
GPIO_CFG_IN_INT_BOTH_EDGES | GPIO_CFG_INPUT
};
/* GPIO Driver call back functions */
GPIO_CallbackFxn gpioCallbackFunctions[] = {
NULL,
NULL
};
/* GPIO Driver configuration structure */
#if defined(SOC_K2G) || defined(SOC_OMAPL137) || defined(SOC_OMAPL138)
GPIO_v0_Config GPIO_v0_config = {
gpioPinConfigs,
gpioCallbackFunctions,
sizeof(gpioPinConfigs) / sizeof(GPIO_PinConfig),
sizeof(gpioCallbackFunctions) / sizeof(GPIO_CallbackFxn),
0,
};
//-----------------------------------------------------------
void board_initGPIO(void)
{
#if defined(SOC_K2H) || defined(SOC_K2K) || defined(SOC_K2E) || defined(SOC_K2L) || defined(SOC_K2G) || defined(SOC_C6678) || defined(SOC_C6657) || defined(SOC_OMAPL137) || defined(SOC_OMAPL138)
GPIO_v0_HwAttrs gpio_cfg;
/* Get the default SPI init configurations */
GPIO_socGetInitCfg(GPIO_MMC_SDCD_PORT_NUM, &gpio_cfg);
/* Modify the default GPIO configurations if necessary */
/* Set the default GPIO init configurations */
GPIO_socSetInitCfg(GPIO_MMC_SDCD_PORT_NUM, &gpio_cfg);
#if defined(SOC_K2G)
/* Setup GPIO interrupt configurations */
GPIO_socSetIntMux(GPIO_MMC_SDCD_PORT_NUM, GPIO_MMC_SDCD_PIN_NUM, NULL, GPIO_MUX_SEL);
#endif
#if defined(SOC_OMAPL137) || defined(SOC_OMAPL138)
/* Setup GPIO interrupt configurations */
GPIO_socSetBankInt(GPIO_MMC_SDCD_PORT_NUM, GPIO_MMC_SDCD_PIN_NUM, NULL);
GPIO_socSetBankInt(GPIO_SWITCH_PORT_NUM, GPIO_SWITCH_PIN_NUM, NULL);
#endif
#endif
}
//------------------------------------------------------------------
void mmcsd_fatfs_console(UArg arg0, UArg arg1)
{
/* Perform board specific GPIO init */
board_initGPIO();
/* GPIO initialization */
GPIO_init();
/* Set the callback function */
GPIO_setCallback(GPIO_PIN_MMC_SDCD, AppGpioCallbackFxn);
/* Enable GPIO interrupt on the specific gpio pin */
GPIO_enableInt(GPIO_PIN_MMC_SDCD);
/* Set the callback function */
GPIO_setCallback(GPIO_PIN_SWITCH, AppGpioCallbackFxn2);
/* Enable GPIO interrupt on the specific gpio pin */
GPIO_enableInt(GPIO_PIN_SWITCH);
/* MMCSD FATFS initialization */
FATFS_init();
if (GPIO_PIN_MMC_SDCD_ACTIVE_STATE != GPIO_read(GPIO_PIN_MMC_SDCD))
{
FATFS_open(0U, NULL, &fatfsHandle);
fatfsShellProcessFlag = 1;
}
else
{
MMCSD_log ("\nPlease insert card.\r\n");
}
while(1)
{
//*******
}
//-----------------------------------------------------------------
int main(void)
{
Task_Handle task;
Task_Handle main_task;
Task_Params taskParams;
Error_Block eb;
/* Call board init functions */
Board_initCfg boardCfg;
boardCfg = BOARD_INIT_PINMUX_CONFIG |
BOARD_INIT_MODULE_CLOCK | BOARD_INIT_UART_STDIO;
Board_init(boardCfg);
Error_init(&eb);
task = Task_create(mmcsd_fatfs_console, NULL, &eb);
if (task == NULL) {
System_printf("Task_create() failed!\n");
BIOS_exit(0);
}
/* Start BIOS */
BIOS_start();
return (0);
}
//------------------------------------------------------
/*
* ======== Callback function ========
*/
void AppGpioCallbackFxn(void)
{
Task_sleep(200);
}
void AppGpioCallbackFxn2(void)
{
Task_sleep(200);
}