From 9d0b860e546dab0204f0ed01f50458748da743b3 Mon Sep 17 00:00:00 2001 From: yangjie Date: Fri, 11 Sep 2020 11:14:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[components][driver/pin.c]pin=20=E6=A1=86?= =?UTF-8?q?=E6=9E=B6=E5=A2=9E=E5=8A=A0=20rt=5Fpin=5Fget?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/drivers/include/drivers/pin.h | 3 +++ components/drivers/misc/pin.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/components/drivers/include/drivers/pin.h b/components/drivers/include/drivers/pin.h index ca35407932..f5b2ded9f6 100644 --- a/components/drivers/include/drivers/pin.h +++ b/components/drivers/include/drivers/pin.h @@ -74,10 +74,13 @@ struct rt_pin_ops rt_uint32_t mode, void (*hdr)(void *args), void *args); rt_err_t (*pin_detach_irq)(struct rt_device *device, rt_int32_t pin); rt_err_t (*pin_irq_enable)(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled); + rt_base_t (*pin_get)(const char *name); }; int rt_device_pin_register(const char *name, const struct rt_pin_ops *ops, void *user_data); +/* Get pin number by name,such as PA.0,P0.12 */ +rt_base_t rt_pin_get(const char *name); void rt_pin_mode(rt_base_t pin, rt_base_t mode); void rt_pin_write(rt_base_t pin, rt_base_t value); int rt_pin_read(rt_base_t pin); diff --git a/components/drivers/misc/pin.c b/components/drivers/misc/pin.c index aca58ee21b..2750f5105a 100644 --- a/components/drivers/misc/pin.c +++ b/components/drivers/misc/pin.c @@ -151,3 +151,18 @@ int rt_pin_read(rt_base_t pin) return _hw_pin.ops->pin_read(&_hw_pin.parent, pin); } FINSH_FUNCTION_EXPORT_ALIAS(rt_pin_read, pinRead, read status from hardware pin); + +rt_base_t rt_pin_get(const char *name) +{ + RT_ASSERT(_hw_pin.ops != RT_NULL); + RT_ASSERT(name[0] == 'P'); + + if(_hw_pin.ops->pin_get == RT_NULL) + { + return -RT_ENOSYS; + } + + return _hw_pin.ops->pin_get(name); +} +FINSH_FUNCTION_EXPORT_ALIAS(rt_pin_get, pinGet, get pin number from hardware pin); + From 38b3a3445e59d11b5efbfafb72c4bdc4bcb6fee4 Mon Sep 17 00:00:00 2001 From: yangjie Date: Fri, 11 Sep 2020 11:16:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[bsp][driver]=20=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=20BSP=20=E4=B8=AD=E7=9A=84=20rt=5Fpin=5Fops?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/allwinner_tina/drivers/drv_gpio.c | 1 + bsp/apollo2/board/gpio.c | 1 + bsp/at32/Libraries/rt_drivers/drv_gpio.c | 1 + bsp/beaglebone/drivers/gpio.c | 4 ++ bsp/essemi/es32f0271/drivers/drv_gpio.c | 1 + bsp/essemi/es32f0334/drivers/drv_gpio.c | 1 + bsp/essemi/es32f0654/drivers/drv_gpio.c | 1 + bsp/essemi/es32f369x/drivers/drv_gpio.c | 1 + bsp/essemi/es8p508x/drivers/drv_gpio.c | 1 + bsp/gd32303e-eval/drivers/drv_gpio.c | 1 + bsp/gd32e230k-start/drivers/drv_gpio.c | 1 + bsp/gd32vf103v-eval/drivers/drv_gpio.c | 1 + bsp/imxrt/libraries/drivers/drv_gpio.c | 3 +- bsp/k210/driver/drv_gpio.c | 3 +- bsp/lpc54114-lite/drivers/drv_gpio.c | 45 +++++++++++++++++- bsp/lpc55sxx/Libraries/drivers/drv_pin.c | 1 + bsp/ls1cdev/drivers/drv_gpio.c | 3 +- bsp/ls2kdev/drivers/drv_gpio.c | 1 + bsp/mm32l3xx/drivers/drv_gpio.c | 1 + bsp/nrf5x/libraries/drivers/drv_gpio.c | 1 + .../gd32vf103/HAL_Drivers/drv_gpio.c | 1 + .../libraries/m480/rtt_port/drv_gpio.c | 3 +- bsp/raspberry-pi/raspi3-32/driver/drv_gpio.c | 1 + bsp/raspberry-pi/raspi3-64/driver/drv_gpio.c | 1 + bsp/raspberry-pi/raspi4-32/driver/drv_gpio.c | 1 + bsp/raspberry-pi/raspi4-64/driver/drv_gpio.c | 1 + bsp/rv32m1_vega/ri5cy/driver/drv_gpio.c | 3 +- bsp/stm32/libraries/HAL_Drivers/drv_gpio.c | 46 +++++++++++++++++++ bsp/swm320-lq100/drivers/drv_gpio.c | 3 +- bsp/tm4c123bsp/libraries/Drivers/drv_gpio.c | 1 + bsp/w60x/drivers/drv_pin.c | 3 +- 31 files changed, 129 insertions(+), 8 deletions(-) diff --git a/bsp/allwinner_tina/drivers/drv_gpio.c b/bsp/allwinner_tina/drivers/drv_gpio.c index b121842b30..999ab473a0 100644 --- a/bsp/allwinner_tina/drivers/drv_gpio.c +++ b/bsp/allwinner_tina/drivers/drv_gpio.c @@ -538,6 +538,7 @@ static const struct rt_pin_ops ops = pin_attach_irq, pin_detach_irq, pin_irq_enable, + RT_NULL, }; #endif diff --git a/bsp/apollo2/board/gpio.c b/bsp/apollo2/board/gpio.c index c2eb1be581..c985e0f2a7 100644 --- a/bsp/apollo2/board/gpio.c +++ b/bsp/apollo2/board/gpio.c @@ -212,6 +212,7 @@ const static struct rt_pin_ops am_pin_ops = am_pin_attach_irq, am_pin_dettach_irq, am_pin_irq_enable, + RT_NULL, }; int rt_hw_pin_init(void) diff --git a/bsp/at32/Libraries/rt_drivers/drv_gpio.c b/bsp/at32/Libraries/rt_drivers/drv_gpio.c index 8ea3f83f43..d6fd0594dc 100644 --- a/bsp/at32/Libraries/rt_drivers/drv_gpio.c +++ b/bsp/at32/Libraries/rt_drivers/drv_gpio.c @@ -496,6 +496,7 @@ const static struct rt_pin_ops _at32_pin_ops = at32_pin_attach_irq, at32_pin_dettach_irq, at32_pin_irq_enable, + RT_NULL, }; rt_inline void pin_irq_hdr(int irqno) diff --git a/bsp/beaglebone/drivers/gpio.c b/bsp/beaglebone/drivers/gpio.c index 7eb9737573..425fbb4f4e 100644 --- a/bsp/beaglebone/drivers/gpio.c +++ b/bsp/beaglebone/drivers/gpio.c @@ -84,6 +84,10 @@ static struct rt_pin_ops am33xx_pin_ops = am33xx_pin_mode, am33xx_pin_write, am33xx_pin_read, + RT_NULL, + RT_NULL, + RT_NULL, + RT_NULL, }; int rt_hw_gpio_init(void) diff --git a/bsp/essemi/es32f0271/drivers/drv_gpio.c b/bsp/essemi/es32f0271/drivers/drv_gpio.c index 293febc728..74a703a91a 100644 --- a/bsp/essemi/es32f0271/drivers/drv_gpio.c +++ b/bsp/essemi/es32f0271/drivers/drv_gpio.c @@ -450,6 +450,7 @@ const static struct rt_pin_ops _es32f0_pin_ops = es32f0_pin_attach_irq, es32f0_pin_detach_irq, es32f0_pin_irq_enable, + RT_NULL, }; int rt_hw_pin_init(void) diff --git a/bsp/essemi/es32f0334/drivers/drv_gpio.c b/bsp/essemi/es32f0334/drivers/drv_gpio.c index af057f8916..d816af5fd3 100644 --- a/bsp/essemi/es32f0334/drivers/drv_gpio.c +++ b/bsp/essemi/es32f0334/drivers/drv_gpio.c @@ -408,6 +408,7 @@ const static struct rt_pin_ops _es32f0_pin_ops = es32f0_pin_attach_irq, es32f0_pin_detach_irq, es32f0_pin_irq_enable, + RT_NULL, }; int rt_hw_pin_init(void) diff --git a/bsp/essemi/es32f0654/drivers/drv_gpio.c b/bsp/essemi/es32f0654/drivers/drv_gpio.c index 680860757f..142fcce7fc 100644 --- a/bsp/essemi/es32f0654/drivers/drv_gpio.c +++ b/bsp/essemi/es32f0654/drivers/drv_gpio.c @@ -408,6 +408,7 @@ const static struct rt_pin_ops _es32f0_pin_ops = es32f0_pin_attach_irq, es32f0_pin_detach_irq, es32f0_pin_irq_enable, + RT_NULL, }; int rt_hw_pin_init(void) diff --git a/bsp/essemi/es32f369x/drivers/drv_gpio.c b/bsp/essemi/es32f369x/drivers/drv_gpio.c index c9bf1c946a..37a24d956c 100644 --- a/bsp/essemi/es32f369x/drivers/drv_gpio.c +++ b/bsp/essemi/es32f369x/drivers/drv_gpio.c @@ -408,6 +408,7 @@ const static struct rt_pin_ops _es32f3_pin_ops = es32f3_pin_attach_irq, es32f3_pin_detach_irq, es32f3_pin_irq_enable, + RT_NULL, }; int rt_hw_pin_init(void) diff --git a/bsp/essemi/es8p508x/drivers/drv_gpio.c b/bsp/essemi/es8p508x/drivers/drv_gpio.c index b91532a706..9dfc09ef8e 100644 --- a/bsp/essemi/es8p508x/drivers/drv_gpio.c +++ b/bsp/essemi/es8p508x/drivers/drv_gpio.c @@ -382,6 +382,7 @@ const static struct rt_pin_ops _es8p_pin_ops = es8p_pin_attach_irq, es8p_pin_detach_irq, es8p_pin_irq_enable, + RT_NULL, }; int rt_hw_pin_init(void) diff --git a/bsp/gd32303e-eval/drivers/drv_gpio.c b/bsp/gd32303e-eval/drivers/drv_gpio.c index 8c2bde3e3a..b7285513d3 100644 --- a/bsp/gd32303e-eval/drivers/drv_gpio.c +++ b/bsp/gd32303e-eval/drivers/drv_gpio.c @@ -497,6 +497,7 @@ const static struct rt_pin_ops _gd32_pin_ops = gd32_pin_attach_irq, gd32_pin_detach_irq, gd32_pin_irq_enable, + RT_NULL, }; int rt_hw_pin_init(void) diff --git a/bsp/gd32e230k-start/drivers/drv_gpio.c b/bsp/gd32e230k-start/drivers/drv_gpio.c index 521db3823b..4176798cfd 100644 --- a/bsp/gd32e230k-start/drivers/drv_gpio.c +++ b/bsp/gd32e230k-start/drivers/drv_gpio.c @@ -388,6 +388,7 @@ const static struct rt_pin_ops _gd32_pin_ops = gd32_pin_attach_irq, gd32_pin_detach_irq, gd32_pin_irq_enable, + RT_NULL, }; int rt_hw_pin_init(void) diff --git a/bsp/gd32vf103v-eval/drivers/drv_gpio.c b/bsp/gd32vf103v-eval/drivers/drv_gpio.c index 03b27aef9c..95393cd4f2 100644 --- a/bsp/gd32vf103v-eval/drivers/drv_gpio.c +++ b/bsp/gd32vf103v-eval/drivers/drv_gpio.c @@ -427,6 +427,7 @@ const static struct rt_pin_ops _gd32vf_pin_ops = gd32vf_pin_attach_irq, gd32vf_pin_dettach_irq, gd32vf_pin_irq_enable, + RT_NULL, }; rt_inline void pin_irq_hdr(int irqno) diff --git a/bsp/imxrt/libraries/drivers/drv_gpio.c b/bsp/imxrt/libraries/drivers/drv_gpio.c index ee1d2eb96b..a2e9dda3d7 100644 --- a/bsp/imxrt/libraries/drivers/drv_gpio.c +++ b/bsp/imxrt/libraries/drivers/drv_gpio.c @@ -587,7 +587,8 @@ const static struct rt_pin_ops imxrt_pin_ops = imxrt_pin_read, imxrt_pin_attach_irq, imxrt_pin_detach_irq, - imxrt_pin_irq_enable + imxrt_pin_irq_enable, + RT_NULL, }; int rt_hw_pin_init(void) diff --git a/bsp/k210/driver/drv_gpio.c b/bsp/k210/driver/drv_gpio.c index 4efce0e827..578e71558a 100644 --- a/bsp/k210/driver/drv_gpio.c +++ b/bsp/k210/driver/drv_gpio.c @@ -251,7 +251,8 @@ const static struct rt_pin_ops drv_pin_ops = drv_pin_attach_irq, drv_pin_detach_irq, - drv_pin_irq_enable + drv_pin_irq_enable, + RT_NULL, }; int rt_hw_pin_init(void) diff --git a/bsp/lpc54114-lite/drivers/drv_gpio.c b/bsp/lpc54114-lite/drivers/drv_gpio.c index 2e1b4de609..978fa2898e 100644 --- a/bsp/lpc54114-lite/drivers/drv_gpio.c +++ b/bsp/lpc54114-lite/drivers/drv_gpio.c @@ -38,6 +38,48 @@ struct rt_pin_irq_hdr pin_irq_hdr_tab[] = {-1, 0, RT_NULL, RT_NULL}, }; +static rt_base_t lpc_pin_get(const char *name) +{ + rt_base_t pin = 0; + int hw_port_num, hw_pin_num = 0; + int i, name_len = 1; + int mul = 1; + + name_len = rt_strlen(name); + + if ((name_len < 4) || (name_len >= 6)) + { + return -RT_EINVAL; + } + if ((name[0] != 'P') || (name[2] != '.')) + { + return -RT_EINVAL; + } + + if ((name[1] >= '0') && (name[1] <= '9')) + { + hw_port_num = (int)(name[1] - '0'); + } + else + { + return -RT_EINVAL; + } + + for (i = name_len - 1; i > 2; i--) + { + hw_pin_num += ((int)(name[i] - '0') * mul); + mul = mul * 10; + } + + pin = 32 * hw_port_num + hw_pin_num; + + if ((pin > PIN_MAX_VAL) || (pin < 0)) + { + return -RT_EINVAL; + } + return pin; +} + /* Configure pin mode. pin 0~63 means PIO0_0 ~ PIO1_31 */ static void lpc_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode) { @@ -288,7 +330,8 @@ const static struct rt_pin_ops _lpc_pin_ops = lpc_pin_read, lpc_pin_attach_irq, lpc_pin_detach_irq, - lpc_pin_irq_enable, + lpc_pin_irq_enable, + lpc_pin_get, }; int rt_hw_pin_init(void) diff --git a/bsp/lpc55sxx/Libraries/drivers/drv_pin.c b/bsp/lpc55sxx/Libraries/drivers/drv_pin.c index cc8d027c7c..48d26a5825 100644 --- a/bsp/lpc55sxx/Libraries/drivers/drv_pin.c +++ b/bsp/lpc55sxx/Libraries/drivers/drv_pin.c @@ -419,6 +419,7 @@ int rt_hw_pin_init(void) lpc_pin_ops.pin_attach_irq = lpc_pin_attach_irq; lpc_pin_ops.pin_detach_irq = lpc_pin_detach_irq; lpc_pin_ops.pin_irq_enable = lpc_pin_irq_enable; + lpc_pin_ops.pin_get = RT_NULL, ret = rt_device_pin_register("pin", &lpc_pin_ops, RT_NULL); diff --git a/bsp/ls1cdev/drivers/drv_gpio.c b/bsp/ls1cdev/drivers/drv_gpio.c index 2203db7775..14b44c9b6f 100644 --- a/bsp/ls1cdev/drivers/drv_gpio.c +++ b/bsp/ls1cdev/drivers/drv_gpio.c @@ -122,7 +122,8 @@ const static struct rt_pin_ops _ls1c_pin_ops = ls1c_pin_attach_irq, ls1c_pin_detach_irq, - ls1c_pin_irq_enable + ls1c_pin_irq_enable, + RT_NULL, }; diff --git a/bsp/ls2kdev/drivers/drv_gpio.c b/bsp/ls2kdev/drivers/drv_gpio.c index e1c5d61331..b49e471cc4 100644 --- a/bsp/ls2kdev/drivers/drv_gpio.c +++ b/bsp/ls2kdev/drivers/drv_gpio.c @@ -221,6 +221,7 @@ static struct rt_pin_ops loongson_pin_ops = { .pin_attach_irq = loongson_pin_attach_irq, .pin_detach_irq = loongson_pin_detach_irq, .pin_irq_enable = loongson_pin_irq_enable, + .pin_get = RT_NULL, }; diff --git a/bsp/mm32l3xx/drivers/drv_gpio.c b/bsp/mm32l3xx/drivers/drv_gpio.c index 141040bbce..a6c3849c85 100644 --- a/bsp/mm32l3xx/drivers/drv_gpio.c +++ b/bsp/mm32l3xx/drivers/drv_gpio.c @@ -409,6 +409,7 @@ const static struct rt_pin_ops _mm32_pin_ops = mm32_pin_attach_irq, mm32_pin_detach_irq, mm32_pin_irq_enable, + RT_NULL, }; int rt_hw_pin_init(void) diff --git a/bsp/nrf5x/libraries/drivers/drv_gpio.c b/bsp/nrf5x/libraries/drivers/drv_gpio.c index 001839b2b4..4251edfdc2 100644 --- a/bsp/nrf5x/libraries/drivers/drv_gpio.c +++ b/bsp/nrf5x/libraries/drivers/drv_gpio.c @@ -351,6 +351,7 @@ const static struct rt_pin_ops _nrf5x_pin_ops = nrf5x_pin_attach_irq, nrf5x_pin_dettach_irq, nrf5x_pin_irq_enable, + RT_NULL, }; int rt_hw_pin_init(void) diff --git a/bsp/nuclei/libraries/gd32vf103/HAL_Drivers/drv_gpio.c b/bsp/nuclei/libraries/gd32vf103/HAL_Drivers/drv_gpio.c index f7572a57db..779f4a7bb8 100644 --- a/bsp/nuclei/libraries/gd32vf103/HAL_Drivers/drv_gpio.c +++ b/bsp/nuclei/libraries/gd32vf103/HAL_Drivers/drv_gpio.c @@ -443,6 +443,7 @@ const static struct rt_pin_ops _gd32_pin_ops = gd32_pin_attach_irq, gd32_pin_dettach_irq, gd32_pin_irq_enable, + RT_NULL, }; rt_inline void pin_irq_hdr(int irqno) diff --git a/bsp/nuvoton/libraries/m480/rtt_port/drv_gpio.c b/bsp/nuvoton/libraries/m480/rtt_port/drv_gpio.c index 4790d65001..c4d6c33629 100644 --- a/bsp/nuvoton/libraries/m480/rtt_port/drv_gpio.c +++ b/bsp/nuvoton/libraries/m480/rtt_port/drv_gpio.c @@ -44,7 +44,8 @@ static struct rt_pin_ops nu_gpio_ops = nu_gpio_read, nu_gpio_attach_irq, nu_gpio_detach_irq, - nu_gpio_irq_enable + nu_gpio_irq_enable, + RT_NULL, }; static IRQn_Type au32GPIRQ[NU_PORT_CNT] = {GPA_IRQn, GPB_IRQn, GPC_IRQn, GPD_IRQn, GPE_IRQn, GPF_IRQn, GPG_IRQn, GPH_IRQn}; diff --git a/bsp/raspberry-pi/raspi3-32/driver/drv_gpio.c b/bsp/raspberry-pi/raspi3-32/driver/drv_gpio.c index c239c56cf2..205d7f10aa 100644 --- a/bsp/raspberry-pi/raspi3-32/driver/drv_gpio.c +++ b/bsp/raspberry-pi/raspi3-32/driver/drv_gpio.c @@ -294,6 +294,7 @@ static const struct rt_pin_ops ops = raspi_pin_attach_irq, raspi_pin_detach_irq, raspi_pin_irq_enable, + RT_NULL, }; #endif diff --git a/bsp/raspberry-pi/raspi3-64/driver/drv_gpio.c b/bsp/raspberry-pi/raspi3-64/driver/drv_gpio.c index 56ef412725..0cd6abb84e 100644 --- a/bsp/raspberry-pi/raspi3-64/driver/drv_gpio.c +++ b/bsp/raspberry-pi/raspi3-64/driver/drv_gpio.c @@ -295,6 +295,7 @@ static const struct rt_pin_ops ops = raspi_pin_attach_irq, raspi_pin_detach_irq, raspi_pin_irq_enable, + RT_NULL, }; #endif diff --git a/bsp/raspberry-pi/raspi4-32/driver/drv_gpio.c b/bsp/raspberry-pi/raspi4-32/driver/drv_gpio.c index b45fb8574f..b2d2ed79c4 100644 --- a/bsp/raspberry-pi/raspi4-32/driver/drv_gpio.c +++ b/bsp/raspberry-pi/raspi4-32/driver/drv_gpio.c @@ -344,6 +344,7 @@ static const struct rt_pin_ops ops = raspi_pin_attach_irq, raspi_pin_detach_irq, raspi_pin_irq_enable, + RT_NULL, }; static void gpio_irq_handler(int irq, void *param) diff --git a/bsp/raspberry-pi/raspi4-64/driver/drv_gpio.c b/bsp/raspberry-pi/raspi4-64/driver/drv_gpio.c index 4317a358e0..bba20a86a4 100644 --- a/bsp/raspberry-pi/raspi4-64/driver/drv_gpio.c +++ b/bsp/raspberry-pi/raspi4-64/driver/drv_gpio.c @@ -103,6 +103,7 @@ static const struct rt_pin_ops ops = raspi_pin_attach_irq, raspi_pin_detach_irq, raspi_pin_irq_enable, + RT_NULL, }; #endif diff --git a/bsp/rv32m1_vega/ri5cy/driver/drv_gpio.c b/bsp/rv32m1_vega/ri5cy/driver/drv_gpio.c index f5acd7e02b..afc152a96b 100644 --- a/bsp/rv32m1_vega/ri5cy/driver/drv_gpio.c +++ b/bsp/rv32m1_vega/ri5cy/driver/drv_gpio.c @@ -496,7 +496,8 @@ static const struct rt_pin_ops vega_pin_ops = vega_pin_attach_irq, vega_pin_detach_irq, - vega_pin_irq_enable + vega_pin_irq_enable, + RT_NULL, }; int rt_hw_pin_init(void) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_gpio.c b/bsp/stm32/libraries/HAL_Drivers/drv_gpio.c index fc4eb83743..e13d838803 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_gpio.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_gpio.c @@ -313,6 +313,51 @@ static const struct pin_index *get_pin(uint8_t pin) return index; }; +static rt_base_t stm32_pin_get(const char *name) +{ + rt_base_t pin = 0; + int hw_port_num, hw_pin_num = 0; + int i, name_len = 1; + int mul = 1; + + name_len = rt_strlen(name); + + if ((name_len < 4) || (name_len >= 6)) + { + return -RT_EINVAL; + } + if ((name[0] != 'P') || (name[2] != '.')) + { + return -RT_EINVAL; + } + + if ((name[1] >= 'A') && (name[1] <= 'Z')) + { + hw_port_num = (int)(name[1] - 'A'); + } + else + { + return -RT_EINVAL; + } + + for (i = name_len - 1; i > 2; i--) + { + hw_pin_num += ((int)(name[i] - '0') * mul); + mul = mul * 10; + } + + pin = 16 * hw_port_num + hw_pin_num; + + if (pin < ITEM_NUM(pins)) + { + return pin; + } + else + { + return -RT_EINVAL; + } +} + static void stm32_pin_write(rt_device_t dev, rt_base_t pin, rt_base_t value) { const struct pin_index *index; @@ -627,6 +672,7 @@ const static struct rt_pin_ops _stm32_pin_ops = stm32_pin_attach_irq, stm32_pin_dettach_irq, stm32_pin_irq_enable, + stm32_pin_get, }; rt_inline void pin_irq_hdr(int irqno) diff --git a/bsp/swm320-lq100/drivers/drv_gpio.c b/bsp/swm320-lq100/drivers/drv_gpio.c index b9d3d42583..439f36f379 100644 --- a/bsp/swm320-lq100/drivers/drv_gpio.c +++ b/bsp/swm320-lq100/drivers/drv_gpio.c @@ -334,7 +334,8 @@ const static struct rt_pin_ops swm320_pin_ops = swm320_pin_read, swm320_pin_attach_irq, swm320_pin_detach_irq, - swm320_pin_irq_enable + swm320_pin_irq_enable, + RT_NULL, }; int rt_hw_pin_init(void) diff --git a/bsp/tm4c123bsp/libraries/Drivers/drv_gpio.c b/bsp/tm4c123bsp/libraries/Drivers/drv_gpio.c index 7cdfaf91f9..410a456849 100644 --- a/bsp/tm4c123bsp/libraries/Drivers/drv_gpio.c +++ b/bsp/tm4c123bsp/libraries/Drivers/drv_gpio.c @@ -153,6 +153,7 @@ const static struct rt_pin_ops _tm4c123_pin_ops = tm4c123_pin_attach_irq, tm4c123_pin_dettach_irq, tm4c123_pin_irq_enable, + RT_NULL, }; int rt_hw_pin_init(void) diff --git a/bsp/w60x/drivers/drv_pin.c b/bsp/w60x/drivers/drv_pin.c index e55087c44f..7dae2e26dd 100644 --- a/bsp/w60x/drivers/drv_pin.c +++ b/bsp/w60x/drivers/drv_pin.c @@ -153,7 +153,8 @@ struct rt_pin_ops _wm_pin_ops = wm_pin_read, wm_pin_attach_irq, wm_pin_detach_irq, - wm_pin_irq_enable + wm_pin_irq_enable, + RT_NULL, }; int wm_hw_pin_init(void)