Tool/software: TI-RTOS
#include "main.h"
#include "common.h"
extern Int ipc_main();
extern Void IpcMgr_ipcStartup(Void);
void AppGpioCallbackFxn(void) {
GPIO_toggle(LED);
}
void task1(UArg arg0, UArg arg1) {
for (;;) {
Task_yield();
}
}
void task2(UArg arg0, UArg arg1) {
/* Set the callback function */
GPIO_setCallback(AD_BUSY, AppGpioCallbackFxn);
/* Enable GPIO interrupt on the specific gpio pin */
GPIO_enableInt(AD_BUSY);
for (;;) {
uint32_t gpioBaseAddr;
uint32_t gpioPin;
gpioBaseAddr = 0x48057000;
gpioPin = 0x1f;
/* Trigger interrupt */
// GPIOTriggerPinInt(gpioBaseAddr, 1, gpioPin);
delay(10000000);
Task_yield();
}
}
int main(void) {
Task_Handle task;
Error_Block eb;
xdc_Int ret = !Resource_S_SUCCESS;
xdc_UInt32 *va = (UInt32*)0X4A000000;
ret = Resource_physToVirt(0X4A000000, va);
if (ret == Resource_S_SUCCESS) {
*(UInt32*)0x4A0037CC = (UInt32)0x9000E; //gpio7_17
*(UInt32*)0x4A003554 = (UInt32)0x1000E; //gpio3_28
*(UInt32*)0x4A003558 = (UInt32)0x1000E; //gpio3_29
*(UInt32*)0x4A003560 = (UInt32)0x5000E; //gpio3_31
*(UInt32*)(0x4A002978 + 0x00000978) = (UInt32)(0x1a << 16);
}
/*
ret = !Resource_S_SUCCESS;
va = (UInt32*)0X48000000;
ret = Resource_physToVirt(0X48000000, va);
if (ret == Resource_S_SUCCESS) {
*(UInt32*)0x48057148 = (UInt32)0x80000000; //gpio3_31
}
*/
GPIO_init();
Error_init(&eb);
task = Task_create(task1, NULL, &eb);
if (task == NULL) {
System_printf("Task_create() failed!\n");
BIOS_exit(0);
}
task = Task_create(task2, NULL, &eb);
if (task == NULL) {
System_printf("Task_create() failed!\n");
BIOS_exit(0);
}
ipc_main();
IpcMgr_ipcStartup();
BIOS_start();
return (0);
}
gpio3_31 as interrupt input, GPIO_CFG_IN_INT_RISING is configured.But when I used it, it will report an error, please to tell me ?
