2 * Copyright (C) 2012-2013 Czech Technical University in Prague
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.
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.
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/>.
22 * File : cmd_proc_freertos_tms570.c
25 * This file contains main command processor task function and initialization of CMDPROC
30 #include "cmdproc_freertos_tms570.h"
33 /** cmdProc task handler */
34 xTaskHandle processCmdHandler;
37 /** Main list of commands */
38 extern cmd_des_t const *cmd_list_main[];
40 extern cmd_io_t cmd_io_std_line;
44 * @brief Entry function to start main CMDPROC
45 * @param priority Priority of CMDPROC task (0 is the highest priority)
46 * @param introText Text which will be printed when CMDPROC launches
47 * @param promptText Text printed when CMDPROC is ready to read new command
50 void initCmdProc(unsigned portBASE_TYPE priority, uint8_t * introText, uint8_t * promptText) {
52 if (promptText != NULL) {
53 prompt = (uint8_t *)pvPortMalloc(strlen((char*)promptText));
54 strcpy((char *)prompt, (const char*)promptText);
57 if ((taskRetVal = xTaskCreate(processCmd, (const signed char *)"processCmd", 400, NULL, priority, processCmdHandler)) != pdPASS) {
58 rpp_sci_printf("FreeRTOS: Creating task processCmd failed. Error code: %d", taskRetVal);
59 /* An error occurred, block program */
63 if (introText != NULL)
64 rpp_sci_printf("%s", introText);
66 rpp_sci_printf("%s", prompt);
70 * @brief CMDPROC task procedure
71 * @param pvParameters Not used, task receives no parameters
73 void processCmd(void *pvParameters ) {
75 cmd_processor_run(&cmd_io_std_line, cmd_list_main);
77 rpp_sci_printf("%s", prompt);