]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - rpp/src/hal/_tms570_hydctr/port_def.c
f43826b3bd5d123d19ac462c8699e8a0709b1ccf
[pes-rpp/rpp-lib.git] / rpp / src / hal / _tms570_hydctr / port_def.c
1 /* Copyright (C) 2012-2013 Czech Technical University in Prague
2  *
3  * Authors:
4  *     - Michal Horn <hornmich@fel.cvut.cz>
5  *
6  * This document contains proprietary information belonging to Czech
7  * Technical University in Prague. Passing on and copying of this
8  * document, and communication of its contents is not permitted
9  * without prior written authorization.
10  *
11  * File : port_def.c
12  *
13  * Abstract:
14  *          This file contains general ports definitions. Ports are defined according to their names on
15  *      the RPP board.
16  *      Each port is define by port descriptor, which consists of:
17  *          - list of its pin (pin descriptors),
18  *          - number of pins,
19  *          - get value function pointer,
20  *          - set value function pointer.
21  *      Finally each port descriptor is mapped to the port name string.
22  *
23  *      Get and set value function are defined for each port style (ADC, SPI, GPIO) in separated files.
24  */
25
26 #include "hal/hal.h"
27
28 // Lists of pins assigned to the ports
29 static uint32_t port_cfg_gioa[] = PORT_CFG_GIOA;
30 static uint32_t port_cfg_giob[] = PORT_CFG_GIOB;
31 static uint32_t port_cfg_nhet1[] = PORT_CFG_NHET1;
32 static uint32_t port_cfg_adc[] = PORT_CFG_ADC;
33
34 // Port descriptors
35 static port_desc_t port_desc_gioa = {
36         .config = port_cfg_gioa,
37         .numValues = PORT_NV_GIOA,
38         .interfaceType = PORT_INT_TYPE_GIOA,
39         .port_getfnc_ptr = PORT_GFC_GIOA,
40         .port_setfnc_ptr = PORT_SFC_GIOA,
41 };
42
43 static port_desc_t port_desc_giob = {
44         .config = port_cfg_giob,
45         .numValues = PORT_NV_GIOB,
46         .interfaceType = PORT_INT_TYPE_GIOB,
47         .port_getfnc_ptr = PORT_GFC_GIOB,
48         .port_setfnc_ptr = PORT_SFC_GIOB,
49 };
50
51 static port_desc_t port_desc_nhet1 = {
52         .config = port_cfg_nhet1,
53         .numValues = PORT_NV_NHET1,
54         .interfaceType = PORT_INT_TYPE_NHET1,
55         .port_getfnc_ptr = PORT_GFC_NHET1,
56         .port_setfnc_ptr = PORT_SFC_NHET1,
57 };
58
59 static port_desc_t port_desc_adc = {
60         .config = port_cfg_adc,
61         .numValues = PORT_NV_ADC,
62         .interfaceType = PORT_INT_TYPE_ADC,
63         .port_getfnc_ptr = PORT_GFC_ADC,
64         .port_setfnc_ptr = PORT_SFC_ADC,
65 };
66
67 // Maps of port names to port descriptors
68 port_def_t port_definition[PORT_CNT] = {
69         {.name = PORT_NAME_GIOA,      .desc = &port_desc_gioa},
70         {.name = PORT_NAME_GIOB,      .desc = &port_desc_giob},
71         {.name = PORT_NAME_NHET1,    .desc = &port_desc_nhet1},
72         {.name = PORT_NAME_ADC,      .desc = &port_desc_adc}
73 };