Lines Matching refs:gpio

30 #define GET_PORT_NUM(gpio)      ((uint8_t)(((uint32_t)gpio - DT_REG_ADDR(DT_NODELABEL(gpioa))) / \  argument
34 #define IS_PORT_C(gpio) ((uint32_t)gpio == DT_REG_ADDR(DT_NODELABEL(gpioc))) argument
37 #define IS_PORT_D(gpio) ((uint32_t)gpio == DT_REG_ADDR(DT_NODELABEL(gpiod))) argument
99 volatile struct gpio_b91_t *gpio = GET_GPIO(dev); in gpiob_b91_irq_en_set() local
102 BM_SET(gpio->irq_en, BIT(pin)); in gpiob_b91_irq_en_set()
104 BM_SET(reg_irq_risc0_en(GET_PORT_NUM(gpio)), BIT(pin)); in gpiob_b91_irq_en_set()
106 BM_SET(reg_irq_risc1_en(GET_PORT_NUM(gpio)), BIT(pin)); in gpiob_b91_irq_en_set()
116 volatile struct gpio_b91_t *gpio = GET_GPIO(dev); in gpiob_b91_irq_en_clr() local
119 BM_CLR(gpio->irq_en, BIT(pin)); in gpiob_b91_irq_en_clr()
121 BM_CLR(reg_irq_risc0_en(GET_PORT_NUM(gpio)), BIT(pin)); in gpiob_b91_irq_en_clr()
123 BM_CLR(reg_irq_risc1_en(GET_PORT_NUM(gpio)), BIT(pin)); in gpiob_b91_irq_en_clr()
132 volatile struct gpio_b91_t *gpio = GET_GPIO(dev); in gpio_b91_irq_en_get() local
135 status = gpio->irq_en; in gpio_b91_irq_en_get()
137 status = reg_irq_risc0_en(GET_PORT_NUM(gpio)); in gpio_b91_irq_en_get()
139 status = reg_irq_risc1_en(GET_PORT_NUM(gpio)); in gpio_b91_irq_en_get()
169 volatile struct gpio_b91_t *gpio = GET_GPIO(dev); in gpio_b91_irq_set() local
186 BM_CLR(gpio->polarity, BIT(pin)); in gpio_b91_irq_set()
191 BM_SET(gpio->polarity, BIT(pin)); in gpio_b91_irq_set()
196 BM_CLR(gpio->polarity, BIT(pin)); in gpio_b91_irq_set()
201 BM_SET(gpio->polarity, BIT(pin)); in gpio_b91_irq_set()
221 static void gpio_b91_up_down_res_set(volatile struct gpio_b91_t *gpio, in gpio_b91_up_down_res_set() argument
231 analog_reg = 0x0e + (GET_PORT_NUM(gpio) << 1) + ((pin & 0xf0) ? 1 : 0); in gpio_b91_up_down_res_set()
253 static void gpio_b91_config_up_down_res(volatile struct gpio_b91_t *gpio, in gpio_b91_config_up_down_res() argument
258 gpio_b91_up_down_res_set(gpio, pin, GPIO_PIN_PULLUP_10K); in gpio_b91_config_up_down_res()
260 gpio_b91_up_down_res_set(gpio, pin, GPIO_PIN_PULLDOWN_100K); in gpio_b91_config_up_down_res()
262 gpio_b91_up_down_res_set(gpio, pin, GPIO_PIN_UP_DOWN_FLOAT); in gpio_b91_config_up_down_res()
267 static void gpio_b91_config_in_out(volatile struct gpio_b91_t *gpio, in gpio_b91_config_in_out() argument
274 if (IS_PORT_C(gpio)) { in gpio_b91_config_in_out()
276 } else if (IS_PORT_D(gpio)) { in gpio_b91_config_in_out()
281 WRITE_BIT(gpio->oen, pin, ~flags & GPIO_OUTPUT); in gpio_b91_config_in_out()
293 WRITE_BIT(gpio->ie, pin, flags & GPIO_INPUT); in gpio_b91_config_in_out()
312 volatile struct gpio_b91_t *gpio = GET_GPIO(dev); in gpio_b91_pin_configure() local
331 gpio->output |= BIT(pin); in gpio_b91_pin_configure()
333 gpio->output &= ~BIT(pin); in gpio_b91_pin_configure()
337 WRITE_BIT(gpio->actas_gpio, BIT(pin), 1); in gpio_b91_pin_configure()
340 gpio_b91_config_up_down_res(gpio, pin, flags); in gpio_b91_pin_configure()
343 gpio_b91_config_in_out(gpio, pin, flags); in gpio_b91_pin_configure()
352 volatile struct gpio_b91_t *gpio = GET_GPIO(dev); in gpio_b91_port_get_raw() local
354 *value = gpio->input; in gpio_b91_port_get_raw()
364 volatile struct gpio_b91_t *gpio = GET_GPIO(dev); in gpio_b91_port_set_masked_raw() local
366 gpio->output = (gpio->output & ~mask) | (value & mask); in gpio_b91_port_set_masked_raw()
375 volatile struct gpio_b91_t *gpio = GET_GPIO(dev); in gpio_b91_port_set_bits_raw() local
377 gpio->output |= mask; in gpio_b91_port_set_bits_raw()
386 volatile struct gpio_b91_t *gpio = GET_GPIO(dev); in gpio_b91_port_clear_bits_raw() local
388 gpio->output &= ~mask; in gpio_b91_port_clear_bits_raw()
397 volatile struct gpio_b91_t *gpio = GET_GPIO(dev); in gpio_b91_port_toggle_bits() local
399 gpio->output ^= mask; in gpio_b91_port_toggle_bits()
470 static DEVICE_API(gpio, gpio_b91_driver_api) = {