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.
conf_nb | Unused. |
Definition at line 83 of file usb_specific_request.c.
References EP_ATTRIBUTES_1, EP_ATTRIBUTES_2, EP_MS_IN, EP_MS_OUT, EP_SIZE_1, EP_SIZE_2, and ms_multiple_drive.
00084 { 00085 ms_multiple_drive = FALSE; 00086 00087 (void)Usb_configure_endpoint(EP_MS_IN, 00088 EP_ATTRIBUTES_1, 00089 DIRECTION_IN, 00090 EP_SIZE_1, 00091 DOUBLE_BANK); 00092 00093 (void)Usb_configure_endpoint(EP_MS_OUT, 00094 EP_ATTRIBUTES_2, 00095 DIRECTION_OUT, 00096 EP_SIZE_2, 00097 DOUBLE_BANK); 00098 }
Bool usb_user_get_descriptor | ( | U8 | type, | |
U8 | string | |||
) |
This function returns the size and the pointer on a user information structure.
type | The type of the descriptor | |
string | The requested descriptor id |
Definition at line 168 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, 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.
00169 { 00170 pbuffer = NULL; 00171 00172 switch (type) 00173 { 00174 case STRING_DESCRIPTOR: 00175 switch (string) 00176 { 00177 case LANG_ID: 00178 data_to_transfer = sizeof(usb_user_language_id); 00179 pbuffer = &usb_user_language_id.bLength; 00180 break; 00181 00182 case MAN_INDEX: 00183 data_to_transfer = sizeof(usb_user_manufacturer_string_descriptor); 00184 pbuffer = &usb_user_manufacturer_string_descriptor.bLength; 00185 break; 00186 00187 case PROD_INDEX: 00188 data_to_transfer = sizeof(usb_user_product_string_descriptor); 00189 pbuffer = &usb_user_product_string_descriptor.bLength; 00190 break; 00191 00192 case SN_INDEX: 00193 data_to_transfer = sizeof(usb_user_serial_number); 00194 pbuffer = &usb_user_serial_number.bLength; 00195 break; 00196 00197 default: 00198 break; 00199 } 00200 break; 00201 00202 default: 00203 break; 00204 } 00205 00206 return pbuffer != NULL; 00207 }
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.
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.
type | Unused | |
request | The USB request id |
Definition at line 110 of file usb_specific_request.c.
References GET_MAX_LUN, MASS_STORAGE_RESET, and ms_multiple_drive.
00111 { 00112 U8 descriptor_type; 00113 U8 string_type; 00114 00115 string_type = Usb_read_endpoint_data(EP_CONTROL, 8); 00116 descriptor_type = Usb_read_endpoint_data(EP_CONTROL, 8); 00117 00118 switch (request) 00119 { 00120 case GET_DESCRIPTOR: 00121 switch (descriptor_type) 00122 { 00123 default: 00124 break; 00125 } 00126 break; 00127 00128 case SET_CONFIGURATION: 00129 switch (descriptor_type) 00130 { 00131 default: 00132 break; 00133 } 00134 break; 00135 00136 case MASS_STORAGE_RESET: 00137 Usb_ack_setup_received_free(); 00138 Usb_ack_control_in_ready_send(); 00139 return TRUE; 00140 00141 case GET_MAX_LUN: 00142 Usb_ack_setup_received_free(); 00143 Usb_reset_endpoint_fifo_access(EP_CONTROL); 00144 Usb_write_endpoint_data(EP_CONTROL, 8, get_nb_lun() - 1); 00145 Usb_ack_control_in_ready_send(); 00146 while (!Is_usb_control_in_ready()); 00147 00148 while(!Is_usb_control_out_received()); 00149 Usb_ack_control_out_received_free(); 00150 00151 ms_multiple_drive = TRUE; 00152 return TRUE; 00153 00154 default: 00155 break; 00156 } 00157 00158 return FALSE; 00159 }