Functions | |
void | usb_user_endpoint_init (U8) |
This function configures the endpoints of the device application. | |
Bool | usb_user_get_descriptor (U8, U8) |
This function returns the size and the pointer on a user information structure. | |
Bool | usb_user_read_request (U8, U8) |
This function is called by the standard USB read request function when the USB request is not supported. |
void usb_user_endpoint_init | ( | U8 | conf_nb | ) |
This function configures the endpoints of the device application.
This function is called when the set configuration request has been received.
The core of this function should be correctly rewritten depending on the USB device application characteristics (the USB device application has specific endpoint configuration).
This function is called when the set configuration request has been received.
Definition at line 83 of file usb_specific_request.c.
References EP_ATTRIBUTES_1, EP_ATTRIBUTES_2, EP_ATTRIBUTES_3, EP_ATTRIBUTES_4, EP_FC_IN, EP_FC_OUT, EP_MS_IN, EP_MS_OUT, EP_SIZE_1, EP_SIZE_2, EP_SIZE_3, EP_SIZE_4, and ms_multiple_drive.
00084 { 00085 ms_multiple_drive = FALSE; 00086 00087 (void)Usb_configure_endpoint(EP_FC_IN, 00088 EP_ATTRIBUTES_1, 00089 DIRECTION_IN, 00090 EP_SIZE_1, 00091 SINGLE_BANK); 00092 00093 (void)Usb_configure_endpoint(EP_FC_OUT, 00094 EP_ATTRIBUTES_2, 00095 DIRECTION_OUT, 00096 EP_SIZE_2, 00097 SINGLE_BANK); 00098 00099 #if( EVK1101_CTRL_PANEL_PID==EVK1101_CTRL_PANEL_DEMO_HID_MS_PID ) 00100 (void)Usb_configure_endpoint(EP_MS_IN, 00101 EP_ATTRIBUTES_3, 00102 DIRECTION_IN, 00103 EP_SIZE_3, 00104 SINGLE_BANK); 00105 00106 (void)Usb_configure_endpoint(EP_MS_OUT, 00107 EP_ATTRIBUTES_4, 00108 DIRECTION_OUT, 00109 EP_SIZE_4, 00110 SINGLE_BANK); 00111 #endif 00112 }
Bool usb_user_get_descriptor | ( | U8 | , | |
U8 | ||||
) |
This function returns the size and the pointer on a user information structure.
Definition at line 182 of file usb_specific_request.c.
References data_to_transfer, LANG_ID, MAN_INDEX, pbuffer, PROD_INDEX, SN_INDEX, usb_user_language_id, usb_user_manufacturer_string_descriptor, usb_user_product_string_descriptor, and usb_user_serial_number.
00183 { 00184 pbuffer = NULL; 00185 00186 switch (type) 00187 { 00188 case STRING_DESCRIPTOR: 00189 switch (string) 00190 { 00191 case LANG_ID: 00192 data_to_transfer = sizeof(usb_user_language_id); 00193 pbuffer = &usb_user_language_id; 00194 break; 00195 00196 case MAN_INDEX: 00197 data_to_transfer = sizeof(usb_user_manufacturer_string_descriptor); 00198 pbuffer = &usb_user_manufacturer_string_descriptor; 00199 break; 00200 00201 case PROD_INDEX: 00202 data_to_transfer = sizeof(usb_user_product_string_descriptor); 00203 pbuffer = &usb_user_product_string_descriptor; 00204 break; 00205 00206 case SN_INDEX: 00207 data_to_transfer = sizeof(usb_user_serial_number); 00208 pbuffer = &usb_user_serial_number; 00209 break; 00210 00211 default: 00212 break; 00213 } 00214 break; 00215 00216 default: 00217 break; 00218 } 00219 00220 return pbuffer != NULL; 00221 }
Bool usb_user_read_request | ( | U8 | type, | |
U8 | 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 121 of file usb_specific_request.c.
References GET_MAX_LUN, MASS_STORAGE_RESET, and ms_multiple_drive.
00122 { 00123 Usb_read_endpoint_data(EP_CONTROL, 8); // string_type 00124 Usb_read_endpoint_data(EP_CONTROL, 8); // descriptor_type 00125 00126 switch (request) 00127 { 00128 #if( EVK1101_CTRL_PANEL_PID==EVK1101_CTRL_PANEL_DEMO_HID_MS_PID ) 00129 case MASS_STORAGE_RESET: 00130 Usb_ack_setup_received_free(); 00131 Usb_ack_control_in_ready_send(); 00132 return TRUE; 00133 00134 case GET_MAX_LUN: 00135 Usb_ack_setup_received_free(); 00136 Usb_reset_endpoint_fifo_access(EP_CONTROL); 00137 Usb_write_endpoint_data(EP_CONTROL, 8, get_nb_lun() - 1); 00138 Usb_ack_control_in_ready_send(); 00139 while (!Is_usb_control_in_ready()); 00140 00141 while(!Is_usb_control_out_received()); 00142 Usb_ack_control_out_received_free(); 00143 ms_multiple_drive = TRUE; 00144 return TRUE; 00145 #endif 00146 00147 /* 00148 case HID_SET_REPORT: 00149 switch (descriptor_type) 00150 { 00151 case HID_REPORT_OUTPUT: 00152 Usb_ack_setup_received_free(); 00153 while (!Is_usb_control_out_received()); 00154 Usb_ack_control_out_received_free(); 00155 Usb_ack_control_in_ready_send(); 00156 while (!Is_usb_control_in_ready()); 00157 return TRUE; 00158 00159 default: 00160 break; 00161 } 00162 break; 00163 00164 case HID_SET_IDLE: 00165 Usb_ack_setup_received_free(); 00166 Usb_ack_control_in_ready_send(); 00167 while (!Is_usb_control_in_ready()); 00168 return TRUE; 00169 */ 00170 00171 default: 00172 break; 00173 } 00174 00175 return FALSE; 00176 }