hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
 * Copyright (C) 2016 Philippe Gerum <rpm@xenomai.org>
 *
 * Xenomai is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
#ifndef _COBALT_RTDM_GPIO_H
#define _COBALT_RTDM_GPIO_H
 
#include <linux/list.h>
#include <rtdm/driver.h>
#include <rtdm/uapi/gpio.h>
 
struct class;
struct device_node;
struct gpio_desc;
 
struct rtdm_gpio_pin {
   struct rtdm_device dev;
   struct list_head next;
   rtdm_irq_t irqh;
   rtdm_event_t event;
   char *name;
   struct gpio_desc *desc;
   nanosecs_abs_t timestamp;
   bool monotonic_timestamp;
};
 
struct rtdm_gpio_chip {
   struct gpio_chip *gc;
   struct rtdm_driver driver;
   struct class *devclass;
   struct list_head next;
   rtdm_lock_t lock;
   struct rtdm_gpio_pin pins[0];
};
 
int rtdm_gpiochip_add(struct rtdm_gpio_chip *rgc,
             struct gpio_chip *gc,
             int gpio_subclass);
 
struct rtdm_gpio_chip *
rtdm_gpiochip_alloc(struct gpio_chip *gc,
           int gpio_subclass);
 
void rtdm_gpiochip_remove(struct rtdm_gpio_chip *rgc);
 
int rtdm_gpiochip_add_by_name(struct rtdm_gpio_chip *rgc,
                 const char *label, int gpio_subclass);
 
int rtdm_gpiochip_post_event(struct rtdm_gpio_chip *rgc,
                unsigned int offset);
 
int rtdm_gpiochip_find(struct device_node *from, const char *label, int type);
 
int rtdm_gpiochip_array_find(struct device_node *from, const char *label[],
                int nentries, int type);
 
#ifdef CONFIG_OF
 
int rtdm_gpiochip_scan_of(struct device_node *from,
             const char *compat, int type);
 
int rtdm_gpiochip_scan_array_of(struct device_node *from,
               const char *compat[],
               int nentries, int type);
#endif
 
void rtdm_gpiochip_remove_by_type(int type);
 
#endif /* !_COBALT_RTDM_GPIO_H */