mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-02 04:15:19 +00:00
Many sub-systems might require to set a callback on different pins. Thus enabling it via changing the API. It is also possible to retrieve private-data in the callback handler using CONTAINER_OF() macro (include/misc/util.h). Former API is still available, and is emulated through the new one. Using both should not be a problem as it's using new API calls. However, it's now better to start using the new API. Change-Id: Id16594202905976cc524775d1cd3592b54a84514 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
61 lines
1.4 KiB
C
61 lines
1.4 KiB
C
/*
|
|
* Copyright (c) 2015 Intel Corporation.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#include <stdint.h>
|
|
#include <gpio.h>
|
|
#include "gpio_dw_registers.h"
|
|
|
|
#ifdef CONFIG_PCI
|
|
#include <pci/pci.h>
|
|
#include <pci/pci_mgr.h>
|
|
#endif /* CONFIG_PCI */
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
extern int gpio_dw_initialize(struct device *port);
|
|
typedef void (*gpio_config_irq_t)(struct device *port);
|
|
|
|
struct gpio_dw_config {
|
|
uint32_t base_addr;
|
|
uint32_t bits;
|
|
uint32_t irq_num;
|
|
#ifdef CONFIG_PCI
|
|
struct pci_dev_info pci_dev;
|
|
#endif /* CONFIG_PCI */
|
|
gpio_config_irq_t config_func;
|
|
|
|
#ifdef CONFIG_GPIO_DW_SHARED_IRQ
|
|
char *shared_irq_dev_name;
|
|
#endif /* CONFIG_GPIO_DW_SHARED_IRQ */
|
|
|
|
#ifdef CONFIG_GPIO_DW_CLOCK_GATE
|
|
void *clock_data;
|
|
#endif
|
|
};
|
|
|
|
struct gpio_dw_runtime {
|
|
#ifdef CONFIG_GPIO_DW_CLOCK_GATE
|
|
struct device *clock;
|
|
#endif
|
|
sys_slist_t callbacks;
|
|
};
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|