]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blob - rpp-test-sw/commands/main.c
Move rpp-test-sw to a subdirectory
[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         _enable_IRQ();\r
48 \r
49         rpp_sci_printf("\nRapid Prototyping Platform v00.01-001\n");\r
50         rpp_sci_printf("Test Software version " GIT_VERSION "\n");\r
51         rpp_sci_printf("Porsche Engineering 06/2013\n");\r
52 \r
53         initCmdProc(0);\r
54         vTaskStartScheduler();\r
55 \r
56         //We should never get here\r
57         while(1)\r
58                 ;\r
59 }\r
60 \r
61 #if configUSE_MALLOC_FAILED_HOOK == 1\r
62 /**\r
63  * FreeRTOS malloc() failed hook.\r
64  */\r
65 void vApplicationMallocFailedHook(void) {\r
66     #ifdef DEBUG\r
67     rpp_sci_printf((const char*)\r
68             "ERROR: manual memory allocation failed.\r\n"\r
69         );\r
70     #endif\r
71 }\r
72 #endif\r
73 \r
74 \r
75 #if configCHECK_FOR_STACK_OVERFLOW > 0\r
76 /**\r
77  * FreeRTOS stack overflow hook.\r
78  */\r
79 void vApplicationStackOverflowHook(xTaskHandle xTask,\r
80                                    signed portCHAR *pcTaskName) {\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