]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blob - rpp-test-sw/cmdproc/src/cmdproc_freertos.c
Fix warnings
[pes-rpp/rpp-test-sw.git] / rpp-test-sw / cmdproc / src / cmdproc_freertos.c
1 /*
2  * Copyright (C) 2012-2015 Czech Technical University in Prague
3  *
4  * Created on: 1.8.2012
5  *
6  * Authors:
7  *     - Michal Horn
8  *
9  * This document contains proprietary information belonging to Czech
10  * Technical University in Prague. Passing on and copying of this
11  * document, and communication of its contents is not permitted
12  * without prior written authorization.
13  *
14  * File : cmd_proc_freertos.c
15  *
16  * Abstract:
17  *      This file contains main command processor task function and initialization of CMDPROC
18  *
19  */
20
21 /* Include files */
22 #include "cmdproc_freertos.h"
23 #include "rpp/sci.h"
24
25 /** cmdProc task handler */
26 xTaskHandle processCmdHandler;
27
28 /** Main list of commands */
29 extern cmd_des_t const *cmd_list_main[];
30 /** IO stack */
31 extern cmd_io_t cmd_io_std_line;
32
33
34 /**
35  * @brief Entry function to start main CMDPROC
36  * @param priority Priority of CMDPROC task (0 is the highest priority)
37  * @param introText Text which will be printed when CMDPROC launches
38  * @param promptText Text printed when CMDPROC is ready to read new command
39  *
40  */
41 void initCmdProc(unsigned portBASE_TYPE priority)
42 {
43         int taskRetVal;
44
45         if ((taskRetVal = xTaskCreate(processCmd, "processCmd", 1000, NULL, priority, processCmdHandler)) != pdPASS) {
46                 rpp_sci_printf("FreeRTOS: Creating task processCmd failed. Error code: %d", taskRetVal);
47                 /* An error occurred, block program */
48                 while (1)
49                         ;
50         }
51 }
52
53 /**
54  * @brief CMDPROC task procedure
55  * @param pvParameters Not used, task receives no parameters
56  */
57 void processCmd(void *pvParameters )
58 {
59         for (;; ) {
60                 rpp_sci_printf("--> ");
61                 cmd_processor_run(&cmd_io_std_line, cmd_list_main);
62         }
63 }