]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - rpp/src/rpp/rpp.c
Change license to MIT
[pes-rpp/rpp-lib.git] / rpp / src / rpp / rpp.c
1 /* Copyright (C) 2013, 2015 Czech Technical University in Prague
2  *
3  * Authors:
4  *     - Carlos Jenkins <carlos@jenkins.co.cr>
5  *
6  * Permission is hereby granted, free of charge, to any person
7  * obtaining a copy of this software and associated documentation
8  * files (the "Software"), to deal in the Software without
9  * restriction, including without limitation the rights to use,
10  * copy, modify, merge, publish, distribute, sublicense, and/or sell
11  * copies of the Software, and to permit persons to whom the
12  * Software is furnished to do so, subject to the following
13  * conditions:
14  *
15  * The above copyright notice and this permission notice shall be
16  * included in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  *
27  * File : rpp.c
28  * Abstract:
29  *     RPP API library implementation file.
30  *
31  * References:
32  *     rpp.h
33  *     RPP API documentation.
34  */
35
36
37 #include "rpp/rpp.h"
38
39 #ifndef FREERTOS_POSIX
40 #include "drv/drv.h"
41 #endif
42
43 static boolean_t rpp_initialized = FALSE;
44
45 int8_t rpp_init()
46 {
47
48         if (rpp_initialized)
49                 return FAILURE;
50         rpp_initialized = TRUE;
51
52 #ifndef FREERTOS_POSIX
53
54         dmmInit();
55         gioInit();
56         hetInit();
57         rpp_adc_init();
58         rpp_sci_init();
59         rpp_eth_init();
60 #if defined(TARGET_TMS570_RPP)
61         linInit();
62         rpp_din_init();
63         rpp_lout_init();
64         rpp_dac_init();
65         rpp_hbr_init();
66         rpp_mout_init();
67         rpp_hout_init();
68         rpp_lin_init();
69         rpp_sdr_init();
70         rpp_irc_init();
71 #endif
72         rpp_gio_init(RPP_GIO_PORT_ALL);
73 #ifdef TARGET_HAS_SPI
74         rpp_spi_init();
75 #endif
76         _enable_IRQ();
77
78 #endif
79
80         return SUCCESS;
81 }