USB device specific requests


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.


Function Documentation

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 endpoints configuration).

This function is called when the set configuration request has been received.

Definition at line 78 of file usb_specific_request.c.

References DIRECTION_IN, DIRECTION_OUT, EP_ATTRIBUTES_TEMP1, EP_ATTRIBUTES_TEMP2, EP_SIZE_TEMP1, EP_SIZE_TEMP2, EP_TEMP_IN, EP_TEMP_OUT, SINGLE_BANK, and Usb_configure_endpoint.

Referenced by usb_set_configuration().

00079 {
00080   (void)Usb_configure_endpoint(EP_TEMP_IN,
00081                                EP_ATTRIBUTES_TEMP1,
00082                                DIRECTION_IN,
00083                                EP_SIZE_TEMP1,
00084                                SINGLE_BANK);
00085 
00086   (void)Usb_configure_endpoint(EP_TEMP_OUT,
00087                                EP_ATTRIBUTES_TEMP2,
00088                                DIRECTION_OUT,
00089                                EP_SIZE_TEMP2,
00090                                SINGLE_BANK);
00091 }

Bool usb_user_get_descriptor ( U8  ,
U8   
)

This function returns the size and the pointer on a user information structure.

Definition at line 137 of file usb_specific_request.c.

References data_to_transfer, LANG_ID, MAN_INDEX, pbuffer, PROD_INDEX, SN_INDEX, STRING_DESCRIPTOR, usb_user_language_id, usb_user_manufacturer_string_descriptor, usb_user_product_string_descriptor, and usb_user_serial_number.

Referenced by usb_get_descriptor().

00138 {
00139   pbuffer = NULL;
00140 
00141   switch (type)
00142   {
00143   case STRING_DESCRIPTOR:
00144     switch (string)
00145     {
00146     case LANG_ID:
00147       data_to_transfer = sizeof(usb_user_language_id);
00148       pbuffer = &usb_user_language_id;
00149       break;
00150 
00151     case MAN_INDEX:
00152       data_to_transfer = sizeof(usb_user_manufacturer_string_descriptor);
00153       pbuffer = &usb_user_manufacturer_string_descriptor;
00154       break;
00155 
00156     case PROD_INDEX:
00157       data_to_transfer = sizeof(usb_user_product_string_descriptor);
00158       pbuffer = &usb_user_product_string_descriptor;
00159       break;
00160 
00161     case SN_INDEX:
00162       data_to_transfer = sizeof(usb_user_serial_number);
00163       pbuffer = &usb_user_serial_number;
00164       break;
00165 
00166     default:
00167       break;
00168     }
00169     break;
00170 
00171   default:
00172     break;
00173   }
00174 
00175   return pbuffer != NULL;
00176 }

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 100 of file usb_specific_request.c.

References EP_CONTROL, GET_DESCRIPTOR, SET_CONFIGURATION, and Usb_read_endpoint_data.

Referenced by usb_process_request().

00101 {
00102   U8 descriptor_type;
00103   U8 string_type;
00104 
00105   string_type     = Usb_read_endpoint_data(EP_CONTROL, 8);
00106   descriptor_type = Usb_read_endpoint_data(EP_CONTROL, 8);
00107 
00108   switch (request)
00109   {
00110   case GET_DESCRIPTOR:
00111     switch (descriptor_type)
00112     {
00113     default:
00114       break;
00115     }
00116     break;
00117 
00118   case SET_CONFIGURATION:
00119     switch (descriptor_type)
00120     {
00121     default:
00122       break;
00123     }
00124     break;
00125 
00126   default:
00127     break;
00128   }
00129 
00130   return FALSE;
00131 }


Generated on Fri Feb 19 02:27:53 2010 for AVR32 - USB Enumeration Example by  doxygen 1.5.5