USB device task module


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.

Function Documentation

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.

Parameters:
none 
Returns:
none
/

Definition at line 73 of file usb_device_task.c.

References Usb_disable, Usb_enable, Usb_enable_vbus_interrupt, Usb_low_speed_mode, and Usb_select_device.

Referenced by usb_task_init().

00074 {
00075    Enable_interrupt();
00076    Usb_disable();
00077    Usb_enable();
00078    Usb_select_device();
00079 #if (USB_LOW_SPEED_DEVICE==ENABLE)
00080    Usb_low_speed_mode();
00081 #endif
00082    Usb_enable_vbus_interrupt();
00083    Enable_interrupt();
00084 
00085 }

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

Parameters:
none 
Returns:
none

Definition at line 100 of file usb_device_task.c.

References Usb_attach, Usb_enable_reset_interrupt, Usb_enable_suspend_interrupt, usb_init_device(), Usb_unfreeze_clock, and Wait_pll_ready.

Referenced by usb_device_task(), and usb_general_interrupt().

00101 {
00102    Pll_start_auto();
00103    Wait_pll_ready();
00104    Usb_unfreeze_clock();
00105    Usb_enable_suspend_interrupt();
00106    Usb_enable_reset_interrupt();
00107    usb_init_device();         // configure the USB controller EP0
00108    Usb_attach();
00109 }

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

Parameters:
none 
Returns:
none

Definition at line 121 of file usb_device_task.c.

References EP_CONTROL, EVT_USB_RESET, FALSE, Is_usb_event, Is_usb_receive_setup, Is_usb_vbus_high, TRUE, Usb_ack_event, usb_configuration_nb, usb_connected, usb_process_request(), Usb_reset_endpoint, Usb_select_endpoint, usb_start_device(), and Usb_vbus_on_action.

Referenced by usb_task().

00122 {
00123    if (Is_usb_vbus_high()&& usb_connected==FALSE)
00124    {
00125       usb_connected = TRUE;
00126       usb_start_device();
00127       Usb_vbus_on_action();
00128    }
00129 
00130    if(Is_usb_event(EVT_USB_RESET))
00131    {
00132       Usb_ack_event(EVT_USB_RESET);
00133       Usb_reset_endpoint(0);
00134       usb_configuration_nb=0;
00135    }
00136 
00137    // Here connection to the device enumeration process
00138    Usb_select_endpoint(EP_CONTROL);
00139    if (Is_usb_receive_setup())
00140    {
00141       usb_process_request();
00142    }
00143 }

Here is the call graph for this function:


Generated on Fri Jan 26 17:33:09 2007 for Atmel by  doxygen 1.5.1-p1