#include "config.h"
Go to the source code of this file.
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 77 of file usb_specific_request.c.
References FALSE, SETUP_GET_DESCRIPTOR, Usb_read_byte, USB_SETUP_GET_CLASS_INTER, USB_SETUP_GET_STAND_INTERFACE, and USB_SETUP_SET_CLASS_INTER.
00078 { 00079 U8 wValue_msb; 00080 U8 wValue_lsb; 00081 00082 // Read wValue 00083 wValue_lsb = Usb_read_byte(); 00084 wValue_msb = Usb_read_byte(); 00085 00086 //** Specific request from Class 00087 if( USB_SETUP_GET_STAND_INTERFACE == type ) 00088 { 00089 switch( request ) 00090 { 00091 case SETUP_GET_DESCRIPTOR: 00092 switch( wValue_msb ) // Descriptor ID 00093 { 00094 default: 00095 // TODO 00096 break; 00097 } 00098 break; 00099 } 00100 } 00101 if( USB_SETUP_SET_CLASS_INTER == type ) 00102 { 00103 switch( request ) 00104 { 00105 default: 00106 break; 00107 } 00108 } 00109 if( USB_SETUP_GET_CLASS_INTER == type ) 00110 { 00111 switch( request ) 00112 { 00113 default: 00114 break; 00115 } 00116 } 00117 return FALSE; // No supported request 00118 }
void usb_user_endpoint_init | ( | U8 | conf_nb | ) |
This function configures the endpoints
conf_nb | configuration number choosed by USB host |
Definition at line 125 of file usb_specific_request.c.
References DIRECTION_IN, DIRECTION_OUT, EP_TEMP_IN, EP_TEMP_INT_IN, EP_TEMP_OUT, NYET_ENABLED, ONE_BANK, SIZE_64, TYPE_BULK, TYPE_INTERRUPT, and usb_configure_endpoint.
00126 { 00127 usb_configure_endpoint(EP_TEMP_IN, \ 00128 TYPE_BULK, \ 00129 DIRECTION_IN, \ 00130 SIZE_64, \ 00131 ONE_BANK, \ 00132 NYET_ENABLED); 00133 usb_configure_endpoint(EP_TEMP_OUT, \ 00134 TYPE_BULK, \ 00135 DIRECTION_OUT, \ 00136 SIZE_64, \ 00137 ONE_BANK, \ 00138 NYET_ENABLED); 00139 usb_configure_endpoint(EP_TEMP_INT_IN,\ 00140 TYPE_BULK, \ 00141 TYPE_INTERRUPT,\ 00142 SIZE_64, \ 00143 ONE_BANK, \ 00144 NYET_ENABLED); 00145 }
This function returns the interface alternate setting
wInterface | Interface selected |
Definition at line 154 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 165 of file usb_specific_request.c.
References EP_TEMP_IN, EP_TEMP_INT_IN, EP_TEMP_OUT, INTERFACE_NB_SECOND_TEMP, INTERFACE_NB_TEMP, Usb_disable_stall_handshake, Usb_reset_data_toggle, Usb_reset_endpoint, and Usb_select_endpoint.
00166 { 00167 // default setting selected = reset data toggle 00168 if( INTERFACE_NB_TEMP == wInterface ) 00169 { 00170 // Interface reset 00171 Usb_select_endpoint(EP_TEMP_IN); 00172 Usb_disable_stall_handshake(); 00173 Usb_reset_endpoint(EP_TEMP_IN); 00174 Usb_reset_data_toggle(); 00175 Usb_select_endpoint(EP_TEMP_OUT); 00176 Usb_disable_stall_handshake(); 00177 Usb_reset_endpoint(EP_TEMP_OUT); 00178 Usb_reset_data_toggle(); 00179 } 00180 if( INTERFACE_NB_SECOND_TEMP == wInterface ) 00181 { 00182 // Interface reset 00183 Usb_select_endpoint(EP_TEMP_INT_IN); 00184 Usb_disable_stall_handshake(); 00185 Usb_reset_endpoint(EP_TEMP_INT_IN); 00186 Usb_reset_data_toggle(); 00187 } 00188 }
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 198 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.
00199 { 00200 switch(type) 00201 { 00202 case DESCRIPTOR_STRING: 00203 switch (string) 00204 { 00205 case LANG_ID: 00206 data_to_transfer = sizeof (usb_user_language_id); 00207 pbuffer = &(usb_user_language_id.bLength); 00208 return TRUE; 00209 break; 00210 00211 case MAN_INDEX: 00212 data_to_transfer = sizeof (usb_user_manufacturer_string_descriptor); 00213 pbuffer = &(usb_user_manufacturer_string_descriptor.bLength); 00214 return TRUE; 00215 break; 00216 00217 case PROD_INDEX: 00218 data_to_transfer = sizeof (usb_user_product_string_descriptor); 00219 pbuffer = &(usb_user_product_string_descriptor.bLength); 00220 return TRUE; 00221 break; 00222 00223 #if (USB_DEVICE_SN_USE==ENABLE) 00224 case SN_INDEX: 00225 data_to_transfer = sizeof (usb_user_serial_number); 00226 pbuffer = &(usb_user_serial_number.bLength); 00227 #if (USE_DEVICE_SN_UNIQUE==ENABLE) 00228 f_get_serial_string=TRUE; 00229 data_to_transfer += (SN_LENGTH*4); 00230 #endif 00231 return TRUE; 00232 break; 00233 #endif 00234 } 00235 break; 00236 } 00237 return FALSE; 00238 }
Definition at line 66 of file usb_descriptors.c.
Definition at line 85 of file usb_descriptors.c.
Definition at line 151 of file usb_descriptors.c.
Definition at line 160 of file usb_descriptors.c.
Definition at line 169 of file usb_descriptors.c.
Definition at line 183 of file usb_descriptors.c.