#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"
Macros | |
#define | COM1SHELL_BAUDRATE ( ( unsigned portLONG ) 57600 ) |
Baud rate used by the serial port 1. More... | |
#define | COM1SHELL_MAX_CMDLINE_LEN (MAX_CMD_LEN + 2 * MAX_FILE_PATH_LENGTH) |
#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 |
Functions | |
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... | |
Variables | |
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().
#define COM1SHELL_MAX_CMDLINE_LEN (MAX_CMD_LEN + 2 * MAX_FILE_PATH_LENGTH) |
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.
pcByte | Output. The char received from the COM1 port. |
References COM1SHELL_RX_BLOCK_TIME, xComPort1Hndl, and xUsartGetChar().
Referenced by prv_GetChar_From_Requester_Stream().
|
static |
References acStringCmd, COM1SHELL_BAUDRATE, COM1SHELL_MSG_BANNER, COM1SHELL_RXBUFFER_LEN, COM1SHELL_TXBUFFER_LEN, NULL, prvGetCmdLine(), sCom1ShellNavId, serCOM1, Shell_exec(), SHELL_EXECSTATUS_OK, SYS_MODID_COM1SHELL, SYS_STATUS_DOWN, SYS_STATUS_RUNNING, vcom1shell_PrintMsg(), vPortFree(), vTaskDelete(), xCom1ShellStatus, xComPort1Hndl, and xUsartInit().
|
static |
Get a char from the COM1 port.
References xComPort1Hndl, and xUsartGetChar().
Referenced by prvGetCmdLine().
|
static |
Get a command line.
References ABORT_CHAR, acStringCmd, BKSPACE_CHAR, c, COM1SHELL_MAX_CMDLINE_LEN, COM1SHELL_MSG_LINETOOLONG, COM1SHELL_MSG_PROMPT, COM1SHELL_RX_BLOCK_TIME, CR, LF, pdTRUE, prvGetChar(), vcom1shell_PrintMsg(), and vcom1shell_PutChar().
Referenced by portTASK_FUNCTION().
void v_com1shell_mount_local_drive | ( | void | ) |
Mount default local drive 'a:'.
References fsaccess_give_mutex(), fsaccess_take_mutex(), LUN_ID_AT45DBX_MEM, nav_drive_set(), nav_partition_mount(), nav_select(), and sCom1ShellNavId.
Referenced by prv_v_leave_maintenance_mode(), and vStartCom1Shell().
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.
pcString | Input. 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.
cByte | Input. 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 | ) |
Start the COM1 shell module.
uxPriority | The priority base of the COM1 shell tasks. |
References COM1SHELL_STACK_SIZE, fsaccess_alloc_nav_id(), fsaccess_give_mutex(), fsaccess_take_mutex(), NULL, pdPASS, sCom1ShellNavId, SYS_STATUS_DOWN, SYS_STATUS_STARTUP, v_com1shell_mount_local_drive(), xCom1ShellHndl, xCom1ShellStatus, and xTaskCreate.
Referenced by portTASK_FUNCTION().
eStatus xCom1Shell_GetStatus | ( | void | ) |
Return the status of the COM1 shell module.
References xCom1ShellStatus.
|
static |
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().
|
static |
The COM1 shell module status.
Referenced by portTASK_FUNCTION(), vStartCom1Shell(), and xCom1Shell_GetStatus().
|
static |