-/* Copyright (C) 2013 Czech Technical University in Prague
+/* Copyright (C) 2013, 2015 Czech Technical University in Prague
*
* Authors:
* - Carlos Jenkins <carlos@jenkins.co.cr>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*
* File : rpp.c
* Abstract:
#include "rpp/rpp.h"
-#if rppCONFIG_DRV == 1
+#ifndef FREERTOS_POSIX
#include "drv/drv.h"
#endif
-boolean_t initialized = FALSE;
-
-int8_t rpp_init() {
-
- if(initialized) {
- return FAILURE;
- }
- initialized = TRUE;
-
-#if rppCONFIG_INCLUDE_DIN == 1
- rpp_din_init();
-#endif
-
-#if rppCONFIG_INCLUDE_LOUT == 1
- rpp_lout_init();
-#endif
-
-#if rppCONFIG_INCLUDE_AIN == 1
- rpp_ain_init();
+static boolean_t rpp_initialized = FALSE;
+
+int8_t rpp_init()
+{
+
+ if (rpp_initialized)
+ return FAILURE;
+ rpp_initialized = TRUE;
+
+#ifndef FREERTOS_POSIX
+
+ dmmInit();
+ gioInit();
+ hetInit();
+ rpp_adc_init();
+ rpp_sci_init();
+ rpp_eth_init();
+#if defined(TARGET_TMS570_RPP)
+ linInit();
+ rpp_din_init();
+ rpp_lout_init();
+ rpp_dac_init();
+ rpp_hbr_init();
+ rpp_mout_init();
+ rpp_hout_init();
+ rpp_lin_init();
+ rpp_sdr_init();
+ rpp_irc_init();
#endif
-
-#if rppCONFIG_INCLUDE_AOUT == 1
- rpp_aout_init();
+ rpp_gio_init(RPP_GIO_PORT_ALL);
+#ifdef TARGET_HAS_SPI
+ rpp_spi_init();
#endif
+ _enable_IRQ();
-#if rppCONFIG_INCLUDE_HBR == 1
- rpp_hbr_init();
#endif
-#if rppCONFIG_INCLUDE_MOUT == 1
- rpp_mout_init();
-#endif
-
-#if rppCONFIG_INCLUDE_HOUT == 1
- rpp_hout_init();
-#endif
-
-#if rppCONFIG_INCLUDE_CAN == 1
- rpp_can_init();
-#endif
-
-#if rppCONFIG_INCLUDE_LIN == 1
- rpp_lin_init();
-#endif
-
-#if rppCONFIG_INCLUDE_FR == 1
- rpp_fr_init();
-#endif
-
-#if rppCONFIG_INCLUDE_SCI == 1
- rpp_sci_init();
-#endif
-
-#if rppCONFIG_INCLUDE_ETH == 1
- rpp_eth_init();
-#endif
-
-#if rppCONFIG_INCLUDE_SDC == 1
- rpp_sdc_init();
-#endif
-
-#if rppCONFIG_INCLUDE_SDR == 1
- rpp_sdr_init();
-#endif
-
- // FIXME This is horrible
- #if rppCONFIG_DRV == 1
- dmmInit();
- gioInit();
- hetInit();
- canInit();
- linInit();
- emif_SDRAMInit();
- spi_tms570_init();
-
- _enable_IRQ();
- #endif
-
- return SUCCESS;
+ return SUCCESS;
}
-