This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5708: 设置GPIO4_4(LED0)的中断来使能LED1亮,但是进不了中断

Part Number: AM5708

设置GPIO4_4(LED0)的中断来使LED1亮,使用GPIOTriggerPinInt来触发,但是运行完这行触发不了中断,下面是我的代码

/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/cfg/global.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>


/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>

#include <stdio.h>

/* TI-RTOS Header files */
#include <ti/drv/gpio/GPIO.h>
#include <ti/drv/gpio/soc/GPIO_soc.h>

/* UART Header files */
#include <ti/drv/uart/UART.h>
#include <ti/drv/uart/UART_stdio.h>

#include <ti/drv/uart/test/src/UART_board.h>

#include <ti/board/board.h>
#include <ti/csl/soc.h>
#include <ti/csl/soc/am572x/src/cslr_control_core_pad_io.h>
#include <ti/board/src/evmAM572x/include/evmam572x_pinmux.h>

/**********************************************************************
 ************************** Macros ************************************
 **********************************************************************/

#define GPIO_PIN_VAL_LOW          (0U)
#define GPIO_PIN_VAL_HIGH         (1U)


#define GPIO_USER0_LED_PIN_NUM    (0x04U)
#define GPIO_USER0_LED_PORT_NUM   (0x04)    /* user-led0, gpio4_4 */
#define GPIO_USER1_LED_PIN_NUM    (0x04U)
#define GPIO_USER1_LED_PORT_NUM   (0x05)    /* user-led1, gpio5_4 */
#define GPIO_USER2_LED_PIN_NUM    (0x05U)
#define GPIO_USER2_LED_PORT_NUM   (0x05)    /* user-led2, gpio5_5 */



/**********************************************************************
 ************************** Internal functions ************************
 **********************************************************************/
/* GPIO Driver board specific pin configuration structure */
GPIO_PinConfig gpioPinConfigs[] = {
    GPIO_DEVICE_CONFIG(GPIO_USER0_LED_PORT_NUM, GPIO_USER0_LED_PIN_NUM) | GPIO_CFG_INPUT | GPIO_CFG_IN_INT_RISING,
    GPIO_DEVICE_CONFIG(GPIO_USER1_LED_PORT_NUM,GPIO_USER1_LED_PIN_NUM) | GPIO_CFG_OUTPUT


};
void myfunc(void)
{
    static int count = 0;
    count ++;
    GPIO_write(1, GPIO_PIN_VAL_HIGH);
}

GPIO_CallbackFxn gpioCallbackFunctions[] = {
     myfunc,
};


/* GPIO Driver configuration structure */
GPIO_v1_Config GPIO_v1_config = {
    gpioPinConfigs,
    gpioCallbackFunctions,
    sizeof(gpioPinConfigs) / sizeof(GPIO_PinConfig),
    sizeof(gpioCallbackFunctions) / sizeof(GPIO_CallbackFxn),
    0x20,
};



/*
 *  ======== main ========
 */

int main(void)
{
    uint32_t regVal = 0;
    //count = 1;
    /* Call board_init functions */
    GPIO_init();

    CSL_FINS(regVal, CONTROL_CORE_PAD_IO_PAD_VIN2A_D3_VIN2A_D3_MUXMODE, 0xEU);
    ((CSL_padRegsOvly) CSL_MPU_CORE_PAD_IO_REGISTERS_REGS)->PAD_VIN2A_D3 = regVal;      /* vin2a_d3.gpio4_4(user_led0) */
    //GPIO_setCallback(0, myfunc);

    /* Enable GPIO interrupt on the specific gpio pin */
    GPIO_enableInt(0);
    GPIO_write(1, GPIO_PIN_VAL_HIGH);
    //GPIO_write(1, GPIO_PIN_VAL_HIGH);
    //GPIO_toggle(0);
    GPIOTriggerPinInt(CSL_IPU_GPIO4_REGS,0,0x4);

   // GPIO_write(1, GPIO_PIN_VAL_LOW);

    //BIOS_start();
    return (0);
}