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"
37 * The structure describes the port. Port here means set of IO pins on
38 * the board. The API is designed to provide an interface for setting
39 * and reading from ports connected to the MCU by SPI, GPIO or ADC.
43 uint16_t numchn; /**< Number of channels/pins */
44 uint16_t bpch; /**< Bits per channel */
46 * Getter function. If NULL, the port is write only. All SPI ports
47 * are write only, because a command has to be sent to obtain an
50 * @param[out] values Pointer to memory where to store the values
51 * get from the port. If bpch == 1, the memory is uint32_t,
52 * otherwise it is an array of numch bpch-wide elements.
54 * @param[out] size Size of the memory pointed by @a values.
56 int8_t (*get)(const struct port_desc *port, void *values, size_t size);
58 * Setter function. If NULL, the port is read only.
60 * @param[out] values Pointer to memory specifying how to set the
61 * port channels. If bpch == 1, the memory is uint32_t, otherwise
62 * it is an array of numch bpch-wide elements. The function is
63 * allowed to modify this memory and return there some information
64 * e.g. current or previous values of the port (this is usually
65 * the case for SPI-based ports).
67 * @param[out] size Size of the memory pointed by @a values.
69 int8_t (*set)(const struct port_desc *port, void *values, size_t size);
76 uint8_t ifc; /**< SPI interface */
77 uint8_t cs; /**< SPI chipselect */
87 extern const struct port_desc port_desc[_PORT_COUNT];