Zephyr API Documentation
3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
gpio_mmio32.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2016 Linaro Ltd.
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef ZEPHYR_INCLUDE_DRIVERS_GPIO_GPIO_MMIO32_H_
8
#define ZEPHYR_INCLUDE_DRIVERS_GPIO_GPIO_MMIO32_H_
9
10
#include <
zephyr/device.h
>
11
#include <
zephyr/drivers/gpio.h
>
12
#include <
zephyr/types.h
>
13
14
extern
const
struct
gpio_driver_api
gpio_mmio32_api
;
15
16
struct
gpio_mmio32_config
{
17
/* gpio_driver_config needs to be first */
18
struct
gpio_driver_config
common
;
19
volatile
uint32_t
*
reg
;
20
uint32_t
mask
;
21
};
22
23
struct
gpio_mmio32_context
{
24
/* gpio_driver_data needs to be first */
25
struct
gpio_driver_data
common
;
26
const
struct
gpio_mmio32_config
*
config
;
27
};
28
29
int
gpio_mmio32_init
(
const
struct
device
*dev);
30
31
#ifdef CONFIG_GPIO_MMIO32
32
44
#define GPIO_MMIO32_INIT(node_id, _address, _mask) \
45
static struct gpio_mmio32_context _CONCAT(Z_DEVICE_DT_DEV_ID(node_id), _ctx); \
46
\
47
static const struct gpio_mmio32_config _CONCAT(Z_DEVICE_DT_DEV_ID(node_id), _cfg) = { \
48
.common = { \
49
.port_pin_mask = _mask, \
50
}, \
51
.reg = (volatile uint32_t *)_address, \
52
.mask = _mask, \
53
}; \
54
\
55
DEVICE_DT_DEFINE(node_id, \
56
&gpio_mmio32_init, \
57
NULL, \
58
&_CONCAT(Z_DEVICE_DT_DEV_ID(node_id), _ctx), \
59
&_CONCAT(Z_DEVICE_DT_DEV_ID(node_id), _cfg), \
60
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
61
&gpio_mmio32_api)
62
63
64
#else
/* CONFIG_GPIO_MMIO32 */
65
66
/* Null definition for when support not configured into kernel */
67
#define GPIO_MMIO32_INIT(node_id, _address, _mask)
68
69
#endif
70
71
72
#endif
/* ZEPHYR_INCLUDE_DRIVERS_GPIO_GPIO_MMIO32_H_ */
device.h
gpio.h
Public APIs for GPIO drivers.
gpio_mmio32_init
int gpio_mmio32_init(const struct device *dev)
gpio_mmio32_api
const struct gpio_driver_api gpio_mmio32_api
types.h
uint32_t
__UINT32_TYPE__ uint32_t
Definition:
stdint.h:90
device
Runtime device structure (in ROM) per driver instance.
Definition:
device.h:399
gpio_driver_config
This structure is common to all GPIO drivers and is expected to be the first element in the object po...
Definition:
gpio.h:690
gpio_driver_data
This structure is common to all GPIO drivers and is expected to be the first element in the driver's ...
Definition:
gpio.h:703
gpio_mmio32_config
Definition:
gpio_mmio32.h:16
gpio_mmio32_config::reg
volatile uint32_t * reg
Definition:
gpio_mmio32.h:19
gpio_mmio32_config::mask
uint32_t mask
Definition:
gpio_mmio32.h:20
gpio_mmio32_config::common
struct gpio_driver_config common
Definition:
gpio_mmio32.h:18
gpio_mmio32_context
Definition:
gpio_mmio32.h:23
gpio_mmio32_context::common
struct gpio_driver_data common
Definition:
gpio_mmio32.h:25
gpio_mmio32_context::config
const struct gpio_mmio32_config * config
Definition:
gpio_mmio32.h:26
zephyr
drivers
gpio
gpio_mmio32.h
Generated on Thu Sep 26 2024 10:47:05 for Zephyr API Documentation by
1.9.6