This module manages a command shell on COM1.
Definition in file com1shell.h.
#include "FreeRTOS.h"
#include "fs_com.h"
#include "supervisor.h"
Go to the source code of this file.
Functions | |
signed portBASE_TYPE | com1shell_GetChar (signed portCHAR *pcByte) |
Get a char from the COM1 port. | |
void | v_com1shell_mount_local_drive (void) |
Mount default local drive 'a:'. | |
void | v_com1shell_stopResources (void) |
Stop the com1shell module resources. | |
void | vcom1shell_PrintMsg (const signed portCHAR *pcString) |
Print a string to the COM1 port. | |
void | vcom1shell_PutChar (signed portCHAR cByte) |
Put a char to the COM1 port. | |
void | vStartCom1Shell (unsigned portBASE_TYPE uxPriority) |
eStatus | xCom1Shell_GetStatus (void) |
Return the status of the COM1 shell module. |
signed portBASE_TYPE com1shell_GetChar | ( | signed portCHAR * | pcByte | ) |
Get a char from the COM1 port.
pcByte | Output. The char received from the COM1 port. |
Definition at line 298 of file com1shell.c.
References COM1SHELL_RX_BLOCK_TIME, xComPort1Hndl, and xUsartGetChar().
Referenced by prv_GetChar_From_Requester_Stream().
00299 { 00300 return( xUsartGetChar( xComPort1Hndl, pcByte, COM1SHELL_RX_BLOCK_TIME ) ); 00301 }
void v_com1shell_mount_local_drive | ( | void | ) |
Mount default local drive 'a:'.
Definition at line 316 of file com1shell.c.
References LUN_ID_AT45DBX_MEM, and sCom1ShellNavId.
Referenced by prv_v_leave_maintenance_mode(), and vStartCom1Shell().
00317 { 00318 fsaccess_take_mutex(); 00319 nav_select( sCom1ShellNavId ); // Select the COM1SHELL navigator. 00320 nav_drive_set(LUN_ID_AT45DBX_MEM); 00321 nav_partition_mount(); 00322 fsaccess_give_mutex(); 00323 }
void v_com1shell_stopResources | ( | void | ) |
Stop the com1shell module resources.
Definition at line 158 of file com1shell.c.
References vSerialClose(), and xComPort1Hndl.
Referenced by e_syscmds_reboot().
00159 { 00160 vSerialClose( xComPort1Hndl ); 00161 }
void vcom1shell_PrintMsg | ( | const signed portCHAR * | pcString | ) |
Print a string to the COM1 port.
pcString | Input. The string to print. |
Definition at line 270 of file com1shell.c.
References usUsartPutString(), and xComPort1Hndl.
Referenced by portTASK_FUNCTION(), prv_Print_String_To_Requester_Stream(), prvGetCmdLine(), and v_shell_Print_String_To_Requester_Stream().
00271 { 00272 unsigned portSHORT usRemainChar = 0; 00273 unsigned portSHORT usMsgLen = strlen((const portCHAR * )pcString); 00274 00275 if(usMsgLen==0) 00276 return; 00277 usRemainChar = usMsgLen; 00278 do { 00279 usRemainChar = usUsartPutString( xComPort1Hndl, 00280 (const signed portCHAR *)(pcString + usMsgLen - usRemainChar), 00281 usRemainChar ); 00282 }while( usRemainChar ); 00283 }
void vcom1shell_PutChar | ( | signed portCHAR | cByte | ) |
Put a char to the COM1 port.
cByte | Input. The char to print. |
Definition at line 289 of file com1shell.c.
References COM1SHELL_NO_BLOCK, xComPort1Hndl, and xUsartPutChar().
Referenced by prv_PutChar_To_Requester_Stream(), and prvGetCmdLine().
00290 { 00291 xUsartPutChar( xComPort1Hndl, cByte, COM1SHELL_NO_BLOCK); 00292 }
void vStartCom1Shell | ( | unsigned portBASE_TYPE | uxPriority | ) |
Start the COM1 shell module.
uxPriority | The priority base of the COM1 shell tasks. |
Definition at line 137 of file com1shell.c.
References COM1SHELL_STACK_SIZE, sCom1ShellNavId, SYS_STATUS_DOWN, SYS_STATUS_STARTUP, v_com1shell_mount_local_drive(), xCom1ShellHndl, and xCom1ShellStatus.
Referenced by portTASK_FUNCTION().
00138 { 00139 xCom1ShellStatus = SYS_STATUS_STARTUP; 00140 00141 /* Get a File System navigator for COM1SHELL. */ 00142 fsaccess_take_mutex(); 00143 sCom1ShellNavId = fsaccess_alloc_nav_id(); 00144 fsaccess_give_mutex(); 00145 00146 /* Try to mount local drive */ 00147 v_com1shell_mount_local_drive(); 00148 00149 /* Spawn the shell task. */ 00150 if( xTaskCreate( vCom1ShellTask, ( const signed portCHAR * ) "SH", 00151 COM1SHELL_STACK_SIZE, NULL, uxPriority, &xCom1ShellHndl ) != pdPASS ) 00152 xCom1ShellStatus = SYS_STATUS_DOWN; 00153 }
eStatus xCom1Shell_GetStatus | ( | void | ) |
Return the status of the COM1 shell module.
Return the status of the COM1 shell module.
one of the eStatus enum value.
Definition at line 167 of file com1shell.c.
References xCom1ShellStatus.
00168 { 00169 return xCom1ShellStatus; 00170 }