]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blob - rpp-test-sw/commands/main.c
f510cc367f5cb1dc97a61adc31c88f3bb3e9027d
[pes-rpp/rpp-test-sw.git] / rpp-test-sw / commands / main.c
1 /*\r
2  * Copyright (C) 2012-2013 Czech Technical University in Prague\r
3  *\r
4  * Created on: 15.3.2012\r
5  *\r
6  * Authors:\r
7  *     - Michal Horn\r
8  *     - Carlos Jenkins <carlos@jenkins.co.cr>\r
9  *\r
10  * This program is free software; you can redistribute it and/or modify\r
11  * it under the terms of the GNU General Public License as published by\r
12  * the Free Software Foundation; either version 2 of the License, or\r
13  * (at your option) any later version.\r
14  *\r
15  * This program is distributed in the hope that it will be useful,\r
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
18  * GNU General Public License for more details.\r
19  *\r
20  * You should have received a copy of the GNU General Public License\r
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
22  *\r
23  * File : main.c\r
24  *\r
25  * Abstract:\r
26  *      This file contains main function and Hook functions used by IDLE task.\r
27  *\r
28  */\r
29 \r
30 /* Include Files */\r
31 #include "rpp/rpp.h"\r
32 #include "cmdproc_freertos_tms570.h"\r
33 #include "version.h" // Generated by Eclipse in the pre-build step\r
34 \r
35 /** @fn void main(void)\r
36  *   @brief Application main function\r
37  *\r
38  *   This function is called after startup.\r
39  */\r
40 void main(void)\r
41 {\r
42         rpp_init();\r
43 \r
44         // Speed up the SCI\r
45         rpp_sci_setup(115200);\r
46 \r
47         rpp_sci_printf("\nRapid Prototyping Platform v00.01-001\n");\r
48         rpp_sci_printf("Test Software version " GIT_VERSION "\n");\r
49         rpp_sci_printf("Porsche Engineering 06/2013\n");\r
50 \r
51         initCmdProc(0);\r
52         vTaskStartScheduler();\r
53 \r
54         //We should never get here\r
55         while (1)\r
56                 ;\r
57 }\r
58 \r
59 #if configUSE_MALLOC_FAILED_HOOK == 1\r
60 /**\r
61  * FreeRTOS malloc() failed hook.\r
62  */\r
63 void vApplicationMallocFailedHook(void)\r
64 {\r
65         #ifdef DEBUG\r
66         rpp_sci_printf((const char *)\r
67                                    "ERROR: manual memory allocation failed.\r\n"\r
68                                    );\r
69         #endif\r
70 }\r
71 #endif\r
72 \r
73 \r
74 #if configCHECK_FOR_STACK_OVERFLOW > 0\r
75 /**\r
76  * FreeRTOS stack overflow hook.\r
77  */\r
78 void vApplicationStackOverflowHook(xTaskHandle xTask,\r
79                                                                    signed portCHAR *pcTaskName)\r
80 {\r
81         #ifdef DEBUG\r
82         rpp_sci_printf((const char *)\r
83                                    "ERROR: Stack overflow : \"%s\".\r\n", pcTaskName\r
84                                    );\r
85         #endif\r
86 }\r
87 #endif\r