]> rtime.felk.cvut.cz Git - rpp-test-sw.git/blob - rpp-test-sw/commands/main.c
Makefile: Always include release rules
[rpp-test-sw.git] / rpp-test-sw / commands / main.c
1 /*\r
2  * Copyright (C) 2012-2015 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 document contains proprietary information belonging to Czech\r
11  * Technical University in Prague. Passing on and copying of this\r
12  * document, and communication of its contents is not permitted\r
13  * without prior written authorization.\r
14  *\r
15  * File : main.c\r
16  *\r
17  * Abstract:\r
18  *      This file contains main function and Hook functions used by IDLE task.\r
19  *\r
20  */\r
21 \r
22 /* Include Files */\r
23 #include "rpp/rpp.h"\r
24 #include "os/os.h"\r
25 #include "cmdproc_freertos.h"\r
26 #include "version.h" // Generated by Makefile\r
27 \r
28 #if defined(TARGET_TMS570_HDK)\r
29 #define TARGET_STR "TI HDK TMS570LS3137"\r
30 #elif defined(TARGET_RM48_HDK)\r
31 #define TARGET_STR "TI HDK RM48L952"\r
32 #elif defined(TARGET_TMS570_HYDCTR)\r
33 #define TARGET_STR "Eaton Hydraulics Controller"\r
34 #elif defined(TARGET_POSIX)\r
35 #define TARGET_STR "POSIX version"\r
36 #else\r
37 #error Unknown target\r
38 #endif\r
39 \r
40 /** @fn void main(void)\r
41  *   @brief Application main function\r
42  *\r
43  *   This function is called after startup.\r
44  */\r
45 void main(void)\r
46 {\r
47         rpp_adc_init();\r
48         rpp_gio_init(RPP_GIO_PORT_ALL);\r
49         rpp_sci_init();\r
50 \r
51         // Speed up the SCI\r
52         rpp_sci_setup(115200);\r
53 \r
54         rpp_sci_printf("\n" TARGET_STR ", FreeRTOS %d.%d.%d\n", FREERTOS_VERSION_NUMBER_MAYOR, FREERTOS_VERSION_NUMBER_MINOR, FREERTOS_VERSION_NUMBER_REV);\r
55         rpp_sci_printf("Test Software version " GIT_VERSION "\n");\r
56         rpp_sci_printf("CTU in Prague 04/2015\n");\r
57 \r
58         initCmdProc(0);\r
59         vTaskStartScheduler();\r
60 \r
61         //We should never get here\r
62         while (1)\r
63                 ;\r
64 }\r
65 \r
66 #if configUSE_MALLOC_FAILED_HOOK == 1\r
67 /**\r
68  * FreeRTOS malloc() failed hook.\r
69  */\r
70 void vApplicationMallocFailedHook(void)\r
71 {\r
72         #ifdef DEBUG\r
73         rpp_sci_printf("ERROR: manual memory allocation failed.\r\n");\r
74         #endif\r
75 }\r
76 #endif\r
77 \r
78 \r
79 #if configCHECK_FOR_STACK_OVERFLOW > 0\r
80 /**\r
81  * FreeRTOS stack overflow hook.\r
82  */\r
83 void vApplicationStackOverflowHook(xTaskHandle xTask,\r
84                                                                    signed portCHAR *pcTaskName)\r
85 {\r
86         #ifdef DEBUG\r
87         rpp_sci_printf("ERROR: Stack overflow : \"%s\".\r\n", pcTaskName);\r
88         #endif\r
89 }\r
90 #endif\r