Defines | |
| #define | ATTACHED 0 |
| #define | POWERED 1 |
| #define | DEFAULT 2 |
| #define | ADDRESSED 3 |
| #define | CONFIGURED 4 |
| #define | SUSPENDED 5 |
| #define | USB_CONFIG_ATTRIBUTES_RESERVED 0x80 |
| #define | USB_CONFIG_BUSPOWERED (USB_CONFIG_ATTRIBUTES_RESERVED | 0x00) |
| #define | USB_CONFIG_SELFPOWERED (USB_CONFIG_ATTRIBUTES_RESERVED | 0x40) |
| #define | USB_CONFIG_REMOTEWAKEUP (USB_CONFIG_ATTRIBUTES_RESERVED | 0x20) |
| #define | USB_REMOTE_WAKEUP 1 |
| #define | OTG_B_HNP_ENABLE 3 |
| #define | OTG_A_HNP_SUPPORT 4 |
| #define | OTG_A_ALT_HNP_SUPPORT 5 |
| #define | Is_device_enumerated() ((usb_configuration_nb!=0) ? TRUE : FALSE) |
| Returns true when device connected and correctly enumerated with an host. | |
| #define | Is_device_not_enumerated() ((usb_configuration_nb!=0) ? FALSE : TRUE) |
| #define | Is_host_supports_hnp() (((otg_features_supported&OTG_A_HNP_SUPPORT) != 0) ? TRUE : FALSE) |
| Returns the OTG features sent by the host by a SetFeature Allow also to clear the features (only on a bus Reset or Session End). | |
| #define | Is_host_requested_hnp() (((otg_features_supported&OTG_B_HNP_ENABLE) != 0) ? TRUE : FALSE) |
| #define | Clear_otg_features_from_host() (otg_features_supported = 0) |
Functions | |
| void | usb_process_request (void) |
| This function reads the SETUP request sent to the default control endpoint and calls the appropriate function. | |
Variables | |
| U8 | usb_configuration_nb |
| Public : (U8) usb_configuration_nb Store the number of the USB configuration used by the USB device when its value is different from zero, it means the device mode is enumerated Used with USB_DEVICE_FEATURE == ENABLED only /. | |
| U8 | otg_device_nb_hnp_retry |
| Public : (U8) otg_device_nb_hnp_retry; Counts the number of times a HNP fails, before aborting the operations. | |
| #define ATTACHED 0 |
Definition at line 41 of file usb_standard_request.h.
| #define POWERED 1 |
Definition at line 42 of file usb_standard_request.h.
| #define DEFAULT 2 |
Definition at line 43 of file usb_standard_request.h.
| #define ADDRESSED 3 |
Definition at line 44 of file usb_standard_request.h.
| #define CONFIGURED 4 |
Definition at line 45 of file usb_standard_request.h.
| #define SUSPENDED 5 |
Definition at line 46 of file usb_standard_request.h.
| #define USB_CONFIG_ATTRIBUTES_RESERVED 0x80 |
Definition at line 48 of file usb_standard_request.h.
| #define USB_CONFIG_BUSPOWERED (USB_CONFIG_ATTRIBUTES_RESERVED | 0x00) |
Definition at line 49 of file usb_standard_request.h.
| #define USB_CONFIG_SELFPOWERED (USB_CONFIG_ATTRIBUTES_RESERVED | 0x40) |
Definition at line 50 of file usb_standard_request.h.
| #define USB_CONFIG_REMOTEWAKEUP (USB_CONFIG_ATTRIBUTES_RESERVED | 0x20) |
| #define USB_REMOTE_WAKEUP 1 |
| #define OTG_B_HNP_ENABLE 3 |
Definition at line 54 of file usb_standard_request.h.
Referenced by usb_general_interrupt(), and usb_set_feature().
| #define OTG_A_HNP_SUPPORT 4 |
| #define OTG_A_ALT_HNP_SUPPORT 5 |
| #define Is_device_enumerated | ( | ) | ((usb_configuration_nb!=0) ? TRUE : FALSE) |
Returns true when device connected and correctly enumerated with an host.
The device high level application should tests this before performing any applicative requests
Definition at line 63 of file usb_standard_request.h.
| #define Is_device_not_enumerated | ( | ) | ((usb_configuration_nb!=0) ? FALSE : TRUE) |
Definition at line 64 of file usb_standard_request.h.
| #define Is_host_supports_hnp | ( | ) | (((otg_features_supported&OTG_A_HNP_SUPPORT) != 0) ? TRUE : FALSE) |
Returns the OTG features sent by the host by a SetFeature Allow also to clear the features (only on a bus Reset or Session End).
Definition at line 68 of file usb_standard_request.h.
| #define Is_host_requested_hnp | ( | ) | (((otg_features_supported&OTG_B_HNP_ENABLE) != 0) ? TRUE : FALSE) |
| #define Clear_otg_features_from_host | ( | ) | (otg_features_supported = 0) |
Definition at line 70 of file usb_standard_request.h.
Referenced by usb_device_task(), usb_device_task_init(), and usb_general_interrupt().
| void usb_process_request | ( | void | ) |
This function reads the SETUP request sent to the default control endpoint and calls the appropriate function.
| none |
< un-supported request => call to user read request
Definition at line 95 of file usb_standard_request.c.
References bmRequestType, CLEAR_FEATURE, EVT_OTG_DEVICE_CONNECTED, FALSE, GET_CONFIGURATION, GET_DESCRIPTOR, GET_INTERFACE, GET_STATUS, Otg_send_event, RXOUTI, SET_ADDRESS, SET_CONFIGURATION, SET_DESCRIPTOR, SET_FEATURE, SET_INTERFACE, SYNCH_FRAME, Usb_ack_receive_setup, usb_clear_feature(), Usb_enable_stall_handshake, usb_get_configuration(), usb_get_descriptor(), usb_get_interface(), usb_get_status(), Usb_read_byte, usb_set_address(), usb_set_configuration(), usb_set_feature(), usb_set_interface(), and usb_user_read_request().
Referenced by usb_device_task().
00096 { 00097 U8 bmRequest; 00098 00099 UEINTX &= ~(1<<RXOUTI); 00100 00101 bmRequestType = Usb_read_byte(); 00102 bmRequest = Usb_read_byte(); 00103 00104 switch (bmRequest) 00105 { 00106 case GET_DESCRIPTOR: 00107 if (0x80 == bmRequestType) { usb_get_descriptor(); } 00108 else { usb_user_read_request(bmRequestType, bmRequest); } 00109 break; 00110 00111 case GET_CONFIGURATION: 00112 if (0x80 == bmRequestType) { usb_get_configuration(); } 00113 else { usb_user_read_request(bmRequestType, bmRequest); } 00114 break; 00115 00116 case SET_ADDRESS: 00117 if (0x00 == bmRequestType) { usb_set_address(); } 00118 else { usb_user_read_request(bmRequestType, bmRequest); } 00119 break; 00120 00121 case SET_CONFIGURATION: 00122 if (0x00 == bmRequestType) 00123 { 00124 usb_set_configuration(); 00125 #if (USB_OTG_FEATURE == ENABLED) 00126 Otg_send_event(EVT_OTG_DEVICE_CONNECTED); 00127 #endif 00128 } 00129 else { usb_user_read_request(bmRequestType, bmRequest); } 00130 break; 00131 00132 case CLEAR_FEATURE: 00133 if (0x02 >= bmRequestType) { usb_clear_feature(); } 00134 else { usb_user_read_request(bmRequestType, bmRequest); } 00135 break; 00136 00137 case SET_FEATURE: 00138 if (0x02 >= bmRequestType) { usb_set_feature(); } 00139 else { usb_user_read_request(bmRequestType, bmRequest); } 00140 break; 00141 00142 case GET_STATUS: 00143 if ((0x7F < bmRequestType) & (0x82 >= bmRequestType)) 00144 { usb_get_status(); } 00145 else { usb_user_read_request(bmRequestType, bmRequest); } 00146 break; 00147 00148 case GET_INTERFACE: 00149 if (bmRequestType == 0x81) { usb_get_interface(); } 00150 else { usb_user_read_request(bmRequestType, bmRequest); } 00151 break; 00152 00153 00154 case SET_INTERFACE: 00155 if (bmRequestType == 0x01) {usb_set_interface();} 00156 break; 00157 00158 case SET_DESCRIPTOR: 00159 case SYNCH_FRAME: 00160 default: 00161 if(usb_user_read_request(bmRequestType, bmRequest) == FALSE) 00162 { 00163 Usb_enable_stall_handshake(); 00164 Usb_ack_receive_setup(); 00165 return; 00166 } 00167 break; 00168 } 00169 }
Here is the call graph for this function:

Public : (U8) usb_configuration_nb Store the number of the USB configuration used by the USB device when its value is different from zero, it means the device mode is enumerated Used with USB_DEVICE_FEATURE == ENABLED only /.
Definition at line 70 of file usb_standard_request.c.
Public : (U8) otg_device_nb_hnp_retry; Counts the number of times a HNP fails, before aborting the operations.
Definition at line 169 of file usb_task.c.
Referenced by usb_general_interrupt(), usb_set_feature(), and usb_task_init().
1.5.1-p1