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_STATUS_REMOTEWAKEUP 0x02 |
#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) |
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 /. |
#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) |
Definition at line 51 of file usb_standard_request.h.
#define USB_STATUS_REMOTEWAKEUP 0x02 |
Definition at line 53 of file usb_standard_request.h.
Referenced by usb_clear_feature(), and usb_set_feature().
#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 59 of file usb_standard_request.h.
Referenced by cdc_task().
#define Is_device_not_enumerated | ( | ) | ((usb_configuration_nb!=0) ? FALSE : TRUE) |
Definition at line 60 of file usb_standard_request.h.
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 97 of file usb_standard_request.c.
References bmRequestType, CLEAR_FEATURE, FALSE, GET_CONFIGURATION, GET_DESCRIPTOR, GET_INTERFACE, GET_STATUS, 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().
00098 { 00099 U8 bmRequest; 00100 00101 UEINTX &= ~(1<<RXOUTI); 00102 00103 bmRequestType = Usb_read_byte(); 00104 bmRequest = Usb_read_byte(); 00105 00106 switch (bmRequest) 00107 { 00108 case GET_DESCRIPTOR: 00109 if (0x80 == bmRequestType) { usb_get_descriptor(); } 00110 else { usb_user_read_request(bmRequestType, bmRequest); } 00111 break; 00112 00113 case GET_CONFIGURATION: 00114 if (0x80 == bmRequestType) { usb_get_configuration(); } 00115 else { usb_user_read_request(bmRequestType, bmRequest); } 00116 break; 00117 00118 case SET_ADDRESS: 00119 if (0x00 == bmRequestType) { usb_set_address(); } 00120 else { usb_user_read_request(bmRequestType, bmRequest); } 00121 break; 00122 00123 case SET_CONFIGURATION: 00124 if (0x00 == bmRequestType) { usb_set_configuration(); } 00125 else { usb_user_read_request(bmRequestType, bmRequest); } 00126 break; 00127 00128 case CLEAR_FEATURE: 00129 if (0x02 >= bmRequestType) { usb_clear_feature(); } 00130 else { usb_user_read_request(bmRequestType, bmRequest); } 00131 break; 00132 00133 case SET_FEATURE: 00134 if (0x02 >= bmRequestType) { usb_set_feature(); } 00135 else { usb_user_read_request(bmRequestType, bmRequest); } 00136 break; 00137 00138 case GET_STATUS: 00139 if ((0x7F < bmRequestType) & (0x82 >= bmRequestType)) 00140 { usb_get_status(); } 00141 else { usb_user_read_request(bmRequestType, bmRequest); } 00142 break; 00143 00144 case GET_INTERFACE: 00145 if (bmRequestType == 0x81) { usb_get_interface(); } 00146 else { usb_user_read_request(bmRequestType, bmRequest); } 00147 break; 00148 00149 00150 case SET_INTERFACE: 00151 if (bmRequestType == 0x01) {usb_set_interface();} 00152 break; 00153 00154 case SET_DESCRIPTOR: 00155 case SYNCH_FRAME: 00156 default: 00157 if(usb_user_read_request(bmRequestType, bmRequest) == FALSE) 00158 { 00159 Usb_enable_stall_handshake(); 00160 Usb_ack_receive_setup(); 00161 return; 00162 } 00163 break; 00164 } 00165 }
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 71 of file usb_standard_request.c.