]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blob - rpp-test-sw/cmdproc/src/cmdproc_freertos_tms570.c
a8682cd79187315279772daaed296a4c92e70692
[pes-rpp/rpp-test-sw.git] / rpp-test-sw / cmdproc / src / cmdproc_freertos_tms570.c
1 /*
2  * Copyright (C) 2012-2013 Czech Technical University in Prague
3  *
4  * Created on: 1.8.2012
5  *
6  * Authors:
7  *     - Michal Horn
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  * File : cmd_proc_freertos_tms570.c
23  *
24  * Abstract:
25  *      This file contains main command processor task function and initialization of CMDPROC
26  *
27  */
28
29 /* Include files */
30 #include "cmdproc_freertos_tms570.h"
31 #include "rpp/sci.h"
32
33 /** cmdProc task handler */
34 xTaskHandle processCmdHandler;
35
36 /** Main list of commands */
37 extern cmd_des_t const *cmd_list_main[];
38 /** IO stack */
39 extern cmd_io_t cmd_io_std_line;
40
41
42 /**
43  * @brief Entry function to start main CMDPROC
44  * @param priority Priority of CMDPROC task (0 is the highest priority)
45  * @param introText Text which will be printed when CMDPROC launches
46  * @param promptText Text printed when CMDPROC is ready to read new command
47  *
48  */
49 void initCmdProc(unsigned portBASE_TYPE priority)
50 {
51         int taskRetVal;
52
53         if ((taskRetVal = xTaskCreate(processCmd, (const signed char *)"processCmd", 1000, NULL, priority, processCmdHandler)) != pdPASS) {
54                 rpp_sci_printf("FreeRTOS: Creating task processCmd failed. Error code: %d", taskRetVal);
55                 /* An error occurred, block program */
56                 while (1)
57                         ;
58         }
59 }
60
61 /**
62  * @brief CMDPROC task procedure
63  * @param pvParameters Not used, task receives no parameters
64  */
65 void processCmd(void *pvParameters )
66 {
67         for (;; ) {
68                 rpp_sci_printf("--> ");
69                 cmd_processor_run(&cmd_io_std_line, cmd_list_main);
70         }
71 }