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

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 

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.

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 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.
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_SemaphoreGive ( xSemaphoreHandle  xSemaphore)
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 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().