]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - rpp/include/drv/gio_tab.h
Uncrustify
[pes-rpp/rpp-lib.git] / rpp / include / drv / gio_tab.h
1 /*
2  * Copyright (C) 2015 Czech Technical University in Prague
3  *
4  * Authors:
5  *     - Michal Sojka <sojkam1@fel.cvut.cz>
6  *
7  * This document contains proprietary information belonging to Czech
8  * Technical University in Prague. Passing on and copying of this
9  * document, and communication of its contents is not permitted
10  * without prior written authorization.
11  *
12  */
13
14 #ifndef DRV_GIO_PIN_TAB_H
15 #define DRV_GIO_PIN_TAB_H
16
17 #include "drv/gio.h"
18 #include "drv/gio_names.h"
19 #include "drv/port.h"
20
21 struct gio_pin {
22         const char *pin_name;   // Pin name
23         uint32_t pin_dsc;       // Pin descriptor computed with GIO_PIN_DESC
24 };
25
26 extern const struct gio_pin gio_table[_PIN_COUNT];
27
28 /*
29  * We don't use enum pin_name here, because it prevents us doing
30  * arithmetic operations like (PIN_DIN8 + 1). The enum is used in the
31  * rpp layer, where it protects users from doing stupid things.
32  */
33 static inline void gio_tab_set(/* enum pin_name */ int pin, boolean_t val)
34 {
35         gio_set(gio_table[pin].pin_dsc, val);
36 }
37
38 static inline boolean_t gio_tab_get(/* enum pin_name */ int pin)
39 {
40         return gio_get(gio_table[pin].pin_dsc);
41 }
42
43 int8_t port_gioset_get(const struct port_desc *port, void *values, size_t size);
44 int8_t port_gioset_set(const struct port_desc *port, void *values, size_t size);
45
46
47 #endif