]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blob - rpp/lib/apps/test/src/main.c
Licence header added to all CMD files, comments to functions added
[pes-rpp/rpp-test-sw.git] / rpp / lib / apps / test / src / 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 \r
34 /** @fn void main(void)\r
35 *   @brief Application main function\r
36 *\r
37 *   This function is called after startup.\r
38 */\r
39 void main(void)\r
40 {\r
41         rpp_init();\r
42         _enable_IRQ();\r
43         initCmdProc(0, (uint8_t*)"\r\n----\r\n  Rapid Prototyping Platform v00.02-001\r\n  Porsche Engineering 06/2013\r\n----\r\n\r\nType commands", (uint8_t *)"\r\n--> ");\r
44         vTaskStartScheduler();\r
45 \r
46         //We should never get here\r
47         while(1)\r
48                 ;\r
49 }\r
50 \r
51 #if configUSE_MALLOC_FAILED_HOOK == 1\r
52 /**\r
53  * FreeRTOS malloc() failed hook.\r
54  */\r
55 void vApplicationMallocFailedHook(void) {\r
56     #ifdef DEBUG\r
57     rpp_sci_printf((const char*)\r
58             "ERROR: manual memory allocation failed.\r\n"\r
59         );\r
60     #endif\r
61 }\r
62 #endif\r
63 \r
64 \r
65 #if configCHECK_FOR_STACK_OVERFLOW > 0\r
66 /**\r
67  * FreeRTOS stack overflow hook.\r
68  */\r
69 void vApplicationStackOverflowHook(xTaskHandle xTask,\r
70                                    signed portCHAR *pcTaskName) {\r
71     #ifdef DEBUG\r
72     rpp_sci_printf((const char*)\r
73             "ERROR: Stack overflow : \"%s\".\r\n", pcTaskName\r
74         );\r
75     #endif\r
76 }\r
77 #endif\r