Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

usb_task.h File Reference

Go to the source code of this file.

Data Structures

struct  S_hid_set_control

Defines

#define Set_page_usb()

Functions

void usb_task_init (void)
 This function initializes the USB the associated variables.

void usb_start_device (void)
 This function initializes the USB device controller.

void usb_task (void)
 Entry point of the USB mamnagement.


Define Documentation

 
#define Set_page_usb  ) 
 

Definition at line 24 of file usb_task.h.

Referenced by usb_start_device(), usb_task(), and usb_task_init().


Function Documentation

void usb_task_init void   ) 
 

This function initializes the USB the associated variables.

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.

Warning:
Code:?? bytes (function code length)
Parameters:
none 
Returns:
none
/

Definition at line 68 of file usb_task.c.

References FALSE, Set_page_usb, sof_counter, toggle_next_time, TRUE, usb_connected, usb_continuous_mode, Usb_enable, and usb_start_device().

00069 { 00070 Set_page_usb(); 00071 Usb_enable(); // enable the USB controller 00072 usb_start_device(); 00073 sof_counter = 0; 00074 usb_connected = TRUE; 00075 toggle_next_time = 0; 00076 usb_continuous_mode = FALSE; 00077 }

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.

Warning:
Code:?? bytes (function code length)
Parameters:
none 
Returns:
none
/

Definition at line 95 of file usb_task.c.

References Enable_interrupt, Enable_usb_interrupt, Set_page_usb, U16, Usb_ack_suspend, Usb_attach, Usb_detach, Usb_enable_reset_interrupt, Usb_enable_resume_interrupt, Usb_enable_sof_interrupt, Usb_enable_suspend_interrupt, Usb_enable_wake_up_interrupt, usb_generate_clock(), usb_init_device(), Usb_set_speed, and Usb_unfreeze_clock.

Referenced by usb_task_init().

00096 { 00097 U16 c; 00098 usb_generate_clock(); 00099 Set_page_usb(); 00100 Usb_unfreeze_clock(); 00101 Usb_set_speed(); // for speed analysis 00102 Usb_ack_suspend(); 00103 Usb_detach(); 00104 for (c=0; c<1000; c++); 00105 Usb_attach(); 00106 Usb_enable_suspend_interrupt(); 00107 Usb_enable_resume_interrupt(); 00108 Usb_enable_reset_interrupt(); 00109 Usb_enable_wake_up_interrupt(); 00110 Usb_enable_sof_interrupt(); 00111 Enable_usb_interrupt(); 00112 Enable_interrupt(); 00113 usb_init_device(); // configure the USB controller EP0 00114 00115 Usb_attach(); 00116 }

void usb_task void   ) 
 

Entry point of the USB mamnagement.

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_enum.c file If a new USB mass storage Command Block Wrapper (CBW) occurs, this one will be decoded and the SCSI command will be taken in charge by the scsi decoder.

Warning:
Code:?? bytes (function code length)
Parameters:
none 
Returns:
none

this part of the code can be modify following the application

end of modification

Definition at line 133 of file usb_task.c.

References Disable_ale, Enable_interrupt, EP_CONTROL, EP_HID_IN, FALSE, Is_usb_in_ready, Is_usb_receive_setup, Led_all_off, Pll_stop, send_free, Set_page_usb, SetControlBytes, TRUE, S_hid_set_control::type, Usb_ack_in_ready, usb_connected, usb_continuous_mode, usb_process_request(), Usb_select_endpoint, and Usb_suspend_action.

00134 { 00135 if (!usb_connected) /* power down mode when USB not connected */ 00136 { 00137 Pll_stop(); /* disable PLL before going in power down mode */ 00138 Enable_interrupt(); 00139 00140 // Shutdown board ressources 00141 Led_all_off(); 00142 Disable_ale(); 00143 if (!usb_connected) 00144 { 00145 Usb_suspend_action(); // see in conf_usb.h 00146 _nop_(); 00147 } 00148 } 00149 else //USB Connected 00150 { 00151 // USB MANAGEMENT 00152 00153 Set_page_usb (); 00154 00155 Usb_select_endpoint(EP_CONTROL); 00156 if (Is_usb_receive_setup()) 00157 { 00158 usb_process_request(); 00159 if(SetControlBytes.type==0) { usb_continuous_mode = FALSE; } 00160 if(SetControlBytes.type==1) { usb_continuous_mode = TRUE ; } 00161 00162 } 00166 00167 if(usb_continuous_mode == TRUE) 00168 { 00169 Usb_select_endpoint(EP_HID_IN); 00170 if(Is_usb_in_ready()) 00171 { 00172 send_free = 1; 00173 Usb_ack_in_ready(); 00174 } 00175 } 00176 00180 } 00181 }


Generated on Mon Apr 10 17:23:31 2006 for Atmel by doxygen 1.3.7