-/* 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.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * This document contains proprietary information belonging to Czech
+ * Technical University in Prague. Passing on and copying of this
+ * document, and communication of its contents is not permitted
+ * without prior written authorization.
*
* 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;
-
- // FIXME This is horrible
- #if rppCONFIG_DRV == 1
- dmmInit();
- gioInit();
- hetInit();
- canInit();
- linInit();
- spi_tms570_init();
- #endif
-
- #if rppCONFIG_INCLUDE_DIN == 1
- rpp_din_init();
- #endif
-
- #if rppCONFIG_INCLUDE_LOUT == 1
- rpp_lout_init();
- #endif
-
- #if rppCONFIG_INCLUDE_ADC == 1
- rpp_adc_init();
- #endif
-
- #if rppCONFIG_INCLUDE_DAC == 1
- rpp_dac_init();
- #endif
-
- #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
- struct rpp_can_config can_config;
- struct rpp_can_tx_config can_tx_config[1];
- struct rpp_can_rx_config can_rx_config[1];
-
- can_config.num_tx_obj = 1;
- can_config.num_rx_obj = 1;
- can_config.tx_config = can_tx_config;
- can_config.rx_config = can_rx_config;
-
- can_config.tx_config[0].type = RPP_CAN_EXTENDED;
- can_config.tx_config[0].controller = 2;
- can_config.tx_config[0].msg_obj = 1;
-
- can_config.rx_config[0].type = RPP_CAN_EXTENDED;
- can_config.rx_config[0].controller = 2;
- can_config.rx_config[0].msg_obj = 2;
- can_config.rx_config[0].id = 2;
- can_config.rx_config[0].mask = 0;
-
- rpp_can_init(&can_config);
- #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
-
- #if rppCONFIG_DRV == 1
- _enable_IRQ();
- #endif
+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();
+#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();
+ rpp_eth_init();
+#endif
+ rpp_gio_init(RPP_GIO_PORT_ALL);
+ _enable_IRQ();
+#endif
- return SUCCESS;
+ return SUCCESS;
}
-