Part Number:TDA4VM
使用官方提供的systool将底层的pinmux重新整理了一遍,在系统中目前是可以找到所有的GPIO了
但是当我在MCU1_0中启用了csl库的gpio初始化函数,函数如下
#define PWM_IN1_PORT 1 #define PWM_IN1_PIN 13 #define PWM_IN1_CFG 0 #define PWM_IN2_PORT 1 #define PWM_IN2_PIN 14 #define PWM_IN2_CFG 1 #define PWM_IN3_PORT 1 #define PWM_IN3_PIN 11 #define PWM_IN3_CFG 2 #define PWM_IN4_PORT 0 #define PWM_IN4_PIN 60 #define PWM_IN4_CFG 3 GPIO_PinConfig MygpioPinConfigs[] = {/* Input pin with interrupt enabled */GPIO_DEVICE_CONFIG(PWM_IN1_PORT, PWM_IN1_PIN) | GPIO_CFG_IN_INT_RISING | GPIO_CFG_INPUT,GPIO_DEVICE_CONFIG(PWM_IN2_PORT, PWM_IN2_PIN) | GPIO_CFG_IN_INT_RISING | GPIO_CFG_INPUT,GPIO_DEVICE_CONFIG(PWM_IN3_PORT, PWM_IN3_PIN) | GPIO_CFG_IN_INT_RISING | GPIO_CFG_INPUT,GPIO_DEVICE_CONFIG(PWM_IN4_PORT, PWM_IN4_PIN) | GPIO_CFG_IN_INT_RISING | GPIO_CFG_INPUT, }; GPIO_CallbackFxn MygpioCallbackFunctions[] = {NULL,NULL,NULL,NULL, }; void Cap_init() {uint8_t bank_num = 0;GPIO_v0_HwAttrs gpio_cfg1;GPIO_v0_HwAttrs gpio_cfg2;GPIO_v0_HwAttrs gpio_cfg3;GPIO_v0_HwAttrs gpio_cfg4;GPIO_socGetInitCfg(PWM_IN4_PORT, &gpio_cfg4);gpio_cfg4.baseAddr = CSL_WKUP_GPIO0_BASE;// bank_num = PWM_IN4_PIN/16;// gpio_cfg4.intCfg[PWM_IN4_PIN].intNum = CSLR_GPIOMUX_INTRTR0_IN_GPIO0_GPIO_BANK_0 + bank_num;// gpio_cfg4.intCfg[PWM_IN4_PIN].intcMuxNum = INVALID_INTC_MUX_NUM;// gpio_cfg4.intCfg[PWM_IN4_PIN].intcMuxInEvent = 0;// gpio_cfg4.intCfg[PWM_IN4_PIN].intcMuxOutEvent = 0;GPIO_configIntRouter(PWM_IN4_PORT, PWM_IN4_PIN, 0, &gpio_cfg4);GPIO_socSetInitCfg(PWM_IN4_PORT, &gpio_cfg4);GPIO_socGetInitCfg(PWM_IN1_PORT, &gpio_cfg1);gpio_cfg1.baseAddr = CSL_GPIO1_BASE;// gpio_cfg1.intCfg[PWM_IN1_PIN].intNum = CSLR_GPIOMUX_INTRTR0_IN_GPIO0_GPIO_BANK_0 + bank_num;// gpio_cfg1.intCfg[PWM_IN1_PIN].intcMuxNum = INVALID_INTC_MUX_NUM;// gpio_cfg1.intCfg[PWM_IN1_PIN].intcMuxInEvent = 0;// gpio_cfg1.intCfg[PWM_IN1_PIN].intcMuxOutEvent = 0;GPIO_configIntRouter(PWM_IN1_PORT, PWM_IN1_PIN, 0, &gpio_cfg1);GPIO_socSetInitCfg(PWM_IN1_PORT, &gpio_cfg1);GPIO_socGetInitCfg(PWM_IN2_PORT, &gpio_cfg2);gpio_cfg2.baseAddr = CSL_GPIO1_BASE;GPIO_configIntRouter(PWM_IN2_PORT, PWM_IN2_PIN, 0, &gpio_cfg2);GPIO_socSetInitCfg(PWM_IN2_PORT, &gpio_cfg2);GPIO_socGetInitCfg(PWM_IN3_PORT, &gpio_cfg3);gpio_cfg3.baseAddr = CSL_GPIO1_BASE;GPIO_configIntRouter(PWM_IN3_PORT, PWM_IN3_PIN, 0, &gpio_cfg3);GPIO_socSetInitCfg(PWM_IN3_PORT, &gpio_cfg3);GPIO_v0_config.pinConfigs = MygpioPinConfigs;GPIO_v0_config.callbacks = MygpioCallbackFunctions;GPIO_v0_config.numberOfPinConfigs = sizeof(MygpioPinConfigs) / sizeof(GPIO_PinConfig);GPIO_v0_config.numberOfCallbacks = sizeof(MygpioCallbackFunctions) / sizeof(GPIO_CallbackFxn);GPIO_v0_config.intPriority = 0x8;GPIO_init();GPIO_setCallback(PWM_IN1_CFG, PwmInCap1Callback);GPIO_enableInt(PWM_IN1_CFG);GPIO_setCallback(PWM_IN2_CFG, PwmInCap2Callback);GPIO_enableInt(PWM_IN2_CFG);GPIO_setCallback(PWM_IN3_CFG, PwmInCap3Callback);GPIO_enableInt(PWM_IN3_CFG);GPIO_setCallback(PWM_IN4_CFG, PwmInCap4Callback);GPIO_enableInt(PWM_IN4_CFG); }
linux的设备树如下(节选):
&wkup_gpio0 { pinctrl-names = "default"; pinctrl-0 = <&wakegpio0_pins_default>; }; &main_gpio0 { pinctrl-names = "default"; pinctrl-0 = <&mygpio0_pins_default>; }; &main_gpio1 { pinctrl-names = "default"; pinctrl-0 = <&mygpio1_pins_default>; };
当包含着上述的系统在启动时,其日志会打印报错:
[ 3.805209] davinci_gpio 42110000.gpio: IRQ index 3 not found [ 3.810951] davinci_gpio 42110000.gpio: error -ENXIO: IRQ not populated [ 3.821153] davinci_gpio 601000.gpio: IRQ index 0 not found [ 3.826738] davinci_gpio 601000.gpio: error -ENXIO: IRQ not populated
启动后,就找不到wakeup和GPIO1的控制端口了;
我不太理解Cls gpio库的初始化函数怎么会与davinci_gpio的驱动函数起冲突,请问有没有人能解释下问题?其实调用CLS库也是为做GPIO中断,我怀疑是在找寻中断号的过程中起了冲突,如果是这样请问该如何解决呢?
pitang niu:
目前我检查了所有的相关配置,发现问题出在
if(setIntrPath){(void)memset (&rmIrqReq,0,sizeof(rmIrqReq));rmIrqReq.secondary_host= TISCI_MSG_VALUE_RM_UNUSED_SECONDARY_HOST;rmIrqReq.src_id= src_id;rmIrqReq.src_index= src_index;/* This is the event coming out ofthe peripheral *//* Set the destination interrupt */rmIrqReq.valid_params|= TISCI_MSG_VALUE_RM_DST_ID_VALID;rmIrqReq.valid_params|= TISCI_MSG_VALUE_RM_DST_HOST_IRQ_VALID;/* Set the destination based on the core */rmIrqReq.dst_id= dst_id;rmIrqReq.dst_host_irq= dst_host_irq;if(GPIO_PinBankUsageCount[portNum][bankNum] == 0U) {retVal = Sciclient_rmIrqSet((const struct tisci_msg_rm_irq_set_req *)&rmIrqReq,&rmIrqResp,SCICLIENT_SERVICE_WAIT_FOREVER);if(retVal==CSL_PASS) {/* Increase the bank usage count for this port */GPIO_PinBankUsageCount[portNum][bankNum]++;}} else {/* The interrupt path is already allocated, no need to re-allocate it */retVal = CSL_PASS;}}这部分作用是用来注册中断路由到指定路劲,注册成功后linux在注册中断时,对应的标志位会出现注册失败的情况,请问MCU1_0注册中断与A72是不能冲突吗?
,
pitang niu:
艹了,什么玩意,妈的A72起来重写我的IO 寄存器,我佛了!