Functions | |
void | suspend_action (void) |
Spare function to handle sleep mode. | |
void | usb_start_device (void) |
This function initializes the USB device controller. | |
PROCESS_THREAD (usb_process, ev, data_proc) | |
USB Process. | |
ISR (USB_GEN_vect) | |
USB general interrupt subroutine. | |
Variables | |
volatile uint16_t | 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) Usb_clear_all_event() Is_usb_event(x) Is_not_usb_event(x). | |
bit | usb_connected |
Public : (bit) 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 == ENABLED only /. | |
U8 | usb_configuration_nb |
Public : (U8) usb_configuration_nb Store the number of the USB configuration used by the USB device when its value is different from zero, it means the device mode is enumerated Used with USB_DEVICE_FEATURE == ENABLED only /. |
ISR | ( | USB_GEN_vect | ) |
USB general interrupt subroutine.
This function is called each time a USB interrupt occurs. The following USB DEVICE events are taken in charge:
For each event, the user can launch an action by completing the associate define (See conf_usb.h file to add action upon events)
Note: Only interrupts events that are enabled are processed
Definition at line 294 of file usb_task.c.
References EVT_USB_POWERED, EVT_USB_RESET, EVT_USB_RESUME, EVT_USB_SUSPEND, EVT_USB_UNPOWERED, EVT_USB_WAKE_UP, FALSE, Is_usb_reset, Is_usb_resume, Is_usb_sof, Is_usb_suspend, Is_usb_wake_up, process_post(), TRUE, Usb_ack_reset, Usb_ack_resume, Usb_ack_sof, Usb_ack_suspend, Usb_ack_wake_up, Usb_attach, usb_configuration_nb, usb_connected, Usb_disable_resume_interrupt, Usb_disable_wake_up_interrupt, Usb_enable_reset_interrupt, Usb_enable_wake_up_interrupt, Usb_freeze_clock, usb_init_device(), Usb_send_event, and usb_start_device().
PROCESS_THREAD | ( | usb_process | , | |
ev | , | |||
data_proc | ||||
) |
USB Process.
The actual USB process, deals with USB events such as resets, and being plugged in or unplugged. A seperate polling routine is setup, which continously checks for things such as SETUP packets on the control interface. They must be responded to very quickly, hence the need for a polling process.
Definition at line 217 of file usb_task.c.
References EVT_USB_RESET, FALSE, Is_usb_event, PROCESS_BEGIN, PROCESS_END, process_poll(), PROCESS_POLLHANDLER, PROCESS_WAIT_EVENT_UNTIL, TRUE, Usb_ack_event, usb_configuration_nb, usb_connected, Usb_disable, Usb_enable, Usb_enable_regulator, Usb_force_device_mode, Usb_low_speed_mode, Usb_reset_endpoint, and usb_start_device().
void usb_start_device | ( | void | ) |
This function initializes the USB device controller.
This function enables the USB controller and init the USB interrupts. The aim is to allow the USB connection detection in order to send the appropriate USB event to the operating mode manager. Start device function is executed once VBUS connection has been detected either by the VBUS change interrupt either by the VBUS high level
Definition at line 149 of file usb_task.c.
References Pll_start_auto, Usb_attach, Usb_enable_reset_interrupt, usb_init_device(), and Wait_pll_ready.
Referenced by ISR(), and PROCESS_THREAD().