#include "config.h"
Go to the source code of this file.
Data Structures | |
| struct | S_usb_hid_report_descriptor_mouse |
| Usb HID Report Descriptor Mouse. More... | |
Functions | |
| Bool | usb_user_read_request (U8, U8) |
| This function checks the specific request and if known then processes it | |
| void | usb_user_endpoint_init (U8) |
| U8 | usb_user_interface_get (U16 wInterface) |
| void | usb_user_interface_reset (U16 wInterface, U8 alternate_setting) |
| Bool | usb_user_get_descriptor (U8, U8) |
| This function fills the global descriptor. | |
Variables | |
| code S_usb_device_descriptor | usb_dev_desc |
| code S_usb_user_configuration_descriptor | usb_conf_desc |
| code S_usb_manufacturer_string_descriptor | usb_user_manufacturer_string_descriptor |
| code S_usb_product_string_descriptor | usb_user_product_string_descriptor |
| code S_usb_serial_number | usb_user_serial_number |
| code S_usb_language_id | usb_user_language_id |
Definition in file usb_specific_request.h.
This function checks the specific request and if known then processes it
| type | corresponding at bmRequestType (see USB specification) | |
| request | corresponding at bRequest (see USB specification) |
FALSE, if the request is'nt know (STALL handshake is managed by the main standard request function).
Definition at line 86 of file usb_specific_request.c.
References DESCRIPTOR_HID, DESCRIPTOR_PHYSICAL, DESCRIPTOR_REPORT, FALSE, hid_get_hid_descriptor(), hid_get_report_descriptor(), REPORT_TYPE_FEATURE, REPORT_TYPE_INPUT, REPORT_TYPE_OUTPUT, SETUP_GET_DESCRIPTOR, SETUP_HID_GET_IDLE, SETUP_HID_GET_PROTOCOL, SETUP_HID_GET_REPORT, SETUP_HID_SET_IDLE, SETUP_HID_SET_PROTOCOL, SETUP_HID_SET_REPORT, TRUE, usb_hid_get_idle(), usb_hid_set_idle(), usb_hid_set_report_ouput(), Usb_read_byte, USB_SETUP_GET_CLASS_INTER, USB_SETUP_GET_STAND_INTERFACE, and USB_SETUP_SET_CLASS_INTER.
00087 { 00088 U8 wValue_msb; 00089 U8 wValue_lsb; 00090 00091 // Read wValue 00092 wValue_lsb = Usb_read_byte(); 00093 wValue_msb = Usb_read_byte(); 00094 00095 //** Specific request from Class HID 00096 if( USB_SETUP_GET_STAND_INTERFACE == type ) 00097 { 00098 switch( request ) 00099 { 00100 case SETUP_GET_DESCRIPTOR: 00101 switch( wValue_msb ) // Descriptor ID 00102 { 00103 case DESCRIPTOR_HID: 00104 hid_get_hid_descriptor(); 00105 return TRUE; 00106 break; 00107 00108 case DESCRIPTOR_REPORT: 00109 hid_get_report_descriptor(); 00110 return TRUE; 00111 00112 case DESCRIPTOR_PHYSICAL: 00113 // TODO 00114 break; 00115 } 00116 break; 00117 } 00118 } 00119 if( USB_SETUP_SET_CLASS_INTER == type ) 00120 { 00121 switch( request ) 00122 { 00123 case SETUP_HID_SET_REPORT: 00124 // The MSB wValue field specifies the Report Type 00125 // The LSB wValue field specifies the Report ID 00126 switch (wValue_msb) 00127 { 00128 case REPORT_TYPE_INPUT: 00129 // TODO 00130 break; 00131 00132 case REPORT_TYPE_OUTPUT: 00133 usb_hid_set_report_ouput(); 00134 return TRUE; 00135 break; 00136 00137 case REPORT_TYPE_FEATURE: 00138 break; 00139 } 00140 break; 00141 00142 case SETUP_HID_SET_IDLE: 00143 usb_hid_set_idle(wValue_lsb,wValue_msb); 00144 return TRUE; 00145 00146 case SETUP_HID_SET_PROTOCOL: 00147 // TODO 00148 break; 00149 } 00150 } 00151 if( USB_SETUP_GET_CLASS_INTER == type ) 00152 { 00153 switch( request ) 00154 { 00155 case SETUP_HID_GET_REPORT: 00156 // TODO 00157 break; 00158 case SETUP_HID_GET_IDLE: 00159 usb_hid_get_idle(wValue_lsb); 00160 return TRUE; 00161 case SETUP_HID_GET_PROTOCOL: 00162 // TODO 00163 break; 00164 } 00165 } 00166 return FALSE; // No supported request 00167 }
| void usb_user_endpoint_init | ( | U8 | conf_nb | ) |
This function configures the endpoints
| conf_nb | configuration number choosed by USB host |
Definition at line 174 of file usb_specific_request.c.
References DIRECTION_IN, EP_MOUSE_IN, NYET_ENABLED, ONE_BANK, SIZE_8, TYPE_INTERRUPT, and usb_configure_endpoint.
00175 { 00176 usb_configure_endpoint( EP_MOUSE_IN, \ 00177 TYPE_INTERRUPT,\ 00178 DIRECTION_IN, \ 00179 SIZE_8, \ 00180 ONE_BANK, \ 00181 NYET_ENABLED); 00182 }
This function returns the interface alternate setting
| wInterface | Interface selected |
Definition at line 191 of file usb_specific_request.c.
This function selects (and resets) the interface alternate setting
| wInterface | Interface selected | |
| alternate_setting | alternate setting selected |
Definition at line 202 of file usb_specific_request.c.
References EP_MOUSE_IN, INTERFACE_NB_MOUSE, Usb_disable_stall_handshake, Usb_reset_data_toggle, Usb_reset_endpoint, and Usb_select_endpoint.
00203 { 00204 // default setting selected = reset data toggle 00205 if( INTERFACE_NB_MOUSE == wInterface ) 00206 { 00207 // Interface mouse 00208 Usb_select_endpoint(EP_MOUSE_IN); 00209 Usb_disable_stall_handshake(); 00210 Usb_reset_endpoint(EP_MOUSE_IN); 00211 Usb_reset_data_toggle(); 00212 } 00213 }
This function fills the global descriptor.
| type | corresponding at MSB of wValue (see USB specification) | |
| string | corresponding at LSB of wValue (see USB specification) |
Definition at line 223 of file usb_specific_request.c.
References S_usb_serial_number::bLength, S_usb_product_string_descriptor::bLength, S_usb_manufacturer_string_descriptor::bLength, S_usb_language_id::bLength, data_to_transfer, DESCRIPTOR_STRING, f_get_serial_string, FALSE, LANG_ID, MAN_INDEX, pbuffer, PROD_INDEX, SN_INDEX, TRUE, usb_user_language_id, usb_user_manufacturer_string_descriptor, usb_user_product_string_descriptor, and usb_user_serial_number.
00224 { 00225 switch(type) 00226 { 00227 case DESCRIPTOR_STRING: 00228 switch (string) 00229 { 00230 case LANG_ID: 00231 data_to_transfer = sizeof (usb_user_language_id); 00232 pbuffer = &(usb_user_language_id.bLength); 00233 return TRUE; 00234 break; 00235 00236 case MAN_INDEX: 00237 data_to_transfer = sizeof (usb_user_manufacturer_string_descriptor); 00238 pbuffer = &(usb_user_manufacturer_string_descriptor.bLength); 00239 return TRUE; 00240 break; 00241 00242 case PROD_INDEX: 00243 data_to_transfer = sizeof (usb_user_product_string_descriptor); 00244 pbuffer = &(usb_user_product_string_descriptor.bLength); 00245 return TRUE; 00246 break; 00247 00248 #if (USB_DEVICE_SN_USE==ENABLE) 00249 case SN_INDEX: 00250 data_to_transfer = sizeof (usb_user_serial_number); 00251 pbuffer = &(usb_user_serial_number.bLength); 00252 #if (USE_DEVICE_SN_UNIQUE==ENABLE) 00253 f_get_serial_string=TRUE; 00254 data_to_transfer += (SN_LENGTH*4); 00255 #endif 00256 return TRUE; 00257 break; 00258 #endif 00259 } 00260 break; 00261 } 00262 return FALSE; 00263 }
Definition at line 66 of file usb_descriptors.c.
Definition at line 85 of file usb_descriptors.c.
Definition at line 132 of file usb_descriptors.c.
Definition at line 141 of file usb_descriptors.c.
Definition at line 150 of file usb_descriptors.c.
Definition at line 164 of file usb_descriptors.c.
1.5.3