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 | USB_REMOTE_WAKEUP 1 |
#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. | |
void | usb_generate_remote_wakeup (void) |
This function manages the remote wakeup generation to wake up the host controlle. | |
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 | remote_wakeup_feature |
#define ATTACHED 0 |
Definition at line 67 of file usb_standard_request.h.
#define POWERED 1 |
Definition at line 68 of file usb_standard_request.h.
#define DEFAULT 2 |
Definition at line 69 of file usb_standard_request.h.
#define ADDRESSED 3 |
Definition at line 70 of file usb_standard_request.h.
#define CONFIGURED 4 |
Definition at line 71 of file usb_standard_request.h.
#define SUSPENDED 5 |
Definition at line 72 of file usb_standard_request.h.
#define USB_CONFIG_ATTRIBUTES_RESERVED 0x80 |
Definition at line 74 of file usb_standard_request.h.
#define USB_CONFIG_BUSPOWERED (USB_CONFIG_ATTRIBUTES_RESERVED | 0x00) |
Definition at line 75 of file usb_standard_request.h.
#define USB_CONFIG_SELFPOWERED (USB_CONFIG_ATTRIBUTES_RESERVED | 0x40) |
Definition at line 76 of file usb_standard_request.h.
#define USB_CONFIG_REMOTEWAKEUP (USB_CONFIG_ATTRIBUTES_RESERVED | 0x20) |
Definition at line 77 of file usb_standard_request.h.
#define USB_STATUS_REMOTEWAKEUP 0x02 |
Definition at line 79 of file usb_standard_request.h.
Referenced by usb_clear_feature(), and usb_set_feature().
#define USB_REMOTE_WAKEUP 1 |
#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 86 of file usb_standard_request.h.
Referenced by cdc_rf_task().
#define Is_device_not_enumerated | ( | ) | ((usb_configuration_nb!=0) ? FALSE : TRUE) |
Definition at line 87 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 128 of file usb_standard_request.c.
References bmRequestType, CLEAR_FEATURE, FALSE, GET_CONFIGURATION, GET_DESCRIPTOR, GET_INTERFACE, GET_STATUS, SET_ADDRESS, SET_CONFIGURATION, SET_DESCRIPTOR, SET_FEATURE, SET_INTERFACE, SYNCH_FRAME, Usb_ack_control_out, 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().
00129 { 00130 U8 bmRequest; 00131 00132 Usb_ack_control_out(); 00133 bmRequestType = Usb_read_byte(); 00134 bmRequest = Usb_read_byte(); 00135 00136 switch (bmRequest) 00137 { 00138 case GET_DESCRIPTOR: 00139 if (0x80 == bmRequestType) { usb_get_descriptor(); } 00140 else { usb_user_read_request(bmRequestType, bmRequest); } 00141 break; 00142 00143 case GET_CONFIGURATION: 00144 if (0x80 == bmRequestType) { usb_get_configuration(); } 00145 else { usb_user_read_request(bmRequestType, bmRequest); } 00146 break; 00147 00148 case SET_ADDRESS: 00149 if (0x00 == bmRequestType) { usb_set_address(); } 00150 else { usb_user_read_request(bmRequestType, bmRequest); } 00151 break; 00152 00153 case SET_CONFIGURATION: 00154 if (0x00 == bmRequestType) { usb_set_configuration(); } 00155 else { usb_user_read_request(bmRequestType, bmRequest); } 00156 break; 00157 00158 case CLEAR_FEATURE: 00159 if (0x02 >= bmRequestType) { usb_clear_feature(); } 00160 else { usb_user_read_request(bmRequestType, bmRequest); } 00161 break; 00162 00163 case SET_FEATURE: 00164 if (0x02 >= bmRequestType) { usb_set_feature(); } 00165 else { usb_user_read_request(bmRequestType, bmRequest); } 00166 break; 00167 00168 case GET_STATUS: 00169 if ((0x7F < bmRequestType) & (0x82 >= bmRequestType)) 00170 { usb_get_status(); } 00171 else { usb_user_read_request(bmRequestType, bmRequest); } 00172 break; 00173 00174 case GET_INTERFACE: 00175 if (bmRequestType == 0x81) { usb_get_interface(); } 00176 else { usb_user_read_request(bmRequestType, bmRequest); } 00177 break; 00178 00179 00180 case SET_INTERFACE: 00181 if (bmRequestType == 0x01) {usb_set_interface();} 00182 break; 00183 00184 case SET_DESCRIPTOR: 00185 case SYNCH_FRAME: 00186 default: 00187 if(usb_user_read_request(bmRequestType, bmRequest) == FALSE) 00188 { 00189 Usb_enable_stall_handshake(); 00190 Usb_ack_receive_setup(); 00191 return; 00192 } 00193 break; 00194 } 00195 }
Here is the call graph for this function:
Here is the caller graph for this function:
void usb_generate_remote_wakeup | ( | void | ) |
This function manages the remote wakeup generation to wake up the host controlle.
This function manages the remote wake up generation
none |
Definition at line 668 of file usb_standard_request.c.
References DISABLED, ENABLED, FALSE, Is_pll_ready, remote_wakeup_feature, Usb_initiate_remote_wake_up, Usb_unfreeze_clock, and Wait_pll_ready.
00669 { 00670 if(Is_pll_ready()==FALSE) 00671 { 00672 Pll_start_auto(); 00673 Wait_pll_ready(); 00674 } 00675 Usb_unfreeze_clock(); 00676 if (remote_wakeup_feature == ENABLED) 00677 { 00678 Usb_initiate_remote_wake_up(); 00679 remote_wakeup_feature = DISABLED; 00680 } 00681 }
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 102 of file usb_standard_request.c.
Definition at line 101 of file usb_standard_request.c.