/* * Copyright (c) 2006-2020, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2020-07-09 whik first version */ #include #include #include #include "drv_gpio.h" #ifdef BSP_USING_GPIO static struct rt_pin_irq_hdr sf2_pin_irq_hdr_tab[] = { /* pin, hdr, mode, args */ {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, {-1, 0, RT_NULL, RT_NULL}, }; /* configure an individual GPIO port */ static void sf2_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode) { uint32_t config; switch (mode) { case PIN_MODE_OUTPUT: config = MSS_GPIO_OUTPUT_MODE; break; case PIN_MODE_INPUT: config = MSS_GPIO_INPUT_MODE; break; default: config = MSS_GPIO_INOUT_MODE; break; } MSS_GPIO_config((mss_gpio_id_t )pin, config); } static int sf2_pin_read(rt_device_t dev, rt_base_t pin) { uint32_t value; value = MSS_GPIO_get_inputs() & (1<