2 * Copyright (C) 2015 Czech Technical University in Prague
5 * - Michal Sojka <sojkam1@fel.cvut.cz>
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.
16 * @author Michal Sojka <sojkam1@fel.cvut.cz>
17 * @date Sat Jul 25 23:03:40 2015
19 * @brief Port related stuff
21 * Port is a set of I/O (pins) that are somehow related together. Port
22 * can be on a MCU or attached over SPI or similar bus. Ports can be
23 * of different types, e.g. digital I/O or ADC.
30 #include "sys/ti_drv_gio.h"
31 #include "sys/ti_drv_adc.h"
32 #include "drv/port_def.h"
34 #include "drv/spi_def.h"
40 * The structure describes the port. Port here means set of IO pins on
41 * the board. The API is designed to provide an interface for setting
42 * and reading from ports connected to the MCU by SPI, GPIO or ADC.
46 uint16_t numchn; /**< Number of channels/pins */
47 uint16_t bpch; /**< Bits per channel */
49 * Getter function. If NULL, the port is write only. All SPI ports
50 * are write only, because a command has to be sent to obtain an
53 * @param[out] values Pointer to memory where to store the values
54 * get from the port. If bpch == 1, the memory is uint32_t,
55 * otherwise it is an array of numch bpch-wide elements.
57 * @param[out] size Size of the memory pointed by @a values.
59 int8_t (*get)(const struct port_desc *port, void *values, size_t size);
61 * Setter function. If NULL, the port is read only.
63 * @param[out] values Pointer to memory specifying how to set the
64 * port channels. If bpch == 1, the memory is uint32_t, otherwise
65 * it is an array of numch bpch-wide elements. The function is
66 * allowed to modify this memory and return there some information
67 * e.g. current or previous values of the port (this is usually
68 * the case for SPI-based ports).
70 * @param[out] size Size of the memory pointed by @a values.
72 int8_t (*set)(const struct port_desc *port, void *values, size_t size);
91 extern const struct port_desc port_desc[_PORT_COUNT];
93 #endif /* ifndef DRV_PORT_H */