工具与软件:
您好!
在我们的器件上、我们尝试对从 MCU_PLUS_SDK 获取的某些代码使用基于组的中断、但是我们遇到了问题。 首先、我要先讲一讲目前的代码:
int32_t IOLM_SOC_UTIL_gpioIrqSet(uint32_t u32BankNumber_p, uint32_t u32IntRouter_p, uint32_t u32IntSrcID_p, uint32_t u32IntDstID_p, uint32_t u32BankSrcIndexBase_p) { int32_t retVal = SystemP_FAILURE; struct tisci_msg_rm_irq_set_req rmIrqReq; struct tisci_msg_rm_irq_set_resp rmIrqResp; /* For setting the IRQ for GPIO using sciclient APIs, we need to populate * a structure, tisci_msg_rm_irq_set_req instantiated above. The definition * of this struct and details regarding the struct members can be found in * the tisci_rm_irq.h. */ /* Initialize all flags to zero since we'll be setting only a few */ rmIrqReq.valid_params = 0U; /* Our request has a destination id, so enable the flag for DST ID */ rmIrqReq.valid_params |= TISCI_MSG_VALUE_RM_DST_ID_VALID; /* DST HOST IRQ is the output index of the interrupt router. We need to make sure this is also enabled as a valid * param */ rmIrqReq.valid_params |= TISCI_MSG_VALUE_RM_DST_HOST_IRQ_VALID; /* This is not a global event */ rmIrqReq.global_event = 0U; /* Our interrupt source would be the GPIO peripheral. The source id has to be a device id recognizable by the SYSFW. * The list of device IDs can be found in tisci_devices.h file under * source/drivers/sciclient/include/tisci/am64x_am243x/. In GPIO case there are 3 possible options - TISCI_DEV_GPIO0, * TISCI_DEV_GPIO1, TISCI_DEV_MCU_GPIO0. For input interrupt, we need to choose the TISCI_DEV_GPIO1 */ rmIrqReq.src_id = u32IntSrcID_p; /* This is the interrupt source index within the GPIO peripheral */ rmIrqReq.src_index = u32BankSrcIndexBase_p + u32BankNumber_p; /* This is the destination of the interrupt, usually a CPU core. Here we choose the TISCI device ID for R5F0-0 core. * For a different core, the corresponding TISCI device id has to be provided */ rmIrqReq.dst_id = u32IntDstID_p; /* This is the output index of the interrupt router. This depends on the core and board configuration */ rmIrqReq.dst_host_irq = u32IntRouter_p; /* Rest of the struct members are unused for GPIO interrupt */ rmIrqReq.ia_id = 0U; rmIrqReq.vint = 0U; rmIrqReq.vint_status_bit_index = 0U; rmIrqReq.secondary_host = TISCI_MSG_VALUE_RM_UNUSED_SECONDARY_HOST; /* To set the interrupt we now invoke the Sciclient_rmIrqSet function which * will find out the route to configure the interrupt and request DMSC to * grant the resource */ retVal = Sciclient_rmIrqSet(&rmIrqReq, &rmIrqResp, SystemP_WAIT_FOREVER); return retVal; }
这来自 mcu_plus_sdk/docs/api_guide_am64x/drivers_SCICLIENT_page.html。
int32_t IOLM_SOC_UTIL_registerGPIOInterrupt(HwiP_Object* gpioHwiObject_p, uint32_t u32Bank_p, uint32_t u32Base_p, uint32_t u32BaseIndex_p, uint32_t u32Router_p, uint32_t u32Src_p, uint32_t u32Dst_p, HwiP_FxnCallback vISR_p) { int32_t retVal = SystemP_SUCCESS; HwiP_Params hwiPrms; // setup the GPIO input interrupt capability // interrupt router needs to exist, ie. MCU_GPIO0 to R50_0 retVal = IOLM_SOC_UTIL_gpioIrqSet(u32Bank_p, u32Router_p, u32Src_p, u32Dst_p, u32BaseIndex_p); if (SystemP_SUCCESS == retVal) { GPIO_bankIntrEnable(u32Base_p, u32Bank_p); // not pin interrupt /* Register pin interrupt */ HwiP_Params_init(&hwiPrms); hwiPrms.intNum = u32Router_p; hwiPrms.callback = vISR_p; hwiPrms.args = (void*)u32Bank_p; // NOLINT retVal = HwiP_construct(gpioHwiObject_p, &hwiPrms); } else { printf("Error setting up interrupt.\n"); } return retVal; }
此代码主要来自 mcu_plus_sdk/docs/api_guide_am64x/drivers_gpio_page.html。
问题就在这里:我们正在尝试进行状态中断。 在电路板上、我们需要中断的引脚为 GPIO0_45、GPIO0_46、GPIO0_47和 GPIO0_48。 因此、 根据 SDK 中的示例代码、我们认为以下是 IOLM_SOC_UTIL_registerGPIOInterrupt 的参数:
u32Bank_p:2 (这仅涵盖引脚 GPIO0_45:47、但我们获得该值是因为每个组有16个引脚)
u32Base_p:CSL_GPIO0_BASE (因为我们想要中断的引脚为 GPIO0)
u32BaseIndex_p:90 ( 这是我们最常遇到的问题。 由于 SDK 示例使用的是 GPIO1、因此我们不知道该值是否正确。 此值添加到存储体编号以填充 tisci_msg_rm_irq_set_req 结构中的 src_index 字段、但当我们尝试90时、它不起作用 )
u32Router_p: CSLR_R5FSS0_CORE0_INTR_MAIN_GPIOMUX_INTROUTER0_OUTP_8
u32Src_p: TISCI_DEV_GPIO0
u32Dst_p: TISCI_DEV_R5FSS0_CORE0
最后、我们做了大量实验来验证 u32BaseIndex_p 的值应该是什么。 我们成功启用了该功能 个中断 仅在一个引脚上 暴力破解 tisci_msg_rm_irq_set_req 结构中的 SRC_INDEX 等于45、即我们要监测的一个引脚的 GPIO 数(GPIO0_45)。 对我们来说、这指向了一个事实、即我们的当前代码未正确注册 组 发生了什么、更确切地说是如此 质量 个中断。
希望这是足够的信息、如果您需要更多信息、请告诉我。 谢谢你