Microchip® Advanced Software Framework

supervisor.h File Reference
#include "FreeRTOS.h"
#include "semphr.h"
#include "conf_usb.h"

Macros

#define SYS_NB_MOD   4
 

Enumerations

enum  eModId {
  SYS_MODID_NONE = -1,
  SYS_MODID_COM1SHELL = 1,
  SYS_MODID_HTTP = 2,
  SYS_MODID_USB = 4,
  SYS_MODID_MMI = 8
}
 
enum  eStatus {
  SYS_STATUS_STARTUP,
  SYS_STATUS_RUNNING,
  SYS_STATUS_DOWN
}
 

Functions

bool b_supervisor_IsInMaintenanceMode (void)
 Maintenance mode status. More...
 
bool b_supervisor_leave_UsbMassStorage_mode (void)
 Leave the USB Mass Storage mode while the USB host is plugged in. More...
 
bool b_supervisor_leave_waitingforhost_mode (void)
 Leave the waiting-for-host mode while the USB host has not been plugged in yet. More...
 
bool b_supervisor_switch_to_maintenance_mode (void)
 The switch-to-maintenance-mode command: initiate the process to
switch to maintenance mode. More...
 
bool b_USBHostCopyCfg (void)
 Launch the "Upload CFG Files" MMI task that copies the /CFG directory from the USB Mass Storage device to the Control Panel. More...
 
bool b_USBHostCopyLogs (void)
 Launch the "Copy Logs" MMI task that copies the /LOG directory from the
Control Panel to the USB Mass Storage device. More...
 
bool b_USBHostCopyWeb (void)
 Launch the "Upload WEB Files" MMI task that copies the /WEB directory from the USB Mass Storage device to the Control Panel. More...
 
bool b_USBHostMoveLogs (void)
 Launch the "Move Logs" MMI task that moves the /LOG directory content
from the Control Panel to the USB Mass Storage device. More...
 
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. 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 remote host disconnection. 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...
 

#define SYS_NB_MOD   4

Number of modules id.

enum eModId

Modules id.

Enumerator
SYS_MODID_NONE 
SYS_MODID_COM1SHELL 
SYS_MODID_HTTP 
SYS_MODID_USB 
SYS_MODID_MMI 
enum eStatus

Modules status.

Enumerator
SYS_STATUS_STARTUP 
SYS_STATUS_RUNNING 
SYS_STATUS_DOWN 

bool b_supervisor_IsInMaintenanceMode ( void  )

Maintenance mode status.

Returns
true if the maintenance mode is active else false.

References bIsInMaintenance.

Referenced by e_syscmds_reboot().

bool b_supervisor_leave_UsbMassStorage_mode ( void  )

Leave the USB Mass Storage mode while the USB host is plugged in.

References bIsInMaintenance, pdTRUE, prv_v_leave_maintenance_mode(), and Usb_detach.

bool b_supervisor_leave_waitingforhost_mode ( void  )

Leave the waiting-for-host mode while the USB host has not been plugged in yet.

References bIsInMaintenance, pdTRUE, and prv_v_common_leave_UsbDevice_mode().

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.

bool b_USBHostCopyCfg ( void  )

Launch the "Upload CFG Files" MMI task that copies the /CFG directory from the USB Mass Storage device to the Control Panel.

Returns
pdTRUE

References e_usbsys_cp_cfg_to_local(), eUserMenuUSBHost, eUserMenuUSBHostActing, NAKED_TRACE_COM2, NULL, pdFALSE, pdTRUE, SHELL_EXECSTATUS_KO, sMmiNavId, SYS_MODID_MMI, vMMI_SetUserMenuMode(), and vTaskDelay().

bool b_USBHostCopyLogs ( void  )

Launch the "Copy Logs" MMI task that copies the /LOG directory from the
Control Panel to the USB Mass Storage device.

Returns
pdTRUE

References e_usbsys_cp_logs_to_key(), eUserMenuUSBHost, eUserMenuUSBHostActing, NAKED_TRACE_COM2, NULL, pdFALSE, pdTRUE, SHELL_EXECSTATUS_KO, sMmiNavId, SYS_MODID_MMI, vMMI_SetUserMenuMode(), and vTaskDelay().

bool b_USBHostCopyWeb ( void  )

Launch the "Upload WEB Files" MMI task that copies the /WEB directory from the USB Mass Storage device to the Control Panel.

Returns
pdTRUE

References e_usbsys_cp_web_to_local(), eUserMenuUSBHost, eUserMenuUSBHostActing, NAKED_TRACE_COM2, NULL, pdFALSE, pdTRUE, SHELL_EXECSTATUS_KO, sMmiNavId, SYS_MODID_MMI, vMMI_SetUserMenuMode(), and vTaskDelay().

bool b_USBHostMoveLogs ( void  )

Launch the "Move Logs" MMI task that moves the /LOG directory content
from the Control Panel to the USB Mass Storage device.

Returns
pdTRUE

References e_usbsys_mv_logs_to_key(), eUserMenuUSBHost, eUserMenuUSBHostActing, NAKED_TRACE_COM2, NULL, pdFALSE, pdTRUE, SHELL_EXECSTATUS_KO, sMmiNavId, SYS_MODID_MMI, vMMI_SetUserMenuMode(), and vTaskDelay().

void v_supervisor_Device_Connects ( void  )

Called upon remote device connection (upon PIN ID CHANGE event when we are host)

References SUPERVISOR_USB_ROLE_HOST, SUPERVISOR_USB_ROLE_NONE, and u8CurrentUsbRole.

void v_supervisor_Device_Disconnects ( void  )

Called upon remote device disconnection.

Called upon remote device disconnection.

References ms_connected, ms_new_device_connected, SUPERVISOR_USB_ROLE_HOST, SUPERVISOR_USB_ROLE_NONE, and u8CurrentUsbRole.

void v_supervisor_Host_Connects ( void  )

Called upon remote host connect (upon VBUS ON event when we are device)

References bIsInMaintenance, SUPERVISOR_USB_ROLE_DEVICE, SUPERVISOR_USB_ROLE_NONE, u8CurrentUsbRole, u8IsMaintenanceRequired, Usb_detach, and Usb_unfreeze_clock.

void v_supervisor_Host_Disconnects ( void  )

Called upon remote host disconnection.

Called upon remote host disconnection.

Warning
: the name of the function may imply that this is called in case we were a device, but this may not always be the case: this function may be called when we are a device. Explanation: the VBUS OFF event occurs in both cases.

References bIsInMaintenance, bOutOfMaintenance, SUPERVISOR_USB_ROLE_DEVICE, SUPERVISOR_USB_ROLE_NONE, and u8CurrentUsbRole.

void vSupervisor_Start ( unsigned portBASE_TYPE  uxPriority)

Start the supervisor module.

Parameters
uxPriorityThe priority base of the supervisor tasks.

References NULL, SUPERVISOR_STACK_SIZE, and xTaskCreate.

Referenced by main().

portBASE_TYPE x_supervisor_SemaphoreTake ( xSemaphoreHandle  xSemaphore,
portTickType  xBlockTime 
)

Take a system mutex.

Parameters
xSemaphoreA handle to the semaphore being obtained.
xBlockTimeThe time in ticks to wait for the semaphore to become available.
Returns
pdTRUE if the semaphore was obtained. pdFALSE if xBlockTime expired without the semaphore becoming available.
Parameters
xSemaphoreA handle to the semaphore being released.
xBlockTimeThe time in ticks to wait for the semaphore to become available.
Returns
pdTRUE if the semaphore was obtained. pdFALSE if xBlockTime expired without the semaphore becoming available.

References bOutOfMaintenance, 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().