-
Notifications
You must be signed in to change notification settings - Fork 6
/
gpiomux.h
107 lines (99 loc) · 1.73 KB
/
gpiomux.h
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
104
105
106
107
#ifndef _GPIOMUX_H_
#define _GPIOMUX_H_
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <omega2_ctrl_types.h>
// functions
int gpiomux_set (char *group, char *name);
int gpiomux_get (void);
int gpiomux_mmap_open (void);
void gpiomux_mmap_close (void);
// structure
static struct gpiomux {
char *name;
char *func[4];
unsigned int shift;
unsigned int mask;
} omega2GpioMux[] =
{
{
.name = "i2c",
.func = { "i2c", "gpio", NULL, NULL },
.shift = 20,
.mask = 0x3,
},
{
.name = "uart0",
.func = { "uart", "gpio", NULL, NULL },
.shift = 8,
.mask = 0x3,
},
{
.name = "uart1",
.func = { "uart", "gpio", "pwm01", NULL },
.shift = 24,
.mask = 0x3,
},
{
.name = "uart2",
.func = { "uart", "gpio", "pwm23", NULL },
.shift = 26,
.mask = 0x3,
},
{
.name = "pwm0",
.func = { "pwm", "gpio", NULL, NULL },
.shift = 28,
.mask = 0x3,
},
{
.name = "pwm1",
.func = { "pwm", "gpio", NULL, NULL },
.shift = 30,
.mask = 0x3,
},
{
.name = "refclk",
.func = { "refclk", "gpio", NULL, NULL },
.shift = 18,
.mask = 0x1,
},
{
.name = "spi_s",
.func = { "spi_s", "gpio", NULL, "pwm01_uart2" },
.shift = 2,
.mask = 0x3,
},
{
.name = "spi_cs1",
.func = { "spi_cs1", "gpio", "refclk", NULL },
.shift = 4,
.mask = 0x3,
},
{
.name = "i2s",
.func = { "i2s", "gpio", "pcm", NULL },
.shift = 6,
.mask = 0x3,
},
{
.name = "ephy",
.func = { "ephy", "gpio", NULL, NULL },
.shift = 34,
.mask = 0x3,
},
{
.name = "wled",
.func = { "wled", "gpio", NULL, NULL },
.shift = 32,
.mask = 0x3,
}
};
#endif // _GPIOMUX_H_