]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blobdiff - rpp-test-sw/commands/main.c
Fix compile error for new targets
[pes-rpp/rpp-test-sw.git] / rpp-test-sw / commands / main.c
index 5d2bb17020d37d7f2b9cf7daec6b9fc20a037aa6..07dc5e0f6f48617db9fa3a1e1296a27aa7c3a1dd 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright (C) 2012-2013 Czech Technical University in Prague\r
+ * Copyright (C) 2012-2015 Czech Technical University in Prague\r
  *\r
  * Created on: 15.3.2012\r
  *\r
@@ -7,52 +7,59 @@
  *     - Michal Horn\r
  *     - Carlos Jenkins <carlos@jenkins.co.cr>\r
  *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
+ * This document contains proprietary information belonging to Czech\r
+ * Technical University in Prague. Passing on and copying of this\r
+ * document, and communication of its contents is not permitted\r
+ * without prior written authorization.\r
  *\r
  * File : main.c\r
  *\r
  * Abstract:\r
- *     This file contains main function and Hook functions used by IDLE task.\r
+ *      This file contains main function and Hook functions used by IDLE task.\r
  *\r
  */\r
 \r
 /* Include Files */\r
 #include "rpp/rpp.h"\r
-#include "cmdproc_freertos_tms570.h"\r
-#include "version.h" // Generated by Eclipse in the pre-build step\r
+#include "os/os.h"\r
+#include "cmdproc_freertos.h"\r
+#include "version.h" // Generated by Makefile\r
+\r
+#if defined(TARGET_TMS570_HDK)\r
+#define TARGET_STR "TI HDK TMS570LS3137"\r
+#elif defined(TARGET_RM48_HDK)\r
+#define TARGET_STR "TI HDK RM48L952"\r
+#elif defined(TARGET_TMS570_HYDCTR)\r
+#define TARGET_STR "Eaton Hydraulics Controller"\r
+#elif defined(TARGET_POSIX)\r
+#define TARGET_STR "POSIX version"\r
+#else\r
+#error Unknown target\r
+#endif\r
 \r
 /** @fn void main(void)\r
-*   @brief Application main function\r
-*\r
-*   This function is called after startup.\r
-*/\r
+ *   @brief Application main function\r
+ *\r
+ *   This function is called after startup.\r
+ */\r
 void main(void)\r
 {\r
-       rpp_init();\r
+       rpp_adc_init();\r
+       rpp_gio_init(RPP_GIO_PORT_ALL);\r
+       rpp_sci_init();\r
 \r
        // Speed up the SCI\r
        rpp_sci_setup(115200);\r
 \r
-       rpp_sci_printf("\nRapid Prototyping Platform v00.01-001\n");\r
+       rpp_sci_printf("\n" TARGET_STR ", FreeRTOS %d.%d.%d\n", FREERTOS_VERSION_NUMBER_MAYOR, FREERTOS_VERSION_NUMBER_MINOR, FREERTOS_VERSION_NUMBER_REV);\r
        rpp_sci_printf("Test Software version " GIT_VERSION "\n");\r
-       rpp_sci_printf("Porsche Engineering 06/2013\n");\r
+       rpp_sci_printf("CTU in Prague 04/2015\n");\r
 \r
        initCmdProc(0);\r
        vTaskStartScheduler();\r
 \r
        //We should never get here\r
-       while(1)\r
+       while (1)\r
                ;\r
 }\r
 \r
@@ -60,12 +67,11 @@ void main(void)
 /**\r
  * FreeRTOS malloc() failed hook.\r
  */\r
-void vApplicationMallocFailedHook(void) {\r
-    #ifdef DEBUG\r
-    rpp_sci_printf((const char*)\r
-            "ERROR: manual memory allocation failed.\r\n"\r
-        );\r
-    #endif\r
+void vApplicationMallocFailedHook(void)\r
+{\r
+       #ifdef DEBUG\r
+       rpp_sci_printf("ERROR: manual memory allocation failed.\r\n");\r
+       #endif\r
 }\r
 #endif\r
 \r
@@ -75,11 +81,10 @@ void vApplicationMallocFailedHook(void) {
  * FreeRTOS stack overflow hook.\r
  */\r
 void vApplicationStackOverflowHook(xTaskHandle xTask,\r
-                                   signed portCHAR *pcTaskName) {\r
-    #ifdef DEBUG\r
-    rpp_sci_printf((const char*)\r
-            "ERROR: Stack overflow : \"%s\".\r\n", pcTaskName\r
-        );\r
-    #endif\r
+                                                                  signed portCHAR *pcTaskName)\r
+{\r
+       #ifdef DEBUG\r
+       rpp_sci_printf("ERROR: Stack overflow : \"%s\".\r\n", pcTaskName);\r
+       #endif\r
 }\r
 #endif\r