#include <stdlib.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "conf_ctrlpanel.h"
#include "tracedump.h"
#include "navigation.h"
#include "com1shell.h"
#include "datalog.h"
#include "cptime.h"
#include "sensor.h"
#include "mmi.h"
#include "shell.h"
#include "syscmds.h"
#include "fsaccess.h"
Macros | |
#define | mainCOMSH_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) |
Priority definitions for most of the tasks in the demo application. More... | |
#define | mainDATALOG_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) |
#define | mainETH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) |
#define | SUPERVISOR_CHECK_KO (-1) |
Return status false. More... | |
#define | SUPERVISOR_CHECK_OK 0 |
Return status true. More... | |
#define | SUPERVISOR_DEFAULT_PERIOD ( ( portTickType ) 100 / portTICK_RATE_MS ) |
The supervisor rate in ticks. More... | |
#define | SUPERVISOR_DELAY_HEAPCHECK 600 |
The delay between each heap usage check. More... | |
#define | SUPERVISOR_DELAY_MMI_TIMEUPDATE 600 |
The delay between each time update on the MMI. More... | |
#define | SUPERVISOR_DELAY_PRINTTASKLIST 600 |
The delay between each tasks list display. More... | |
#define | SUPERVISOR_DELAY_TIMEUPDATE 10 |
The delay between each time update. More... | |
#define | SUPERVISOR_QUEUE_SIZE 1 |
The supervisor queue length. More... | |
#define | SUPERVISOR_STACK_SIZE ( configMINIMAL_STACK_SIZE + 192 ) |
#define | SUPERVISOR_USER_ACTION_STACK_SIZE (configMINIMAL_STACK_SIZE+64) |
The supervisor User Action stack size. More... | |
#define | SUPERVISOR_USER_ACTION_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) |
The supervisor User Action task priority. More... | |
Functions | |
bool | b_supervisor_switch_to_maintenance_mode (void) |
The switch-to-maintenance-mode command: initiate the process to switch to maintenance mode. More... | |
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... | |
static | portTASK_FUNCTION (vSupervisorTask, pvParameters) |
Supervisor task. More... | |
static | portTASK_FUNCTION_PROTO (vSupervisorTask, pvParameters) |
static void | prv_v_leave_maintenance_mode (void) |
Do the required actions to leave the maintenance mode. More... | |
void | prvCheckMallocHeap (void) |
void | v_supervisor_Device_Connects (void) |
Called upon remote device connection (upon PIN ID CHANGE event when we are host) More... | |
void | v_supervisor_Device_Disconnects (void) |
Called upon remote device disconnection (upon PIN ID CHANGE event when we are host) More... | |
void | v_supervisor_Host_Connects (void) |
Called upon remote host connect (upon VBUS ON event when we are device) More... | |
void | v_supervisor_Host_Disconnects (void) |
Called upon VBUS OFF event. More... | |
void | vSupervisor_Start (unsigned portBASE_TYPE uxPriority) |
Start the supervisor module. More... | |
portBASE_TYPE | x_supervisor_SemaphoreGive (xSemaphoreHandle xSemaphore) |
Release a system mutex. More... | |
portBASE_TYPE | x_supervisor_SemaphoreTake (xSemaphoreHandle xSemaphore, portTickType xBlockTime) |
Take a system mutex. More... | |
Variables | |
void | __heap_end__ |
void | __heap_start__ |
portBASE_TYPE * | pxHighestHeapAddr = (portBASE_TYPE *)&__heap_start__ |
xSemaphoreHandle | xCFGMutex |
time_t | xcptime_LocalTime |
The watchdog timeout delay. More... | |
xSemaphoreHandle | xLOGMutex |
xSemaphoreHandle | xSHELLFSMutex |
bool b_supervisor_switch_to_maintenance_mode | ( | void | ) |
The switch-to-maintenance-mode command: initiate the process to
switch to maintenance mode.
References e_supervisor_switch_to_maintenance_mode(), NULL, pdTRUE, and SYS_MODID_NONE.
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.
xModId | Input. The module that is calling this function. |
FsNavId | Ignored. |
ac | Ignored. |
av | Ignored. |
ppcStringReply | Input/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. |
References CRLF, eUserMenuWaitHost, fat_cache_flush(), Is_usb_clock_frozen, Is_usb_detached, NAKED_TRACE_COM2, nav_reset(), NULL, pdTRUE, SHELL_EXECSTATUS_OK, TRACE_COM2, Usb_attach, Usb_detach, Usb_unfreeze_clock, vMMI_SetUserMenuMode(), vTaskDelay(), x_supervisor_SemaphoreTake(), and xSemaphoreGive.
Referenced by b_supervisor_switch_to_maintenance_mode(), and e_syscmds_reboot().
|
static |
Supervisor task.
References __heap_end__, __heap_start__, b_usbsys_start(), bdatalog_start(), bMMI_start(), bsensor_start(), eUserMenuIdle, eUserMenuUSBDevice, eUserMenuUSBHost, fsaccess_alloc_nav_id(), fsaccess_give_mutex(), fsaccess_take_mutex(), Is_device_enumerated, itracedump_Init(), mainCOMSH_TASK_PRIORITY, mainDATALOG_TASK_PRIORITY, ms_connected, NAKED_TRACE_COM2, nav_select(), NULL, pdFALSE, pdPASS, pdTRUE, prv_v_leave_maintenance_mode(), prvCheckMallocHeap(), sMmiNavId, sprintf(), SUPERVISOR_DEFAULT_PERIOD, SUPERVISOR_DELAY_HEAPCHECK, SUPERVISOR_DELAY_MMI_TIMEUPDATE, SUPERVISOR_DELAY_PRINTTASKLIST, SUPERVISOR_DELAY_TIMEUPDATE, SUPERVISOR_QUEUE_SIZE, SUPERVISOR_USER_ACTION_STACK_SIZE, SUPERVISOR_USER_ACTION_TASK_PRIORITY, tskIDLE_PRIORITY, v_cptime_ExecuteScheduledCmd(), v_syscmds_display_traces(), vMMI_DisplayDateAndTime(), vMMI_DisplayUSBState(), vMMI_Manage(), vMMI_SetUserMenuMode(), vSemaphoreCreateBinary, vStartCom1Shell(), vStartEthernetTaskLauncher(), vTaskDelayUntil(), vTaskDelete(), x_supervisor_SemaphoreTake(), xcptime_LocalTime, xQueueCreate(), xTaskCreate, and xTaskGetTickCount().
|
static |
|
static |
Do the required actions to leave the maintenance mode.
References NAKED_TRACE_COM2, and v_com1shell_mount_local_drive().
Referenced by portTASK_FUNCTION().
void prvCheckMallocHeap | ( | void | ) |
References __heap_end__, __heap_start__, NAKED_TRACE_COM2, and pxHighestHeapAddr.
Referenced by portTASK_FUNCTION().
void v_supervisor_Device_Connects | ( | void | ) |
Called upon remote device connection (upon PIN ID CHANGE event when we are host)
void v_supervisor_Device_Disconnects | ( | void | ) |
Called upon remote device disconnection (upon PIN ID CHANGE event when we are host)
Called upon remote device disconnection.
References ms_connected, and ms_new_device_connected.
void v_supervisor_Host_Connects | ( | void | ) |
Called upon remote host connect (upon VBUS ON event when we are device)
References Usb_detach, and Usb_unfreeze_clock.
void v_supervisor_Host_Disconnects | ( | void | ) |
Called upon VBUS OFF event.
Called upon remote host disconnection.
void vSupervisor_Start | ( | unsigned portBASE_TYPE | uxPriority | ) |
Start the supervisor module.
uxPriority | The priority base of the supervisor tasks. |
References NULL, SUPERVISOR_STACK_SIZE, and xTaskCreate.
Referenced by main().
portBASE_TYPE x_supervisor_SemaphoreGive | ( | xSemaphoreHandle | xSemaphore | ) |
Release a system mutex.
xSemaphore | A handle to the semaphore being released. |
References eUserMenuWaitHost, fat_cache_flush(), Is_usb_clock_frozen, Is_usb_detached, nav_reset(), pdTRUE, TRACE_COM2, Usb_attach, Usb_detach, Usb_unfreeze_clock, vMMI_SetUserMenuMode(), vTaskDelay(), and xSemaphoreGive.
Referenced by b_joystick_init(), b_light_init(), b_potentiometer_init(), b_pushb1_init(), b_pushb2_init(), b_pushb3_init(), b_temperature_init(), e_sensor_cmd_set_config(), e_syscmds_cmd_set_config(), portTASK_FUNCTION(), prvEthernetConfigureInterface(), Shell_exec(), and usb_mass_storage_csw().
portBASE_TYPE x_supervisor_SemaphoreTake | ( | xSemaphoreHandle | xSemaphore, |
portTickType | xBlockTime | ||
) |
Take a system mutex.
xSemaphore | A handle to the semaphore being released. |
xBlockTime | The time in ticks to wait for the semaphore to become available. |
References pdFALSE, and xSemaphoreTake.
Referenced by b_joystick_init(), b_light_init(), b_potentiometer_init(), b_pushb1_init(), b_pushb2_init(), b_pushb3_init(), b_temperature_init(), e_sensor_cmd_set_config(), e_supervisor_switch_to_maintenance_mode(), e_syscmds_cmd_set_config(), portTASK_FUNCTION(), prvEthernetConfigureInterface(), Shell_exec(), and usb_mass_storage_cbw().
void __heap_end__ |
void __heap_start__ |
portBASE_TYPE* pxHighestHeapAddr = (portBASE_TYPE *)&__heap_start__ |
Referenced by prvCheckMallocHeap().
xSemaphoreHandle xCFGMutex |
The CFG system mutex.
Referenced by prvEthernetConfigureInterface().
time_t xcptime_LocalTime |
The watchdog timeout delay.
The local time raw value.
xSemaphoreHandle xLOGMutex |
The LOG system mutex.
xSemaphoreHandle xSHELLFSMutex |
The SHELL system mutex.