2 * Copyright (C) 2015 Czech Technical University in Prague
5 * - Michal Sojka <sojkam1@fel.cvut.cz>
8 * This document contains proprietary information belonging to Czech
9 * Technical University in Prague. Passing on and copying of this
10 * document, and communication of its contents is not permitted
11 * without prior written authorization.
19 #include "drv/gio_names.h"
21 #define RPP_GIO_PORT_GIOA 0x2
22 #define RPP_GIO_PORT_GIOB 0x4
23 #define RPP_GIO_PORT_NHET1 0x8
24 #define RPP_GIO_PORT_ALL (RPP_GIO_PORT_GIOA|RPP_GIO_PORT_GIOB|RPP_GIO_PORT_NHET1)
27 * Intialize GIO ports.
29 * The ports are initialized according to the definition in gio_def.h.
31 * @param[in] init_ports Specifies which ports to initialize.
32 * RPP_GIO_PORT_ALL causes all ports to be initialized.
34 * @return SUCCESS if successful, FAILURE otherwise.
36 int8_t rpp_gio_init(uint32_t init_ports);
39 * Sets GIO output pin to a value.
41 * @param pin Pin to set
42 * @param value Value to the pin to.
44 * @return SUCCESS if successful, FAILURE otherwise.
46 int8_t rpp_gio_set(enum pin_name pin, boolean_t value);
49 * Reads the value of a GIO pin.
51 * @param pin Pin to read.
53 * @return Pin value (0 or 1) in case of success, FAILURE otherwise.
55 int8_t rpp_gio_get(enum pin_name pin);
57 /** GIO pin input mode */
58 enum rpp_gio_in_mode {
59 RPP_GIO_MODE_PULLDIS, /**< Disable pull resistor */
61 RPP_GIO_MODE_PULLDOWN,
64 /** GIO pin direction */
73 * @param pin Pin to configure
74 * @param io Configure the pin as input or output.
75 * @param in_mode Input settings. Ignored when pin is configured as
77 * @param open_drain Output is open drain when TRUE, pull/push when
78 * FALSE. Ignored when pin is configured as input.
80 * @return SUCCESS or FAILURE.
82 int8_t rpp_gio_setup(enum pin_name pin,
84 enum rpp_gio_in_mode in_mode,
85 boolean_t open_drain);
87 int8_t rpp_gio_port_set(int port, uint32_t bits);
88 int8_t rpp_gio_port_get(int port, uint32_t *bits);