请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:LP-AM243 工具与软件:
您好、TI
我在中配置了一个 GPIO 输入中断 mcu_plus_sdk_am243x_09_02_01_05/i2c_read_am243x-lp_r5fss0-0_freertos_ti-arm-clang 演示 mcu_plus_sdk_am243x_09_02_01_05/gpio_input_interrupt_am243x-lp_r5fss0-0_nortos_ti-arm-clang 但它无法正常工作。 外部输入定期生成电平变化、但中断回调函数未运行。
这是我的 syscfg、
这是 GPIO 相关代码
/* ti_drivers_config.h */ /* GPIO PIN Macros */ #define GPIO_IMU_INIT_BASE_ADDR (CSL_GPIO1_BASE) #define GPIO_IMU_INIT_PIN (6) #define GPIO_IMU_INIT_DIR (GPIO_DIRECTION_INPUT) #define GPIO_IMU_INIT_TRIG_TYPE (GPIO_TRIG_TYPE_RISE_EDGE) #define GPIO_IMU_INIT_INTR_NUM (CSLR_R5FSS0_CORE0_INTR_MAIN_GPIOMUX_INTROUTER0_OUTP_5) #define CONFIG_GPIO_NUM_INSTANCES (1U) /*------------------------------------*/ /* ti_drivers_config.c */ /* * Board info */ /* This is based on DMSC board config and core */ #define BOARD_BUTTON_GPIO_INTR_NUM (CSLR_R5FSS0_CORE0_INTR_MAIN_GPIOMUX_INTROUTER0_OUTP_5) #define BOARD_BUTTON_GPIO_SWITCH_NUM (5) static void Sciclient_gpioIrqSet(void) { int32_t retVal; struct tisci_msg_rm_irq_set_req rmIrqReq; struct tisci_msg_rm_irq_set_resp rmIrqResp; rmIrqReq.valid_params = 0U; rmIrqReq.valid_params |= TISCI_MSG_VALUE_RM_DST_ID_VALID; rmIrqReq.valid_params |= TISCI_MSG_VALUE_RM_DST_HOST_IRQ_VALID; rmIrqReq.global_event = 0U; rmIrqReq.src_id = TISCI_DEV_GPIO1; rmIrqReq.src_index = TISCI_BANK_SRC_IDX_BASE_GPIO1 + GPIO_GET_BANK_INDEX(6); rmIrqReq.dst_id = TISCI_DEV_R5FSS0_CORE0; rmIrqReq.dst_host_irq = CSLR_R5FSS0_CORE0_INTR_MAIN_GPIOMUX_INTROUTER0_OUTP_5; rmIrqReq.ia_id = 0U; rmIrqReq.vint = 0U; rmIrqReq.vint_status_bit_index = 0U; rmIrqReq.secondary_host = TISCI_MSG_VALUE_RM_UNUSED_SECONDARY_HOST; retVal = Sciclient_rmIrqSet(&rmIrqReq, &rmIrqResp, SystemP_WAIT_FOREVER); if(0 != retVal) { DebugP_log("[Error] Sciclient event config failed!!!\r\n"); DebugP_assert(FALSE); } return; } static void Sciclient_gpioIrqRelease(void) { int32_t retVal; struct tisci_msg_rm_irq_release_req rmIrqReq; rmIrqReq.valid_params = 0U; rmIrqReq.valid_params |= TISCI_MSG_VALUE_RM_DST_ID_VALID; rmIrqReq.valid_params |= TISCI_MSG_VALUE_RM_DST_HOST_IRQ_VALID; rmIrqReq.global_event = 0U; rmIrqReq.src_id = TISCI_DEV_GPIO1; rmIrqReq.src_index = TISCI_BANK_SRC_IDX_BASE_GPIO1 + GPIO_GET_BANK_INDEX(6); rmIrqReq.dst_id = TISCI_DEV_R5FSS0_CORE0; rmIrqReq.dst_host_irq = CSLR_R5FSS0_CORE0_INTR_MAIN_GPIOMUX_INTROUTER0_OUTP_5; rmIrqReq.ia_id = 0U; rmIrqReq.vint = 0U; rmIrqReq.vint_status_bit_index = 0U; rmIrqReq.secondary_host = TISCI_MSG_VALUE_RM_UNUSED_SECONDARY_HOST; retVal = Sciclient_rmIrqRelease(&rmIrqReq, SystemP_WAIT_FOREVER); if(0 != retVal) { DebugP_log("[Error] Sciclient event reset failed!!!\r\n"); DebugP_assert(FALSE); } return; } /*------------------------------------*/ /* user_code.c */ void GPIO_bankIsrFxn(void *args) { uint32_t pinNum = (uint32_t) args; uint32_t bankNum = GPIO_GET_BANK_INDEX(pinNum); uint32_t intrStatus, pinMask = GPIO_GET_BANK_BIT_MASK(pinNum); /* Get and clear bank interrupt status */ intrStatus = GPIO_getBankIntrStatus(gGpioBaseAddr, bankNum); GPIO_clearBankIntrStatus(gGpioBaseAddr, bankNum, intrStatus); DebugP_log("GPIO_bankIsrFxn\r\n"); } void gpio_int_init(void) { int32_t retVal; uint32_t pinNum, intrNum, buttonNum; Board_gpioInit(); HwiP_Params hwiPrms; pinNum = GPIO_IMU_INIT_PIN; intrNum = Board_getGpioButtonIntrNum(); buttonNum = Board_getGpioButtonSwitchNum(); /* Address translate */ gGpioBaseAddr = (uint32_t) AddrTranslateP_getLocalAddr(gGpioBaseAddr); /* Register pin interrupt */ HwiP_Params_init(&hwiPrms); hwiPrms.intNum = intrNum; hwiPrms.callback = &GPIO_bankIsrFxn; hwiPrms.args = (void *) pinNum; retVal = HwiP_construct(&gGpioHwiObject, &hwiPrms); DebugP_assert(retVal == SystemP_SUCCESS ); }