]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - rpp/src/rpp/rpp.c
Merge branch 'master' of rtime.felk.cvut.cz:pes-rpp/rpp-lib
[pes-rpp/rpp-lib.git] / rpp / src / rpp / rpp.c
1 /* Copyright (C) 2013 Czech Technical University in Prague
2  *
3  * Authors:
4  *     - Carlos Jenkins <carlos@jenkins.co.cr>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  * File : rpp.c
20  * Abstract:
21  *     RPP API library implementation file.
22  *
23  * References:
24  *     rpp.h
25  *     RPP API documentation.
26  */
27
28
29 #include "rpp/rpp.h"
30
31 #if rppCONFIG_DRV == 1
32 #include "drv/drv.h"
33 #endif
34
35 boolean_t initialized = FALSE;
36
37 int8_t rpp_init() {
38
39     if(initialized) {
40         return FAILURE;
41     }
42     initialized = TRUE;
43
44     // FIXME This is horrible
45     #if rppCONFIG_DRV == 1
46     dmmInit();
47     gioInit();
48     hetInit();
49     canInit();
50     linInit();
51     spi_tms570_init();
52     #endif
53
54     #if rppCONFIG_INCLUDE_DIN == 1
55     rpp_din_init();
56     #endif
57
58     #if rppCONFIG_INCLUDE_LOUT == 1
59     rpp_lout_init();
60     #endif
61
62     #if rppCONFIG_INCLUDE_ADC == 1
63     rpp_adc_init();
64     #endif
65
66     #if rppCONFIG_INCLUDE_DAC == 1
67     rpp_dac_init();
68     #endif
69
70     #if rppCONFIG_INCLUDE_HBR == 1
71     rpp_hbr_init();
72     #endif
73
74     #if rppCONFIG_INCLUDE_MOUT == 1
75     rpp_mout_init();
76     #endif
77
78     #if rppCONFIG_INCLUDE_HOUT == 1
79     rpp_hout_init();
80     #endif
81
82     #if rppCONFIG_INCLUDE_CAN == 1
83     rpp_can_init();
84     #endif
85
86     #if rppCONFIG_INCLUDE_LIN == 1
87     rpp_lin_init();
88     #endif
89
90     #if rppCONFIG_INCLUDE_SCI == 1
91     rpp_sci_init();
92     #endif
93
94     #if rppCONFIG_INCLUDE_ETH == 1
95     rpp_eth_init();
96     #endif
97
98     #if rppCONFIG_INCLUDE_SDC == 1
99     rpp_sdc_init();
100     #endif
101
102     #if rppCONFIG_INCLUDE_SDR == 1
103     rpp_sdr_init();
104     #endif
105
106     #if rppCONFIG_DRV == 1
107     _enable_IRQ();
108     #endif
109
110    return SUCCESS;
111 }