summaryrefslogtreecommitdiffstats
path: root/rtemsbsd/local/gpio_if.c
blob: b02c038be26354c2263358032380327c41951188 (plain) (blame)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include <machine/rtems-bsd-kernel-space.h>

/*
 * This file is produced automatically.
 * Do not modify anything in here by hand.
 *
 * Created from source file
 *   freebsd-org/sys/dev/gpio/gpio_if.m
 * with
 *   makeobjops.awk
 *
 * See the source file for legal information
 */

#include <sys/param.h>
#include <sys/queue.h>
#include <sys/kernel.h>
#include <sys/kobj.h>
#include <sys/bus.h>
#include <sys/gpio.h>
#include <rtems/bsd/local/gpio_if.h>


static device_t
gpio_default_get_bus(void)
{

	return (NULL);
}

static int
gpio_default_nosupport(void)
{

	return (EOPNOTSUPP);
}

static int
gpio_default_map_gpios(device_t bus, phandle_t dev,
    phandle_t gparent, int gcells, pcell_t *gpios, uint32_t *pin,
    uint32_t *flags)
{
	/* Propagate up the bus hierarchy until someone handles it. */  
	if (device_get_parent(bus) != NULL)
		return (GPIO_MAP_GPIOS(device_get_parent(bus), dev,
		    gparent, gcells, gpios, pin, flags));

	/* If that fails, then assume the FreeBSD defaults. */
	*pin = gpios[0];
	if (gcells == 2 || gcells == 3)
		*flags = gpios[gcells - 1];

	return (0);
}

struct kobjop_desc gpio_get_bus_desc = {
	0, { &gpio_get_bus_desc, (kobjop_t)gpio_default_get_bus }
};

struct kobjop_desc gpio_pin_max_desc = {
	0, { &gpio_pin_max_desc, (kobjop_t)kobj_error_method }
};

struct kobjop_desc gpio_pin_set_desc = {
	0, { &gpio_pin_set_desc, (kobjop_t)kobj_error_method }
};

struct kobjop_desc gpio_pin_get_desc = {
	0, { &gpio_pin_get_desc, (kobjop_t)kobj_error_method }
};

struct kobjop_desc gpio_pin_toggle_desc = {
	0, { &gpio_pin_toggle_desc, (kobjop_t)kobj_error_method }
};

struct kobjop_desc gpio_pin_getcaps_desc = {
	0, { &gpio_pin_getcaps_desc, (kobjop_t)kobj_error_method }
};

struct kobjop_desc gpio_pin_getflags_desc = {
	0, { &gpio_pin_getflags_desc, (kobjop_t)kobj_error_method }
};

struct kobjop_desc gpio_pin_getname_desc = {
	0, { &gpio_pin_getname_desc, (kobjop_t)kobj_error_method }
};

struct kobjop_desc gpio_pin_setflags_desc = {
	0, { &gpio_pin_setflags_desc, (kobjop_t)kobj_error_method }
};

struct kobjop_desc gpio_map_gpios_desc = {
	0, { &gpio_map_gpios_desc, (kobjop_t)gpio_default_map_gpios }
};

struct kobjop_desc gpio_pin_access_32_desc = {
	0, { &gpio_pin_access_32_desc, (kobjop_t)gpio_default_nosupport }
};

struct kobjop_desc gpio_pin_config_32_desc = {
	0, { &gpio_pin_config_32_desc, (kobjop_t)gpio_default_nosupport }
};