root / lab4 / .minix-src / include / minix / gpio.h @ 14
History | View | Annotate | Download (799 Bytes)
1 | 13 | up20180614 | #ifndef __INCLUDE_GPIO_H__
|
---|---|---|---|
2 | #define __INCLUDE_GPIO_H__
|
||
3 | |||
4 | struct gpio
|
||
5 | { |
||
6 | int nr; /* GPIO number */ |
||
7 | int mode; /* GPIO mode (input=0/output=1) */ |
||
8 | }; |
||
9 | |||
10 | #define GPIO_MODE_INPUT 0 |
||
11 | #define GPIO_MODE_OUTPUT 1 |
||
12 | |||
13 | int gpio_init(void); |
||
14 | |||
15 | /* request access to a gpio */
|
||
16 | int gpio_claim(char *owner, int nr, struct gpio **gpio); |
||
17 | |||
18 | /* Configure the GPIO for a certain purpose */
|
||
19 | int gpio_pin_mode(struct gpio *gpio, int mode); |
||
20 | |||
21 | /* Set the value for a GPIO */
|
||
22 | int gpio_set(struct gpio *gpio, int value); |
||
23 | |||
24 | /* Read the current value of the GPIO */
|
||
25 | int gpio_read(struct gpio *gpio, int *value); |
||
26 | |||
27 | /* Read and clear the value interrupt value of the GPIO */
|
||
28 | int gpio_intr_read(struct gpio *gpio, int *value); |
||
29 | |||
30 | /* Interrupt hook */
|
||
31 | int gpio_intr_message(message * m);
|
||
32 | |||
33 | int gpio_release(void); |
||
34 | #endif /* __INCLUDE_GPIO_H__ */ |