Atmel Software Framework

com1shell.c File Reference
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "serial.h"
#include "supervisor.h"
#include "fs_com.h"
#include "fsaccess.h"
#include "shell.h"
#include "com1shell.h"
#include "tracedump.h"


#define COM1SHELL_BAUDRATE   ( ( unsigned portLONG ) 57600 )
 Baud rate used by the serial port 1. More...
#define COM1SHELL_MSG_BANNER   "\x0C\r\n---------- ATMEL AVR32 Shell ----------\r\n"
 Messages printed on the COM1 port. More...
#define COM1SHELL_MSG_LINETOOLONG   "\r\nLine too long!\r\n"
#define COM1SHELL_MSG_PROMPT   "$>"
#define COM1SHELL_NO_BLOCK   ( ( portTickType ) 0 )
#define COM1SHELL_RX_BLOCK_TIME   ( ( portTickType ) 0xffff )
#define COM1SHELL_RX_SHORT_BLOCK_TIME   ( ( portTickType ) 1 )
#define COM1SHELL_RXBUFFER_LEN   ( ( unsigned portLONG ) 64 )
 COM Port1 buffers length. More...
#define COM1SHELL_STACK_SIZE   384
#define COM1SHELL_TXBUFFER_LEN   ( ( unsigned portLONG ) 32 )
#define MAX_CMD_LEN   32


signed portBASE_TYPE com1shell_GetChar (signed portCHAR *pcByte)
 Get a char from the COM1 port. More...
static portTASK_FUNCTION (vCom1ShellTask, pvParameters)
static signed portBASE_TYPE prvGetChar (signed portCHAR *pcByte, portTickType xBlockTime)
 Get a char from the COM1 port. More...
static unsigned portCHAR prvGetCmdLine (void)
 Get a command line. More...
void v_com1shell_mount_local_drive (void)
 Mount default local drive 'a:'. More...
void v_com1shell_stopResources (void)
 Stop the com1shell module resources. More...
void vcom1shell_PrintMsg (const signed portCHAR *pcString)
 Print a string to the COM1 port. More...
void vcom1shell_PutChar (signed portCHAR cByte)
 Put a char to the COM1 port. More...
void vStartCom1Shell (unsigned portBASE_TYPE uxPriority)
eStatus xCom1Shell_GetStatus (void)
 Return the status of the COM1 shell module. More...


static signed portCHAR acStringCmd [COM1SHELL_MAX_CMDLINE_LEN+1]
signed short sCom1ShellNavId
xTaskHandle xCom1ShellHndl = NULL
static eStatus xCom1ShellStatus = SYS_STATUS_STARTUP
static xComPortHandle xComPort1Hndl = NULL

#define COM1SHELL_BAUDRATE   ( ( unsigned portLONG ) 57600 )

Baud rate used by the serial port 1.

Referenced by portTASK_FUNCTION().


The max length of a cmd line.

Referenced by prvGetCmdLine().

#define COM1SHELL_MSG_BANNER   "\x0C\r\n---------- ATMEL AVR32 Shell ----------\r\n"

Messages printed on the COM1 port.

Referenced by portTASK_FUNCTION().

#define COM1SHELL_MSG_LINETOOLONG   "\r\nLine too long!\r\n"

Brief description of the module. This module is in charge of a command line shell on COM1.

Detailed description of the module. Creation of one task that is in charge of getting a command line from COM1, launching the execution of the command and giving feedback of this execution to COM1.

Referenced by prvGetCmdLine().

#define COM1SHELL_MSG_PROMPT   "$>"

Referenced by prvGetCmdLine().

#define COM1SHELL_NO_BLOCK   ( ( portTickType ) 0 )

Referenced by vcom1shell_PutChar().

#define COM1SHELL_RX_BLOCK_TIME   ( ( portTickType ) 0xffff )

Referenced by com1shell_GetChar(), and prvGetCmdLine().

#define COM1SHELL_RX_SHORT_BLOCK_TIME   ( ( portTickType ) 1 )
#define COM1SHELL_RXBUFFER_LEN   ( ( unsigned portLONG ) 64 )

COM Port1 buffers length.

Referenced by portTASK_FUNCTION().

#define COM1SHELL_STACK_SIZE   384

Referenced by vStartCom1Shell().

#define COM1SHELL_TXBUFFER_LEN   ( ( unsigned portLONG ) 32 )

Referenced by portTASK_FUNCTION().

#define MAX_CMD_LEN   32

The max length of a cmd name.

signed portBASE_TYPE com1shell_GetChar ( signed portCHAR *  pcByte)

Get a char from the COM1 port.

pcByteOutput. The char received from the COM1 port.

References COM1SHELL_RX_BLOCK_TIME, xComPort1Hndl, and xUsartGetChar().

Referenced by prv_GetChar_From_Requester_Stream().

static signed portBASE_TYPE prvGetChar ( signed portCHAR *  pcByte,
portTickType  xBlockTime 

Get a char from the COM1 port.

References xComPort1Hndl, and xUsartGetChar().

Referenced by prvGetCmdLine().

static unsigned portCHAR prvGetCmdLine ( void  )
void v_com1shell_mount_local_drive ( void  )
void v_com1shell_stopResources ( void  )

Stop the com1shell module resources.

References vSerialClose(), and xComPort1Hndl.

Referenced by e_syscmds_reboot().

void vcom1shell_PrintMsg ( const signed portCHAR *  pcString)

Print a string to the COM1 port.

pcStringInput. The string to print.

References usUsartPutString(), and xComPort1Hndl.

Referenced by portTASK_FUNCTION(), prv_Print_String_To_Requester_Stream(), prvGetCmdLine(), and v_shell_Print_String_To_Requester_Stream().

void vcom1shell_PutChar ( signed portCHAR  cByte)

Put a char to the COM1 port.

cByteInput. The char to print.

References COM1SHELL_NO_BLOCK, xComPort1Hndl, and xUsartPutChar().

Referenced by prv_PutChar_To_Requester_Stream(), and prvGetCmdLine().

void vStartCom1Shell ( unsigned portBASE_TYPE  uxPriority)
eStatus xCom1Shell_GetStatus ( void  )

Return the status of the COM1 shell module.

one of the eStatus enum value.

References xCom1ShellStatus.

signed portCHAR acStringCmd[COM1SHELL_MAX_CMDLINE_LEN+1]

The cmd line string.

Referenced by portTASK_FUNCTION(), and prvGetCmdLine().

signed short sCom1ShellNavId

COM1 shell navigator ID.

Referenced by portTASK_FUNCTION(), v_com1shell_mount_local_drive(), and vStartCom1Shell().

xTaskHandle xCom1ShellHndl = NULL

COM1 shell task handle.

Referenced by vStartCom1Shell().

eStatus xCom1ShellStatus = SYS_STATUS_STARTUP

The COM1 shell module status.

Referenced by portTASK_FUNCTION(), vStartCom1Shell(), and xCom1Shell_GetStatus().