Defines | |
#define | ATTACHED 0 |
#define | POWERED 1 |
#define | DEFAULT 2 |
#define | ADDRESSED 3 |
#define | CONFIGURED 4 |
#define | SUSPENDED 5 |
#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) |
#define | Is_device_not_enumerated() ((usb_configuration_nb!=0) ? FALSE : TRUE) |
Functions | |
void | usb_process_request (void) |
void | usb_generate_remote_wakeup (void) |
This function manages the remote wake up generation. | |
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 |
U8 | f_get_serial_string |
#define ATTACHED 0 |
Definition at line 70 of file usb_standard_request.h.
#define POWERED 1 |
Definition at line 71 of file usb_standard_request.h.
#define DEFAULT 2 |
Definition at line 72 of file usb_standard_request.h.
#define ADDRESSED 3 |
Definition at line 73 of file usb_standard_request.h.
#define CONFIGURED 4 |
Definition at line 74 of file usb_standard_request.h.
#define SUSPENDED 5 |
Definition at line 75 of file usb_standard_request.h.
#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. The device high level application should tests this before performing any applicative requests
Definition at line 87 of file usb_standard_request.h.
Referenced by device_template_task().
#define Is_device_not_enumerated | ( | ) | ((usb_configuration_nb!=0) ? FALSE : TRUE) |
Definition at line 88 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. When exiting of the usb_read_request function, the device is ready to manage the next request.
If the received request is not supported or a none USB standard request, the function will call for custom decoding function in usb_specific_request module.
none |
Definition at line 109 of file usb_standard_request.c.
References endpoint_status, EP_CONTROL, MSK_EP_DIR, SETUP_CLEAR_FEATURE, SETUP_GET_CONFIGURATION, SETUP_GET_DESCRIPTOR, SETUP_GET_INTERFACE, SETUP_GET_STATUS, SETUP_SET_ADDRESS, SETUP_SET_CONFIGURATION, SETUP_SET_FEATURE, SETUP_SET_INTERFACE, 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(), USB_SETUP_GET_STAND_DEVICE, USB_SETUP_GET_STAND_INTERFACE, USB_SETUP_SET_STAND_DEVICE, USB_SETUP_SET_STAND_INTERFACE, and usb_user_read_request().
00110 { 00111 U8 bmRequestType; 00112 U8 bmRequest; 00113 00114 Usb_ack_control_out(); 00115 bmRequestType = Usb_read_byte(); 00116 bmRequest = Usb_read_byte(); 00117 00118 switch (bmRequest) 00119 { 00120 case SETUP_GET_DESCRIPTOR: 00121 if (USB_SETUP_GET_STAND_DEVICE == bmRequestType) 00122 { 00123 if( usb_get_descriptor() ) 00124 return; 00125 } 00126 break; 00127 00128 case SETUP_GET_CONFIGURATION: 00129 if (USB_SETUP_GET_STAND_DEVICE == bmRequestType) 00130 { 00131 usb_get_configuration(); 00132 return; 00133 } 00134 break; 00135 00136 case SETUP_SET_ADDRESS: 00137 if (USB_SETUP_SET_STAND_DEVICE == bmRequestType) 00138 { 00139 usb_set_address(); 00140 return; 00141 } 00142 break; 00143 00144 case SETUP_SET_CONFIGURATION: 00145 if (USB_SETUP_SET_STAND_DEVICE == bmRequestType) 00146 { 00147 if( usb_set_configuration() ) 00148 return; 00149 } 00150 break; 00151 00152 case SETUP_CLEAR_FEATURE: 00153 if (usb_clear_feature(bmRequestType)) 00154 return; 00155 break; 00156 00157 case SETUP_SET_FEATURE: 00158 if (usb_set_feature(bmRequestType)) 00159 return; 00160 break; 00161 00162 case SETUP_GET_STATUS: 00163 if (usb_get_status(bmRequestType)) 00164 return; 00165 break; 00166 00167 case SETUP_GET_INTERFACE: 00168 if (USB_SETUP_GET_STAND_INTERFACE == bmRequestType) 00169 { 00170 if( usb_get_interface() ) 00171 return; 00172 } 00173 break; 00174 00175 case SETUP_SET_INTERFACE: 00176 if (bmRequestType == USB_SETUP_SET_STAND_INTERFACE) 00177 { 00178 if( usb_set_interface() ) 00179 return; 00180 } 00181 break; 00182 00183 default: 00184 break; 00185 } 00186 00187 // un-supported like standard request => call to user read request 00188 if( !usb_user_read_request(bmRequestType, bmRequest) ) 00189 { 00190 // Request unknow in the specific request list from interface 00191 // keep that order (set StallRq/clear RxSetup) or a 00192 // OUT request following the SETUP may be acknowledged 00193 Usb_enable_stall_handshake(); 00194 Usb_ack_receive_setup(); 00195 endpoint_status[(EP_CONTROL & MSK_EP_DIR)] = 0x01; 00196 } 00197 }
void usb_generate_remote_wakeup | ( | void | ) |
This function manages the remote wake up generation.
This function manages the remote wakeup generation to wake up the host controlle.
If the received request is not supported or a none USB standard request, the function will call for custom decoding function in usb_specific_request module.
none |
Definition at line 645 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.
00646 { 00647 if(Is_pll_ready()==FALSE) 00648 { 00649 Pll_start_auto(); 00650 Wait_pll_ready(); 00651 } 00652 Usb_unfreeze_clock(); 00653 if (remote_wakeup_feature == ENABLED) 00654 { 00655 Usb_initiate_remote_wake_up(); 00656 remote_wakeup_feature = DISABLED; 00657 } 00658 }
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 100 of file usb_standard_request.c.
Definition at line 101 of file usb_standard_request.c.
Definition at line 84 of file usb_standard_request.c.