Microchip® Advanced Software Framework

syscmds.c File Reference
#include <string.h>
#include "gpio.h"
#include "FreeRTOS.h"
#include "task.h"
#include "shell.h"
#include "ethernet.h"
#include "BasicWEB.h"
#include "BasicSMTP.h"
#include "cptime.h"
#include "conf_usb.h"
#include "usb_drv.h"
#include "usb_task.h"
#include "com1shell.h"
#include "sensor.h"
#include "supervisor.h"
#include "syscmds.h"

Functions

eExecStatus e_supervisor_switch_to_maintenance_mode (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The switch-to-maintenance-mode command: initiate the process to
switch to maintenance mode. Format: maintain. More...
 
eExecStatus e_syscmds_cmd_get_config (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The get sys config command: get the config fields value of a subsystem Takes one parameter, that is the subsystem's name. Format: get_sys_config sys=sysname. More...
 
eExecStatus e_syscmds_cmd_set_config (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The set sys config command: set the value of a config field of a subsystem. Takes three parameters. The first parameter is the system's name, the second parameter is the config field name, the third parameter is its value. Format: set_sys_config sys=sysname field=value. More...
 
eExecStatus e_syscmds_help (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The sys help command: display the system & subsystems available shell commands. Format: help. More...
 
eExecStatus e_syscmds_reboot (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The sys reboot command: Sw reset of the Ctrl Panel. Format: reboot. More...
 
eExecStatus e_syscmds_trace (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The dbgtrace command: displays info on the trace port(USART1). Format: dbgtrace. More...
 
eExecStatus e_syscmds_version (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The sys version command: Display the Ctrl Panel sw version. Format: version. More...
 
void v_syscmds_display_traces (void)
 Display debug info on the trace port(USART1). More...
 

Variables

const char *const pcCtrlPanelVersion
 
const signed portCHAR *const SYSCMDS_MSG_HELP
 
xSemaphoreHandle xCFGMutex
 

eExecStatus e_supervisor_switch_to_maintenance_mode ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The switch-to-maintenance-mode command: initiate the process to
switch to maintenance mode. Format: maintain.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
xModIdInput. The module that is calling this function.
FsNavIdIgnored.
acIgnored.
avIgnored.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution.
eExecStatus e_syscmds_cmd_get_config ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The get sys config command: get the config fields value of a subsystem Takes one parameter, that is the subsystem's name. Format: get_sys_config sys=sysname.

The get sys config command: get the config fields value of a subsystem Takes one parameter, that is the subsystem's name. Format: get_sys_config sysname.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
xModIdInput. The module that is calling this function.
FsNavIdIgnored.
acInput. The argument counter. For this command, should be 1.
avInput. The argument vector.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution.

References e_cptime_cmd_get_config(), e_ethernet_cmd_get_config(), e_smtpclient_cmd_get_config(), e_webserver_cmd_get_config(), and SHELL_EXECSTATUS_KO.

eExecStatus e_syscmds_cmd_set_config ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The set sys config command: set the value of a config field of a subsystem. Takes three parameters. The first parameter is the system's name, the second parameter is the config field name, the third parameter is its value. Format: set_sys_config sys=sysname field=value.

The set sys config command: set the value of a config field of a subsystem. Takes three parameters. The first parameter is the system's name, the second parameter is the config field name, the third parameter is its value. Format: set_sys_config sysname field=value.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
xModIdInput. The module that is calling this function.
FsNavIdIgnored.
acInput. The argument counter. For this command, should be 3.
avInput. The argument vector.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution.

References e_cptime_cmd_set_config(), e_ethernet_cmd_set_config(), e_smtpclient_cmd_set_config(), e_webserver_cmd_set_config(), NULL, pdFALSE, SHELL_ERRMSG_MAINTENANCEMODE, SHELL_EXECSTATUS_KO, x_supervisor_SemaphoreGive(), and x_supervisor_SemaphoreTake().

eExecStatus e_syscmds_help ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The sys help command: display the system & subsystems available shell commands. Format: help.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
xModIdInput. The module that is calling this function.
FsNavIdIgnored.
acIgnored.
avIgnored.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution.

References NULL, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK_NO_FREE, and SYSCMDS_MSG_HELP.

Referenced by e_Shell_help().

eExecStatus e_syscmds_reboot ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The sys reboot command: Sw reset of the Ctrl Panel. Format: reboot.

The sys reboot command. Format: reboot.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
xModIdInput. The module that is calling this function.
FsNavIdIgnored.
acIgnored.
avIgnored.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution(makes no sense).

References b_supervisor_IsInMaintenanceMode(), Disable_global_interrupt, e_supervisor_switch_to_maintenance_mode(), Enable_global_interrupt, NULL, SHELL_EXECSTATUS_OK, Usb_disable, Usb_disable_otg_pad, v_com1shell_stopResources(), v_ethernet_stopResources(), v_sensor_stop(), and v_tracedump_stopResources().

eExecStatus e_syscmds_trace ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The dbgtrace command: displays info on the trace port(USART1). Format: dbgtrace.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
xModIdInput. The module that is calling this function.
FsNavIdIgnored.
acIgnored.
avIgnored.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution.

References NULL, SHELL_EXECSTATUS_OK, and v_syscmds_display_traces().

eExecStatus e_syscmds_version ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The sys version command: Display the Ctrl Panel sw version. Format: version.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
xModIdInput. The module that is calling this function.
FsNavIdIgnored.
acIgnored.
avIgnored.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution(makes no sense).

References NULL, pcCtrlPanelVersion, SHELL_EXECSTATUS_KO, and SHELL_EXECSTATUS_OK_NO_FREE.

void v_syscmds_display_traces ( void  )

Display debug info on the trace port(USART1).

References NAKED_TRACE_COM2, and vTaskList().

Referenced by e_syscmds_trace(), and portTASK_FUNCTION().

const char* const pcCtrlPanelVersion

The Ctrl Panel sw version.

Referenced by e_syscmds_version().

const signed portCHAR* const SYSCMDS_MSG_HELP
Initial value:
= (signed portCHAR *)"\
"CRLF"get_sys_config sys={net,http,time} : display the config of a system module"CRLF"\
set_sys_config sys=net {macaddr,ipaddr,submask,gwaddr}=value : set one of the config fields of the network module"CRLF"\
set_sys_config sys=http port=value : set the HTTP port of the Web server module"CRLF"\
set_sys_config sys=time curtime=\"mm/dd/yy hh:mm:ss\" : set the current time of the Control Panel"CRLF"\
set_sys_config sys=smtp {port,mailto,mailfrom,server}=value : set one of the config fields of the SMTP client"CRLF"\
maintain : switch to maintenance mode"CRLF"\
cp_logs_to_ukey : cp the /LOG dir to a USB Mass Storage device"CRLF
"reboot : sw reset"CRLF"\
lsusb : display info on the USB conn(DEVELOPMENT ONLY)"CRLF
"\
version: display the Ctrl Panel sw version."CRLF
#define CRLF
Definition: shell.h:61

Referenced by e_syscmds_help().

xSemaphoreHandle xCFGMutex

The CFG system mutex.