/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_get_configuration * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_get_configuration ( /* [IN] usb device */ _usb_device_instance_handle dev_handle, /* [OUT] configuration value */ uchar_ptr buffer ) { /* Body */ USB_SETUP request = req_prototype; USB_STATUS error = USB_OK; #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_get_configuration"); #endif USB_lock(); request.BMREQUESTTYPE = REQ_TYPE_DEVICE | REQ_TYPE_IN; request.BREQUEST = REQ_GET_CONFIGURATION; *(uint_16*)request.WLENGTH = HOST_TO_LE_SHORT_CONST(1); error = usb_host_ch9_dev_req(dev_handle, &request, buffer); USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_get_configuration, SUCCESSFUL"); #endif return USB_log_error(__FILE__,__LINE__,error); } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_get_descriptor * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_get_descriptor ( /* usb device */ _usb_device_instance_handle dev_handle, /* descriptor type & index */ uint_16 type_index, /* Language ID or 0 */ uint_16 lang_id, /* buffer length */ uint_16 buflen, /* descriptor buffer */ uchar_ptr buffer ) { /* Body */ USB_SETUP request; USB_STATUS error = USB_OK; USB_lock(); request.BMREQUESTTYPE = REQ_TYPE_DEVICE | REQ_TYPE_IN; request.BREQUEST = REQ_GET_DESCRIPTOR; htou16(request.WVALUE, type_index); htou16(request.WINDEX, lang_id); htou16(request.WLENGTH, buflen); error = usb_host_ch9_dev_req(dev_handle, &request, buffer); USB_unlock(); return error; } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_set_address * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_set_address ( /* usb device */ _usb_device_instance_handle dev_handle ) { /* Body */ DEV_INSTANCE_PTR dev_ptr = (DEV_INSTANCE_PTR)dev_handle; USB_SETUP request = req_prototype; USB_STATUS error = USB_OK; #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_set_address"); #endif USB_lock(); request.BMREQUESTTYPE = REQ_TYPE_DEVICE | REQ_TYPE_OUT; request.BREQUEST = REQ_SET_ADDRESS; *(uint_16*)request.WVALUE = HOST_TO_LE_SHORT(dev_ptr->address); error = usb_host_ch9_dev_req(dev_handle, &request, NULL); USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_set_address,SUCCESSFUL"); #endif return USB_log_error(__FILE__,__LINE__,error); } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_synch_frame * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_synch_frame ( /* usb device */ _usb_device_instance_handle dev_handle, /* interface index */ uint_8 interface, /* configuration buffer */ uchar_ptr buffer ) { /* Body */ USB_SETUP request = req_prototype; USB_STATUS error = USB_OK; USB_lock(); request.BMREQUESTTYPE = REQ_TYPE_ENDPOINT | REQ_TYPE_IN; request.BREQUEST = REQ_SYNCH_FRAME; htou16(request.WINDEX, interface); htou16(request.WLENGTH, 2); error = usb_host_ch9_dev_req(dev_handle, &request, buffer); USB_unlock(); return error; } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_set_configuration * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_set_configuration ( /* usb device */ _usb_device_instance_handle dev_handle, /* configuration value */ uint_16 config ) { /* Body */ USB_SETUP request = req_prototype; USB_STATUS error = USB_OK; #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_set_configuration"); #endif USB_lock(); request.BMREQUESTTYPE = REQ_TYPE_DEVICE | REQ_TYPE_OUT; request.BREQUEST = REQ_SET_CONFIGURATION; *(uint_16*)request.WVALUE = HOST_TO_LE_SHORT(config); error = usb_host_ch9_dev_req(dev_handle, &request, NULL); USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_set_configuration SUCCESSFUL"); #endif return USB_log_error(__FILE__,__LINE__,error); } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_set_interface * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_set_interface ( /* usb device */ _usb_device_instance_handle dev_handle, /* alternate setting */ uint_8 alternate, /* interface */ uint_8 intf ) { /* Body */ USB_SETUP request = req_prototype; USB_STATUS error = USB_OK; USB_lock(); request.BMREQUESTTYPE = REQ_TYPE_INTERFACE | REQ_TYPE_OUT; request.BREQUEST = REQ_SET_INTERFACE; htou16(request.WVALUE, alternate); htou16(request.WINDEX, intf); error = usb_host_ch9_dev_req(dev_handle, &request, NULL); USB_unlock(); return error; } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_set_configuration * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_set_configuration ( /* usb device */ _usb_device_instance_handle dev_handle, /* configuration value */ uint_16 config ) { /* Body */ USB_SETUP request = req_prototype; USB_STATUS error = USB_OK; USB_lock(); request.BMREQUESTTYPE = REQ_TYPE_DEVICE | REQ_TYPE_OUT; request.BREQUEST = REQ_SET_CONFIGURATION; htou16(request.WVALUE, config); error = usb_host_ch9_dev_req(dev_handle, &request, NULL); USB_unlock(); return error; } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_get_interface * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_get_interface ( /* usb device */ _usb_device_instance_handle dev_handle, /* interface index */ uint_8 interface, /* alternate setting buffer */ uchar_ptr buffer ) { /* Body */ USB_SETUP request = req_prototype; USB_STATUS error = USB_OK; USB_lock(); request.BMREQUESTTYPE = REQ_TYPE_INTERFACE | REQ_TYPE_IN; request.BREQUEST = REQ_GET_INTERFACE; htou16(request.WINDEX, interface); htou16(request.WLENGTH, 1); error = usb_host_ch9_dev_req(dev_handle, &request, buffer); USB_unlock(); return error; } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_get_configuration * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_get_configuration ( /* [IN] usb device */ _usb_device_instance_handle dev_handle, /* [OUT] configuration value */ uchar_ptr buffer ) { /* Body */ USB_SETUP request = req_prototype; USB_STATUS error = USB_OK; USB_lock(); request.BMREQUESTTYPE = REQ_TYPE_DEVICE | REQ_TYPE_IN; request.BREQUEST = REQ_GET_CONFIGURATION; htou16(request.WLENGTH, 1); error = usb_host_ch9_dev_req(dev_handle, &request, buffer); USB_unlock(); return error; } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_clear_feature * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_clear_feature ( /* usb device */ _usb_device_instance_handle dev_handle, /* request type device/interface/endpoint */ uint_8 req_type, /* device = 0, or interface/endpoint */ uint_8 intf_endpt, /* feature selection */ uint_16 feature ) { /* Body */ USB_SETUP request = req_prototype; USB_STATUS error = USB_OK; #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_clear_feature"); #endif USB_lock(); switch (req_type) { case REQ_TYPE_DEVICE: break; case REQ_TYPE_INTERFACE: case REQ_TYPE_ENDPOINT: *(uint_16*)request.WINDEX = HOST_TO_LE_SHORT(intf_endpt); break; default: USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_clear_feature, invalid request"); #endif return USB_log_error(__FILE__,__LINE__,USBERR_INVALID_BMREQ_TYPE); } /* EndSwitch */ request.BMREQUESTTYPE = (uchar)(req_type | REQ_TYPE_OUT); request.BREQUEST = REQ_CLEAR_FEATURE; *(uint_16*)request.WVALUE = HOST_TO_LE_SHORT(feature); error = usb_host_ch9_dev_req(dev_handle, &request, NULL); USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_clear_feature, SUCCESSFUL"); #endif return USB_log_error(__FILE__,__LINE__,error); } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_get_status * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_get_status ( /* usb device */ _usb_device_instance_handle dev_handle, /* request type device/interface/endpoint */ uint_8 req_type, /* device = 0, or interface/endpoint */ uint_8 intf_endpt, /* returned status */ uchar_ptr buffer ) { /* Body */ USB_SETUP request = req_prototype; USB_STATUS error = USB_OK; #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_get_status"); #endif USB_lock(); switch (req_type) { case REQ_TYPE_DEVICE: case REQ_TYPE_INTERFACE: case REQ_TYPE_ENDPOINT: break; default: USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_get_status, invalid parameter"); #endif return USB_log_error(__FILE__,__LINE__,USBERR_INVALID_BMREQ_TYPE); } /* EndSwitch */ request.BMREQUESTTYPE = (uchar)(req_type | REQ_TYPE_IN); request.BREQUEST = REQ_GET_STATUS; *(uint_16*)request.WINDEX = HOST_TO_LE_SHORT(intf_endpt); *(uint_16*)request.WLENGTH = HOST_TO_LE_SHORT_CONST(2); error = usb_host_ch9_dev_req(dev_handle, &request, buffer); USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_get_status, SUCCESSFUL"); #endif return USB_log_error(__FILE__,__LINE__,error); } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_set_feature * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ usb_status _usb_host_ch9_set_feature ( /* usb device */ usb_device_instance_handle dev_handle, /* request type device/interface/endpoint */ uint8_t req_type, /* device = 0, or interface/endpoint */ uint8_t intf_endpt, /* feature selection */ uint16_t feature ) { /* Body */ usb_setup_t request = req_prototype; usb_status error = USB_OK; #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_set_feature"); #endif switch (req_type) { case REQ_TYPE_DEVICE: break; case REQ_TYPE_INTERFACE: case REQ_TYPE_ENDPOINT: *(uint16_t*)request.windex = USB_HOST_TO_LE_SHORT(intf_endpt); break; default: OS_Unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_set_feature, invalid param"); #endif return USB_log_error(__FILE__,__LINE__,USBERR_INVALID_BMREQ_TYPE); } /* EndSwitch */ request.bmrequesttype = (uint8_t)(req_type | REQ_TYPE_OUT); request.brequest = REQ_SET_FEATURE; *(uint16_t*)request.wvalue = USB_HOST_TO_LE_SHORT(feature); error = usb_host_ch9_dev_req(dev_handle, &request, NULL); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_set_feature, SUCCESSFUL"); #endif return USB_log_error(__FILE__,__LINE__,error); } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_clear_feature * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_clear_feature ( /* usb device */ _usb_device_instance_handle dev_handle, /* request type device/interface/endpoint */ uint_8 req_type, /* device = 0, or interface/endpoint */ uint_8 intf_endpt, /* feature selection */ uint_16 feature ) { /* Body */ USB_SETUP request = req_prototype; USB_STATUS error = USB_OK; USB_lock(); switch (req_type) { case REQ_TYPE_DEVICE: break; case REQ_TYPE_INTERFACE: case REQ_TYPE_ENDPOINT: htou16(request.WINDEX, intf_endpt); break; default: USB_unlock(); return USBERR_INVALID_BMREQ_TYPE; } /* EndSwitch */ request.BMREQUESTTYPE = (uchar)(req_type | REQ_TYPE_OUT); request.BREQUEST = REQ_CLEAR_FEATURE; htou16(request.WVALUE, feature); error = usb_host_ch9_dev_req(dev_handle, &request, NULL); USB_unlock(); return error; } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_set_descriptor * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_set_descriptor ( /* usb device */ _usb_device_instance_handle dev_handle, /* descriptor type & index */ uint_16 type_index, /* Language ID or 0 */ uint_16 lang_id, /* buffer length */ uint_16 buflen, /* descriptor buffer */ uchar_ptr buffer ) { /* Body */ USB_SETUP request; USB_STATUS error = USB_OK; #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_set_descriptor"); #endif USB_lock(); request.BMREQUESTTYPE = REQ_TYPE_DEVICE | REQ_TYPE_OUT; request.BREQUEST = REQ_SET_DESCRIPTOR; *(uint_16*)request.WVALUE = HOST_TO_LE_SHORT(type_index); *(uint_16*)request.WINDEX = HOST_TO_LE_SHORT(lang_id); *(uint_16*)request.WLENGTH = HOST_TO_LE_SHORT(buflen); error = usb_host_ch9_dev_req(dev_handle, &request, buffer); USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_set_descriptor SUCCESSFUL"); #endif return USB_log_error(__FILE__,__LINE__,error); } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_get_status * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ usb_status _usb_host_ch9_get_status ( /* usb device */ usb_device_instance_handle dev_handle, /* request type device/interface/endpoint */ uint8_t req_type, /* device = 0, or interface/endpoint */ uint16_t intf_endpt, /* returned status */ uint8_t * buffer ) { /* Body */ usb_setup_t request = req_prototype; usb_status error = USB_OK; #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_get_status"); #endif switch (req_type) { case REQ_TYPE_DEVICE: case REQ_TYPE_INTERFACE: case REQ_TYPE_ENDPOINT: break; default: #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_get_status, invalid parameter"); #endif return USB_log_error(__FILE__,__LINE__,USBERR_INVALID_BMREQ_TYPE); } /* EndSwitch */ request.bmrequesttype = (uint8_t)(req_type | REQ_TYPE_IN); request.brequest = REQ_GET_STATUS; *(uint16_t*)request.windex = USB_HOST_TO_LE_SHORT(intf_endpt); *(uint16_t*)request.wlength = USB_HOST_TO_LE_SHORT_CONST(2); error = usb_host_ch9_dev_req(dev_handle, &request, buffer); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_get_status, SUCCESSFUL"); #endif return USB_log_error(__FILE__,__LINE__,error); } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_get_status * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_get_status ( /* usb device */ _usb_device_instance_handle dev_handle, /* request type device/interface/endpoint */ uint_8 req_type, /* device = 0, or interface/endpoint */ uint_8 intf_endpt, /* returned status */ uchar_ptr buffer ) { /* Body */ USB_SETUP request = req_prototype; USB_STATUS error = USB_OK; USB_lock(); switch (req_type) { case REQ_TYPE_DEVICE: case REQ_TYPE_INTERFACE: case REQ_TYPE_ENDPOINT: break; default: USB_unlock(); return USBERR_INVALID_BMREQ_TYPE; } /* EndSwitch */ request.BMREQUESTTYPE = (uchar)(req_type | REQ_TYPE_IN); request.BREQUEST = REQ_GET_STATUS; htou16(request.WINDEX, intf_endpt); htou16(request.WLENGTH, 2); error = usb_host_ch9_dev_req(dev_handle, &request, buffer); USB_unlock(); return error; } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_set_interface * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_set_interface ( /* usb device */ _usb_device_instance_handle dev_handle, /* alternate setting */ uint_8 alternate, /* interface */ uint_8 intf ) { /* Body */ USB_SETUP request = req_prototype; USB_STATUS error = USB_OK; #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_set_interface"); #endif USB_lock(); request.BMREQUESTTYPE = REQ_TYPE_INTERFACE | REQ_TYPE_OUT; request.BREQUEST = REQ_SET_INTERFACE; *(uint_16*)request.WVALUE = HOST_TO_LE_SHORT(alternate); *(uint_16*)request.WINDEX = HOST_TO_LE_SHORT(intf); error = usb_host_ch9_dev_req(dev_handle, &request, NULL); USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_set_interface, SUCCESSFUL"); #endif return USB_log_error(__FILE__,__LINE__,error); } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_get_interface * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_get_interface ( /* usb device */ _usb_device_instance_handle dev_handle, /* interface index */ uint_8 interface, /* alternate setting buffer */ uchar_ptr buffer ) { /* Body */ USB_SETUP request = req_prototype; USB_STATUS error = USB_OK; #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_get_interface"); #endif USB_lock(); request.BMREQUESTTYPE = REQ_TYPE_INTERFACE | REQ_TYPE_IN; request.BREQUEST = REQ_GET_INTERFACE; *(uint_16*)request.WINDEX = HOST_TO_LE_SHORT(interface); *(uint_16*)request.WLENGTH = HOST_TO_LE_SHORT_CONST(1); error = usb_host_ch9_dev_req(dev_handle, &request, buffer); USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_get_interface, SUCCESSFUL"); #endif return USB_log_error(__FILE__,__LINE__,error); } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_synch_frame * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_synch_frame ( /* usb device */ _usb_device_instance_handle dev_handle, /* interface index */ uint_8 interface, /* configuration buffer */ uchar_ptr buffer ) { /* Body */ USB_SETUP request = req_prototype; USB_STATUS error = USB_OK; #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_synch_frame"); #endif USB_lock(); request.BMREQUESTTYPE = REQ_TYPE_ENDPOINT | REQ_TYPE_IN; request.BREQUEST = REQ_SYNCH_FRAME; *(uint_16*)request.WINDEX = HOST_TO_LE_SHORT(interface); *(uint_16*)request.WLENGTH = HOST_TO_LE_SHORT_CONST(2); error = usb_host_ch9_dev_req(dev_handle, &request, buffer); USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_ch9_synch_frame, SUCCESSFUL"); #endif return USB_log_error(__FILE__,__LINE__,error); } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : _usb_host_ch9_set_address * Returned Value : USB_OK, or error status * Comments : * Function to process standard device request in Chapter 9. * See Table 9-3 p. 250 of USB 2.0 specification. * *END*--------------------------------------------------------------------*/ USB_STATUS _usb_host_ch9_set_address ( /* usb device */ _usb_device_instance_handle dev_handle ) { /* Body */ DEV_INSTANCE_PTR dev_ptr = (DEV_INSTANCE_PTR)dev_handle; USB_SETUP request = req_prototype; USB_STATUS error = USB_OK; USB_lock(); request.BMREQUESTTYPE = REQ_TYPE_DEVICE | REQ_TYPE_OUT; request.BREQUEST = REQ_SET_ADDRESS; htou16(request.WVALUE, dev_ptr->address); error = usb_host_ch9_dev_req(dev_handle, &request, NULL); USB_unlock(); return error; } /* EndBody */