Esempio n. 1
0
tZGVoidReturn ZGConsoleReleaseConsoleMsg(tZGVoidInput)
{
    /* linefeed and output prompt */
    OutputCommandPrompt();

    g_ConsoleContext.appConsoleMsgRx = kZGBoolFalse;
}
Esempio n. 2
0
void WFConsoleReleaseConsoleMsg(void)
{
    /* linefeed and output prompt */
    OutputCommandPrompt();

    g_ConsoleContext.appConsoleMsgRx = FALSE;
}
Esempio n. 3
0
void IperfConsoleReleaseConsoleMsg(void)
{
    /* linefeed and output prompt */
    OutputCommandPrompt();

    g_ConsoleContext.appConsoleMsgRx = false;
}
Esempio n. 4
0
/*= Output_Monitor_Hdr =======================================================
Purpose: After clearing screen, outputs to terminal the header block of text.

Inputs:  None

Returns: None
============================================================================*/
void Output_Monitor_Hdr(void)
{
    // KS:
    // EraseEntireScreen();

    putrsUART("\n\r");
    OutputLine('=', 79);
    putrsUART("* WiFi Host Interface Monitor\n\r");
    putrsUART("* (c) 2008, 2009, 2010, 2011 -- Microchip Technology, Inc.\n\r");
    putrsUART("*\n\r* Type 'help' to get a list of commands.\n\r");
    OutputLine('=', 79);
    OutputCommandPrompt();

}
Esempio n. 5
0
/*= Output_Monitor_Hdr =======================================================
Purpose: After clearing screen, outputs to terminal the header block of text.

Inputs:  None

Returns: None
============================================================================*/
tZGVoidReturn Output_Monitor_Hdr(tZGVoidInput)
{
    // KS:
    // EraseEntireScreen();

    ZG_PUTRSUART("\n\r");
    OutputLine('=', 79);
    ZG_PUTRSUART("* ZeroG Host Interface Monitor\n\r");
    ZG_PUTRSUART("* (c) 2008 -- ZeroG, Inc.\n\r");
    ZG_PUTRSUART("*\n\r* Type 'help' to get a list of commands.\n\r");
    OutputLine('=', 79);
    OutputCommandPrompt();

}
Esempio n. 6
0
/*= Output_Monitor_Hdr =======================================================
Purpose: After clearing screen, outputs to terminal the header block of text.

Inputs:  None

Returns: None
============================================================================*/
void Output_Monitor_Hdr(void)
{
    // KS:
    // EraseEntireScreen();

    putrsUART("\n\r");
    OutputLine('=', 79);
    putrsUART("* WiFi Host Interface Monitor\n\r");
    putrsUART("* (c) 2008, 2009, 2010 -- Microchip Technology, Inc.\n\r");
    putrsUART("*\n\r* Type 'help' to get a list of commands.\n\r");
	#if defined(WIFI_USB_DBG)//DIA 12_7_11
    	copyArrayToUSBBuffer("* WiFi Host Interface Monitor\n\r", sizeof("* WiFi Host Interface Monitor\n\r"));
    	copyArrayToUSBBuffer("* (c) 2008, 2009, 2010 -- Microchip Technology, Inc.\n\r", sizeof("* (c) 2008, 2009, 2010 -- Microchip Technology, Inc.\n\r"));
    	copyArrayToUSBBuffer("*\n\r* Type 'help' to get a list of commands.\n\r", sizeof("*\n\r* Type 'help' to get a list of commands.\n\r"));
	#endif
    OutputLine('=', 79);
    OutputCommandPrompt();

}
Esempio n. 7
0
/*= Output_Monitor_Hdr =======================================================
Purpose: After clearing screen, outputs to terminal the header block of text.

Inputs:  None

Returns: None
============================================================================*/
void Output_Monitor_Hdr(void)
{
    // KS:
    // EraseEntireScreen();

    char    eraseStr[80];   // output 79 times '=' plus \n\r

    memset(eraseStr, '=', 79);
    eraseStr[79] = '\0';
    
    SYS_CONSOLE_MESSAGE("\n\r");
    SYS_CONSOLE_MESSAGE(eraseStr);
    SYS_CONSOLE_MESSAGE("\n\r");
    SYS_CONSOLE_MESSAGE("* Iperf Command Parser\n\r");
    SYS_CONSOLE_MESSAGE("* (c) 2012, 2013, 2014 -- Microchip Technology, Inc.\n\r");
    SYS_CONSOLE_MESSAGE("*\n\r* Type 'help' to get a list of commands.\n\r");
    SYS_CONSOLE_MESSAGE(eraseStr);
    SYS_CONSOLE_MESSAGE("\n\r");
    OutputCommandPrompt();

}
Esempio n. 8
0
/*= Enter ====================================================================
Purpose: Enter key processing

Inputs:  None

Returns: none
============================================================================*/
static void Enter(void)
{
   BOOL cmd_flag = FALSE;


   if ( IS_ECHO_ON() )
   {
       /* if the command line has any characters in it and it is not just white space */
       if ( (GET_LEN_RX_CMD_STRING() > 0u)  &&  (!isCmdLineOnlyWhitespace() ) )
       {
#if (kWFNumHistoryEntries > 0)
          AddCmdToHistory();
#endif
          cmd_flag = TRUE;
       }
   }
   // else talking to PC app, presume it only sends valid commands
   else
   {
       cmd_flag = TRUE;
   }

   // Process command
   if (cmd_flag == TRUE)
   {
       process_cmd();
   }

   // if we got an app-specific command,
   if (g_ConsoleContext.appConsoleMsgRx == FALSE)
   {
       /* linefeed and output prompt */
       OutputCommandPrompt();
   }

   // don't output command prompt, which also clears rx buf, until app processes it's command

}
Esempio n. 9
0
/*****************************************************************************
 * FUNCTION: WFConsoleProcess
 *
 * RETURNS: None
 *
 * PARAMS:  None
 *
 * NOTES:   State machine called from main loop of app.  Handles serial input.
 *
 *****************************************************************************/
void WFConsoleProcess(void)
{
    //UINT8 *pStart = &(cmdline[0]);
    UINT16  rc;
    INT8  c;
    static INT8 escape_sequence[kWFMaxInputEscapeSequence];
    static INT8 esc_seq_index;

    // if this state machine has been disabled
    if (g_ConsoleContext.bStateMachineLoop == FALSE)
    {
        return;
    }


    // if a command was entered that is application=specific
    if (g_ConsoleContext.appConsoleMsgRx == TRUE)
    {
        return;  // wait until app done before processing further characters
    }

    // if no character(s) received
    if ( (rc = DataRdyUART() ) == 0u )
    {
        return;
    }

    // get the character
    c = (INT8) ReadUART();

    // if this is the very first character received by this state machine
    if (g_ConsoleContext.firstChar == FALSE)
    {
        Output_Monitor_Hdr();
        g_ConsoleContext.firstChar = TRUE;
    }

    switch( GET_RX_STATE() )
    {
        //------------------------------------------
        case kSTWaitForChar:
        //------------------------------------------
            // if a 'normal' printable character
            if (isPrintableCharacter(c))
            {
                InsertCharacter(c);
            }
            // else if Delete key
            else if (c == kWFDelete)
            {
                Delete();
            }
            // else if Backspace key
            else if (c == (INT8)kWFBackspace)
            {
                Backspace();
            }
            // else if Enter key
            else if (c == kWFEnter)
            {
                Enter();
            }
            // else if Escape key
            else if (c == kWFEscape)
            {
                /* zero out escape buffer, init with ESC */
                memset(escape_sequence, 0x00, sizeof(escape_sequence));
                escape_sequence[0] = kWFEscape;
                esc_seq_index = 1;
                SET_RX_STATE(kSTWaitForEscSeqSecondChar);
            }
            // else if Ctrl C
            else if (c == kWFCtrl_C)
            {
               OutputCommandPrompt();
            }
            else {
                // Enter();
            }
            break;

        //------------------------------------------
        case kSTWaitForEscSeqSecondChar:
        //------------------------------------------
            /* if an arrow key, home, or end key (which is all that this state machine handles) */
            if (c == 0x5b)
            {
               escape_sequence[1] = c;
               SET_RX_STATE(kSTWaitForEscSeqThirdChar);
            }
            // else if user pressed escape followed by any printable character
            else if (isPrintableCharacter(c))
            {
                InsertCharacter(c);
                SET_RX_STATE(kSTWaitForChar);
            }
            // start this command line over
            else // anything else
            {
                OutputCommandPrompt();
                SET_RX_STATE(kSTWaitForChar);
            }
            break;

        //------------------------------------------
        case kSTWaitForEscSeqThirdChar:
        //------------------------------------------
            escape_sequence[2] = c;
            ProcessEscapeSequence(escape_sequence);
            SET_RX_STATE(kSTWaitForChar);
            break;


    } // end switch
}
Esempio n. 10
0
/*****************************************************************************
 * FUNCTION: IperfConsoleProcess
 *
 * RETURNS: None
 *
 * PARAMS:  None
 *
 * NOTES:   State machine called from main loop of app.  Handles serial input.
 *
 *****************************************************************************/
void IperfConsoleProcess(void)
{
    //uint8_t *pStart = &(cmdline[0]);
    int8_t  c;
    static int8_t escape_sequence[kMaxInputEscapeSequence];
    static int8_t esc_seq_index;

    // if this state machine has been disabled
    if (g_ConsoleContext.bStateMachineLoop == false)
    {
        return;
    }


    // if a command was entered that is application=specific
    if (g_ConsoleContext.appConsoleMsgRx == true)
    {
        return;  // wait until app done before processing further characters
    }

    // if no character(s) received
    if (SYS_CONSOLE_DATA_RDY() == 0)
    {
        return;
    }

    // get the character
    c = (int8_t) SYS_CONSOLE_GETC();

    // if this is the very first character received by this state machine
    if (g_ConsoleContext.firstChar == false)
    {
        Output_Monitor_Hdr();
        g_ConsoleContext.firstChar = true;
    }

    switch( GET_RX_STATE() )
    {
        //------------------------------------------
        case kSTWaitForChar:
        //------------------------------------------
            // if a 'normal' printable character
            if (isPrintableCharacter(c))
            {
                InsertCharacter(c);
            }
            // else if Delete key
            else if (c == kDelete)
            {
                Delete();
            }
            // else if Backspace key
            else if (c == (int8_t)kBackspace)
            {
                Backspace();
            }
            // else if Enter key
            else if (c == kEnter)
            {
                Enter();
            }
            // else if Escape key
            else if (c == kEscape)
            {
                /* zero out escape buffer, init with ESC */
                memset(escape_sequence, 0x00, sizeof(escape_sequence));
                escape_sequence[0] = kEscape;
                esc_seq_index = 1;
                SET_RX_STATE(kSTWaitForEscSeqSecondChar);
            }
            // else if Ctrl C
            else if (c == kCtrl_C)
            {
               OutputCommandPrompt();
            }
            else {
                // Enter();
            }
            break;

        //------------------------------------------
        case kSTWaitForEscSeqSecondChar:
        //------------------------------------------
            /* if an arrow key, home, or end key (which is all that this state machine handles) */
            if (c == 0x5b)
            {
               escape_sequence[1] = c;
               SET_RX_STATE(kSTWaitForEscSeqThirdChar);
            }
            // else if user pressed escape followed by any printable character
            else if (isPrintableCharacter(c))
            {
                InsertCharacter(c);
                SET_RX_STATE(kSTWaitForChar);
            }
            // start this command line over
            else // anything else
            {
                OutputCommandPrompt();
                SET_RX_STATE(kSTWaitForChar);
            }
            break;

        //------------------------------------------
        case kSTWaitForEscSeqThirdChar:
        //------------------------------------------
            escape_sequence[2] = c;
            
            if ((c == 0x31) || (c == 0x34))   // home or end key
            {
                SET_RX_STATE(kSTWaitForEscSeqFourthChar);
            }
            else
            {    
                ProcessEscapeSequence(escape_sequence);
                SET_RX_STATE(kSTWaitForChar);
            }    
            break;
            
        //------------------------------------------            
        case kSTWaitForEscSeqFourthChar:
        //------------------------------------------
            ProcessEscapeSequence(escape_sequence);
            SET_RX_STATE(kSTWaitForChar);
            break;
            


    } // end switch
}