2015-07-21 23:12:17 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Intel Corporation.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2015-07-21 23:12:17 +08:00
|
|
|
*/
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#ifndef ZEPHYR_DRIVERS_GPIO_GPIO_DW_H_
|
|
|
|
#define ZEPHYR_DRIVERS_GPIO_GPIO_DW_H_
|
2016-11-15 19:39:35 +08:00
|
|
|
|
Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t. This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.
We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.
We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.
Jira: ZEP-2051
Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-19 23:32:08 +08:00
|
|
|
#include <zephyr/types.h>
|
2022-05-06 16:25:46 +08:00
|
|
|
#include <zephyr/drivers/gpio.h>
|
2015-12-05 22:27:59 +08:00
|
|
|
#include "gpio_dw_registers.h"
|
2015-07-21 23:12:17 +08:00
|
|
|
|
2016-01-23 01:38:49 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-05-01 02:33:38 +08:00
|
|
|
typedef void (*gpio_config_irq_t)(const struct device *port);
|
2015-07-21 23:12:17 +08:00
|
|
|
|
2015-11-02 07:13:41 +08:00
|
|
|
struct gpio_dw_config {
|
2019-12-04 03:15:04 +08:00
|
|
|
/* gpio_driver_config needs to be first */
|
|
|
|
struct gpio_driver_config common;
|
2021-06-28 14:19:46 +08:00
|
|
|
uint32_t ngpios;
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t irq_num; /* set to 0 if GPIO port cannot interrupt */
|
2015-07-21 23:12:17 +08:00
|
|
|
gpio_config_irq_t config_func;
|
2015-09-29 06:15:45 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_GPIO_DW_SHARED_IRQ
|
|
|
|
char *shared_irq_dev_name;
|
|
|
|
#endif /* CONFIG_GPIO_DW_SHARED_IRQ */
|
2015-12-01 23:00:39 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_GPIO_DW_CLOCK_GATE
|
|
|
|
void *clock_data;
|
|
|
|
#endif
|
2015-07-21 23:12:17 +08:00
|
|
|
};
|
|
|
|
|
2015-11-02 07:13:41 +08:00
|
|
|
struct gpio_dw_runtime {
|
2019-09-20 20:34:55 +08:00
|
|
|
/* gpio_driver_data needs to be first */
|
|
|
|
struct gpio_driver_data common;
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t base_addr;
|
2015-12-01 23:00:39 +08:00
|
|
|
#ifdef CONFIG_GPIO_DW_CLOCK_GATE
|
2020-05-01 02:33:38 +08:00
|
|
|
const struct device *clock;
|
2015-12-01 23:00:39 +08:00
|
|
|
#endif
|
2016-03-23 19:01:06 +08:00
|
|
|
sys_slist_t callbacks;
|
2015-07-21 23:12:17 +08:00
|
|
|
};
|
2016-01-23 01:38:49 +08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2016-11-15 19:39:35 +08:00
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#endif /* ZEPHYR_DRIVERS_GPIO_GPIO_DW_H_ */
|