Functions | |
void | usb_device_task_init (void) |
This function initializes the USB device controller. | |
void | usb_start_device (void) |
This function initializes the USB device controller. | |
void | usb_device_task (void) |
Entry point of the USB device mamagement. | |
void | usb_autobaud (void) |
USB based autobaud function. |
void usb_device_task_init | ( | 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.
none |
Definition at line 67 of file usb_device_task.c.
References Usb_disable, Usb_enable, and Usb_vbus_sense_init.
Referenced by usb_task_init().
00068 { 00069 Usb_disable(); 00070 Usb_enable(); 00071 #if (VBUS_SENSING_IO == ENABLED) 00072 Usb_vbus_sense_init(); // init. the I/O used for Vbus sensing 00073 #endif 00074 }
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
none |
Definition at line 89 of file usb_device_task.c.
References Usb_attach, usb_autobaud(), Usb_enable_device, Usb_enable_reset_interrupt, Usb_enable_suspend_interrupt, Usb_freeze_clock, usb_init_device(), Usb_reset_all_system, Usb_reset_macro_only, Usb_unfreeze_clock, and Wait_pll_ready.
Referenced by usb_device_task().
00090 { 00091 Usb_freeze_clock(); 00092 #ifdef BYPASS_USB_AUTOBAUD 00093 Pll_start_auto(); 00094 Wait_pll_ready(); 00095 Usb_unfreeze_clock(); 00096 #else 00097 Usb_enable_device(); 00098 Usb_attach(); 00099 usb_autobaud(); 00100 #endif 00101 00102 Usb_unfreeze_clock(); 00103 Usb_attach(); 00104 #if (USB_RESET_CPU == ENABLED) 00105 Usb_reset_all_system(); 00106 #else 00107 Usb_reset_macro_only(); 00108 #endif 00109 Usb_enable_suspend_interrupt(); 00110 Usb_enable_reset_interrupt(); 00111 Enable_interrupt(); 00112 usb_init_device(); // configure the USB controller EP0 00113 }
Here is the call graph for this function:
void usb_device_task | ( | void | ) |
Entry point of the USB device mamagement.
This function is the entry point of the USB management. Each USB event is checked here in order to launch the appropriate action. If a Setup request occurs on the Default Control Endpoint, the usb_process_request() function is call in the usb_standard_request.c file
none |
Definition at line 125 of file usb_device_task.c.
References EP_CONTROL, EVT_USB_RESET, FALSE, Is_usb_event, Is_usb_receive_setup, Is_usb_vbus_off, Is_usb_vbus_on, Stop_pll, TRUE, Usb_ack_event, usb_configuration_nb, usb_connected, Usb_detach, Usb_disable, Usb_enable, usb_process_request(), Usb_reset_endpoint, Usb_select_endpoint, usb_start_device(), and Usb_vbus_on_action.
Referenced by usb_task().
00126 { 00127 if (usb_connected == FALSE) 00128 { 00129 #if (VBUS_SENSING_IO == ENABLED) 00130 if (Is_usb_vbus_on()) // check if Vbus ON to attach 00131 { 00132 Usb_enable(); 00133 usb_connected = TRUE; 00134 usb_start_device(); 00135 Usb_vbus_on_action(); 00136 } 00137 #else 00138 usb_connected = TRUE; // attach if application is not self-powered 00139 usb_start_device(); 00140 Usb_vbus_on_action(); 00141 #endif 00142 } 00143 00144 #if (VBUS_SENSING_IO == ENABLED) 00145 if ((usb_connected == TRUE) && Is_usb_vbus_off()) // check if Vbus OFF to detach 00146 { 00147 Usb_detach(); 00148 Usb_disable(); 00149 Stop_pll(); 00150 usb_connected = FALSE; 00151 usb_configuration_nb=0; 00152 } 00153 #endif 00154 00155 if(Is_usb_event(EVT_USB_RESET)) 00156 { 00157 Usb_ack_event(EVT_USB_RESET); 00158 Usb_reset_endpoint(0); 00159 usb_configuration_nb=0; 00160 } 00161 00162 // Here connection to the device enumeration process 00163 Usb_select_endpoint(EP_CONTROL); 00164 if (Is_usb_receive_setup()) 00165 { 00166 usb_process_request(); 00167 } 00168 }
Here is the call graph for this function:
void usb_autobaud | ( | void | ) |
USB based autobaud function.
This function configures the pll prescaler to get USB functionnnal with current XTAL
none |
Referenced by usb_start_device().