1 /* Copyright (C) 2012-2013 Czech Technical University in Prague
4 * - Michal Horn <hornmich@fel.cvut.cz>
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.
14 * This file contains general ports definitions. Ports are defined according to their names on
16 * Each port is define by port descriptor, which consists of:
17 * - list of its pin (pin descriptors),
19 * - get value function pointer,
20 * - set value function pointer.
21 * Finally each port descriptor is mapped to the port name string.
23 * Get and set value function are defined for each port style (ADC, SPI, GPIO) in separated files.
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;
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,
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,
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,
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,
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}