#include "compiler.h"
#include "intc.h"
#include "conf_usb.h"
#include "usb_drv.h"
#include "usb_task.h"
#include "usb_descriptors.h"
#include "usb_device_task.h"
#include "pm.h"
Functions | |
static void | usb_general_interrupt (void) |
USB interrupt routine. More... | |
void | usb_suspend_action (void) |
void | usb_task (void) |
Entry point of the USB management. More... | |
void | usb_task_init (void) |
This function initializes the USB process. More... | |
Variables | |
volatile U16 | g_usb_event = 0 |
Public: U16 g_usb_event usb_connected is used to store USB events detected upon USB general interrupt subroutine Its value is managed by the following macros (See usb_task.h file) Usb_send_event(x) Usb_ack_event(x) Is_usb_event(x) Usb_clear_all_event() More... | |
volatile bool | usb_connected |
Public: bool usb_connected usb_connected is set to true when VBus has been detected usb_connected is set to false otherwise Used with USB_DEVICE_FEATURE == true only. More... | |
|
static |
USB interrupt routine.
This function is called each time a USB interrupt occurs. The following USB DEVICE events are taken in charge:
The following USB HOST events are taken in charge:
For each event, the user can launch an action by completing the associated #define (see the conf_usb.h file to add actions on events).
Note: Only interrupt events that are enabled are processed.
Warning: If device and host tasks are not tasks in an RTOS, rough events like ID transition, VBus transition, device disconnection, etc. that need to kill then restart these tasks may lead to an undefined state if they occur just before something is activated in the USB macro (e.g. pipe/endpoint transfer...).
References EVT_HOST_DISCONNECTION, EVT_HOST_HWUP, EVT_HOST_SOF, EVT_USB_DEVICE_FUNCTION, EVT_USB_HOST_FUNCTION, EVT_USB_POWERED, EVT_USB_RESET, EVT_USB_RESUME, EVT_USB_SUSPEND, EVT_USB_UNPOWERED, EVT_USB_WAKE_UP, g_usb_mode, Host_ack_device_connection, Host_ack_device_disconnection, Host_ack_hwup, Host_ack_sof, Host_disable_hwup_interrupt, Host_disable_sof_interrupt, Host_get_interrupt_pipe_number, Host_get_pipe_type, Host_reset_pipe, Is_host_device_connection, Is_host_device_connection_interrupt_enabled, Is_host_device_disconnection, Is_host_device_disconnection_interrupt_enabled, Is_host_hwup, Is_host_hwup_interrupt_enabled, Is_host_sof, Is_host_sof_interrupt_enabled, Is_usb_clock_frozen, Is_usb_device, Is_usb_full_speed_mode, Is_usb_id_device, Is_usb_id_interrupt_enabled, Is_usb_id_transition, Is_usb_reset, Is_usb_reset_interrupt_enabled, Is_usb_resume, Is_usb_resume_interrupt_enabled, Is_usb_sof, Is_usb_sof_interrupt_enabled, Is_usb_suspend, Is_usb_suspend_interrupt_enabled, Is_usb_vbus_high, Is_usb_vbus_interrupt_enabled, Is_usb_vbus_transition, Is_usb_wake_up, Is_usb_wake_up_interrupt_enabled, LOG_STR, MAX_PEP_NB, TYPE_INTERRUPT, Usb_ack_id_transition, Usb_ack_reset, Usb_ack_resume, Usb_ack_sof, Usb_ack_suspend, Usb_ack_vbus_transition, Usb_ack_wake_up, usb_configuration_nb, usb_connected, Usb_detach, Usb_disable, Usb_disable_otg_pad, Usb_disable_resume_interrupt, Usb_disable_wake_up_interrupt, Usb_enable_wake_up_interrupt, Usb_freeze_clock, usb_init_device(), USB_MODE_DEVICE, USB_MODE_HOST, Usb_reset_action, Usb_resume_action, Usb_send_event, Usb_sof_action, usb_start_device(), Usb_suspend_action, Usb_unfreeze_clock, Usb_vbus_off_action, Usb_vbus_on_action, and Usb_wake_up_action.
volatile bool usb_connected |
Public: bool usb_connected usb_connected is set to true when VBus has been detected usb_connected is set to false otherwise Used with USB_DEVICE_FEATURE == true only.
Public: bool usb_connected usb_connected is set to true when VBus has been detected usb_connected is set to false otherwise Used with USB_DEVICE_FEATURE == true only.
Referenced by usb_device_task(), usb_device_task_init(), usb_general_interrupt(), and usb_start_device().