#include "config.h"
Include dependency graph for usb_specific_request.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
struct | S_usb_hid_report_descriptor |
Usb HID Report Descriptor. More... | |
Functions | |
Bool | usb_user_read_request (U8, U8) |
usb_user_read_request(type, request); | |
Bool | usb_user_get_descriptor (U8, U8) |
usb_user_get_descriptor. | |
void | usb_user_endpoint_init (U8) |
usb_user_endpoint_init.This function configures the endpoints. | |
void | hid_get_report (void) |
hid_get_report.This function manages hit get repport request. | |
void | hid_set_report (void) |
hid_set_report.This function manages hit set report request. | |
void | usb_hid_get_interface (void) |
usb_hid_get_interface.This function manages hid get interface request. | |
void | usb_hid_set_idle (void) |
usb_hid_set_idle.This function manages hid set idle request. | |
void | hid_get_hid_descriptor (void) |
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 |
|
usb_user_read_request(type, request); This function is called by the standard usb read request function when the Usb request is not supported. This function returns TRUE when the request is processed. This function returns FALSE if the request is not supported. In this case, a STALL handshake will be automatically sent by the standard usb read request function.
Definition at line 58 of file usb_specific_request.c. References FALSE, GET_DESCRIPTOR, GET_INTERFACE, HID, hid_get_hid_descriptor(), hid_get_report(), hid_set_report(), REPORT, SET_CONFIGURATION, SET_REPORT, TRUE, usb_hid_get_interface(), and Usb_read_byte. Referenced by usb_process_request(). 00059 { 00060 U8 descriptor_type ; 00061 U8 string_type ; 00062 00063 string_type = Usb_read_byte(); 00064 descriptor_type = Usb_read_byte(); 00065 switch(request) 00066 { 00067 case GET_DESCRIPTOR: 00068 00069 switch (descriptor_type) 00070 { 00071 case REPORT: 00072 hid_get_report(); 00073 return TRUE; 00074 break; 00075 00076 case HID: 00077 hid_get_hid_descriptor(); 00078 return TRUE; 00079 break; 00080 default: 00081 return FALSE; 00082 break; 00083 } 00084 break; 00085 case SET_CONFIGURATION: 00086 switch (descriptor_type) 00087 { 00088 case SET_REPORT: 00089 hid_set_report(); 00090 return TRUE; 00091 break; 00092 00093 default: 00094 return FALSE; 00095 break; 00096 } 00097 break; 00098 case GET_INTERFACE: 00099 // usb_hid_set_idle(); 00100 usb_hid_get_interface(); 00101 return TRUE; 00102 break; 00103 00104 default: 00105 return FALSE; 00106 break; 00107 00108 } 00109 return FALSE; 00110 }
Here is the call graph for this function: ![]() |
|
|
usb_user_endpoint_init.This function configures the endpoints.
Definition at line 122 of file usb_specific_request.c. References DIRECTION_IN, DIRECTION_OUT, EP_HID_IN, EP_HID_OUT, NYET_ENABLED, ONE_BANK, SIZE_8, TYPE_INTERRUPT, and usb_configure_endpoint. Referenced by usb_set_configuration(). 00123 { 00124 usb_configure_endpoint(EP_HID_IN, \ 00125 TYPE_INTERRUPT, \ 00126 DIRECTION_IN, \ 00127 SIZE_8, \ 00128 ONE_BANK, \ 00129 NYET_ENABLED); 00130 00131 usb_configure_endpoint(EP_HID_OUT, \ 00132 TYPE_INTERRUPT, \ 00133 DIRECTION_OUT, \ 00134 SIZE_8, \ 00135 ONE_BANK, \ 00136 NYET_ENABLED); 00137 00138 }
|
|
hid_get_report.This function manages hit get repport request.
< clear the receive setup flag < send only requested number of data < Send data until necessary < Check endpoint 0 size Definition at line 193 of file usb_specific_request.c. References data_to_transfer, EP_CONTROL_LENGTH, FALSE, Is_usb_read_control_enabled, Is_usb_receive_out, LSB, MSB, pbuffer, S_usb_hid_report_descriptor::report, TRUE, Usb_ack_receive_out, Usb_ack_receive_setup, usb_hid_report_descriptor, Usb_read_byte, Usb_send_control_in, Usb_write_byte, wInterface, and zlp. Referenced by usb_user_read_request(). 00194 { 00195 00196 U16 wLength; 00197 U8 nb_byte; 00198 bit zlp; 00199 00200 00201 00202 LSB(wInterface)=Usb_read_byte(); 00203 MSB(wInterface)=Usb_read_byte(); 00204 00205 data_to_transfer = sizeof(usb_hid_report_descriptor); 00206 pbuffer = &(usb_hid_report_descriptor.report[0]); 00207 00208 LSB(wLength) = Usb_read_byte(); 00209 MSB(wLength) = Usb_read_byte(); 00210 Usb_ack_receive_setup() ; 00211 00212 if (wLength > data_to_transfer) 00213 { 00214 if ((data_to_transfer % EP_CONTROL_LENGTH) == 0) { zlp = TRUE; } 00215 else { zlp = FALSE; } 00216 } 00217 else 00218 { 00219 data_to_transfer = (U8)wLength; 00220 } 00221 00222 while((data_to_transfer != 0) && (!Is_usb_receive_out())) 00223 { 00224 while(!Is_usb_read_control_enabled()); 00225 00226 nb_byte=0; 00227 while(data_to_transfer != 0) 00228 { 00229 if(nb_byte++==EP_CONTROL_LENGTH) 00230 { 00231 break; 00232 } 00233 #ifndef AVRGCC 00234 Usb_write_byte(*pbuffer++); 00235 #else // AVRGCC does not support point to PGM space 00236 #warning with avrgcc assumes devices descriptors are stored in the lower 64Kbytes of on-chip flash memory 00237 Usb_write_byte(pgm_read_byte_near((unsigned int)pbuffer++)); 00238 #endif 00239 data_to_transfer --; 00240 } 00241 Usb_send_control_in(); 00242 } 00243 00244 Usb_send_control_in(); 00245 00246 if(Is_usb_receive_out()) { Usb_ack_receive_out(); return; } 00247 if(zlp == TRUE) { Usb_send_control_in(); } 00248 00249 while(!Is_usb_receive_out()); 00250 Usb_ack_receive_out(); 00251 }
|
|
hid_set_report.This function manages hit set report request.
Definition at line 263 of file usb_specific_request.c. References Is_usb_receive_out, Usb_ack_receive_out, Usb_ack_receive_setup, and Usb_send_control_in. Referenced by usb_user_read_request(). 00264 { 00265 Usb_ack_receive_setup(); 00266 Usb_send_control_in(); 00267 00268 while(!Is_usb_receive_out()); 00269 Usb_ack_receive_out(); 00270 Usb_send_control_in(); 00271 00272 }
|
|
usb_hid_get_interface.This function manages hid get interface request.
Definition at line 306 of file usb_specific_request.c. References Is_usb_in_ready, LSB, MSB, Usb_ack_receive_setup, Usb_read_byte, Usb_send_control_in, and wInterface. Referenced by usb_user_read_request(). 00307 { 00308 U8 dummy; 00309 dummy = Usb_read_byte(); 00310 dummy = Usb_read_byte(); 00311 LSB(wInterface)=Usb_read_byte(); 00312 MSB(wInterface)=Usb_read_byte(); 00313 00314 Usb_ack_receive_setup(); 00315 00316 Usb_send_control_in(); /* send a ZLP for STATUS phase */ 00317 while(!Is_usb_in_ready()); 00318 }
|
|
usb_hid_set_idle.This function manages hid set idle request.
Definition at line 283 of file usb_specific_request.c. References Is_usb_in_ready, LSB, MSB, Usb_ack_receive_setup, Usb_read_byte, Usb_send_control_in, and wInterface. 00284 { 00285 U8 dummy; 00286 dummy = Usb_read_byte(); 00287 dummy = Usb_read_byte(); 00288 LSB(wInterface)=Usb_read_byte(); 00289 MSB(wInterface)=Usb_read_byte(); 00290 00291 Usb_ack_receive_setup(); 00292 00293 Usb_send_control_in(); /* send a ZLP for STATUS phase */ 00294 while(!Is_usb_in_ready()); 00295 }
|
|
Referenced by usb_user_read_request(). |
|
Definition at line 38 of file usb_descriptors.c. |
|
Definition at line 57 of file usb_descriptors.c. |
|
Definition at line 102 of file usb_descriptors.c. Referenced by usb_user_get_descriptor(). |
|
Definition at line 111 of file usb_descriptors.c. Referenced by usb_user_get_descriptor(). |
|
Definition at line 120 of file usb_descriptors.c. Referenced by usb_user_get_descriptor(). |
|
Definition at line 129 of file usb_descriptors.c. Referenced by usb_user_get_descriptor(). |