Line data Source code
1 0 : /*
2 : * SPDX-License-Identifier: Apache-2.0
3 : *
4 : * Copyright (c) 2024 Realtek Semiconductor Corporation, SIBG-SD7
5 : * Author: Lin Yu-Cheng <lin_yu_cheng@realtek.com>
6 : */
7 :
8 : #ifndef ZEPHYR_DRIVERS_GPIO_GPIO_RTS5912_H_
9 : #define ZEPHYR_DRIVERS_GPIO_GPIO_RTS5912_H_
10 :
11 : #include <zephyr/device.h>
12 : #include <zephyr/drivers/gpio.h>
13 : #include <reg/reg_gpio.h>
14 :
15 : #ifdef __cplusplus
16 : extern "C" {
17 : #endif
18 :
19 0 : gpio_pin_t gpio_rts5912_get_intr_pin(volatile uint32_t *reg_base);
20 :
21 0 : static ALWAYS_INLINE void gpio_rts5912_set_wakeup_pin(uint32_t pin_num)
22 : {
23 : volatile uint32_t *gcr =
24 : (volatile uint32_t *)(((uint32_t *)(DT_REG_ADDR(DT_NODELABEL(gpioa)))) + pin_num);
25 :
26 : *gcr &= ~(GPIO_GCR_MFCTRL_Msk | GPIO_GCR_DIR_Msk);
27 : *gcr |= BIT(GPIO_GCR_INTCTRL_Pos) | GPIO_GCR_INTSTS_Msk | GPIO_GCR_INTEN_Msk |
28 : GPIO_GCR_INDETEN_Msk;
29 : }
30 :
31 0 : int gpio_rts5912_get_pin_num(const struct gpio_dt_spec *gpio);
32 :
33 0 : uint32_t *gpio_rts5912_get_port_address(const struct gpio_dt_spec *gpio);
34 :
35 : #ifdef __cplusplus
36 : }
37 : #endif
38 :
39 : #endif /* ZEPHYR_DRIVERS_GPIO_GPIO_RTS5912_H_ */
|