]> rtime.felk.cvut.cz Git - rpp-test-sw.git/commitdiff
Simplify command processor initialization, etc.
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 23 Aug 2013 13:59:22 +0000 (15:59 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 23 Aug 2013 13:59:22 +0000 (15:59 +0200)
Also:
- Modify the string printed after reset.
- Do not print CR LF before prompt.

cmdproc/include/cmdproc_freertos_tms570.h
cmdproc/src/cmdproc_freertos_tms570.c
commands/main.c

index 6292d85b35a741a755f85115d3cda4346dfd9b63..d825d56cff198d0e8468a29715e3f32ea2882b4d 100644 (file)
@@ -25,7 +25,7 @@
  *     @param[in]      introText               string shown once after initialization before prompt is shown. Can be NULL.
  *     @param[in]      promptText              string shown when software is ready to read command from RS-232. Can be NULL.
  */
-void initCmdProc(unsigned portBASE_TYPE printPriority, uint8_t * intro, uint8_t * prompt);
+void initCmdProc(unsigned portBASE_TYPE printPriority);
 
 /**    Procedure for task processCmd. Infinite loop that reads and process commands.
  */
index a7848d2513c1a75d50e7b7feab75c136076bcc14..d81438759a7416e0becefff7f75ddac304a42b56 100644 (file)
@@ -32,8 +32,7 @@
 
 /** cmdProc task handler */
 xTaskHandle processCmdHandler;
-/** string prompt */
-uint8_t* prompt;
+
 /** Main list of commands */
 extern cmd_des_t const *cmd_list_main[];
 /** IO stack */
@@ -47,12 +46,7 @@ extern cmd_io_t cmd_io_std_line;
  * @param promptText Text printed when CMDPROC is ready to read new command
  *
  */
-void initCmdProc(unsigned portBASE_TYPE priority, uint8_t * introText, uint8_t * promptText) {
-       prompt = NULL;
-       if (promptText != NULL) {
-               prompt = (uint8_t *)pvPortMalloc(strlen((char*)promptText));
-               strcpy((char *)prompt, (const char*)promptText);
-       }
+void initCmdProc(unsigned portBASE_TYPE priority) {
        int taskRetVal;
        if ((taskRetVal = xTaskCreate(processCmd, (const signed char *)"processCmd", 1000, NULL, priority, processCmdHandler)) != pdPASS) {
                rpp_sci_printf("FreeRTOS: Creating task processCmd failed. Error code: %d", taskRetVal);
@@ -60,10 +54,6 @@ void initCmdProc(unsigned portBASE_TYPE priority, uint8_t * introText, uint8_t *
                while(1)
                        ;
        }
-       if (introText != NULL)
-               rpp_sci_printf("%s", introText);
-       if (prompt != NULL)
-               rpp_sci_printf("%s", prompt);
 }
 
 /**
@@ -72,8 +62,7 @@ void initCmdProc(unsigned portBASE_TYPE priority, uint8_t * introText, uint8_t *
  */
 void processCmd(void *pvParameters ) {
        for (;;) {
+               rpp_sci_printf("--> ");
                cmd_processor_run(&cmd_io_std_line, cmd_list_main);
-               if (prompt != NULL)
-                       rpp_sci_printf("%s", prompt);
        }
 }
index 4ffe84fdcdc990b519c924b2df3b5af3b3d007b7..4c40a67e371bd6bd27e3f2609fdaabd754e19d2f 100644 (file)
@@ -45,7 +45,12 @@ void main(void)
        rpp_sci_setup(115200);\r
 \r
        _enable_IRQ();\r
-       initCmdProc(0, "\r\n----\r\n  Rapid Prototyping Platform v00.01-001\r\n  SW ver " GIT_VERSION " \r\n  Porsche Engineering 06/2013\r\n----\r\n", (uint8_t *)"\r\n--> ");\r
+\r
+       rpp_sci_printf("\nRapid Prototyping Platform v00.01-001\n");\r
+       rpp_sci_printf("Test Software version " GIT_VERSION "\n");\r
+       rpp_sci_printf("Porsche Engineering 06/2013\n");\r
+\r
+       initCmdProc(0);\r
        vTaskStartScheduler();\r
 \r
        //We should never get here\r