本文整理汇总了C++中USB_unlock函数的典型用法代码示例。如果您正苦于以下问题:C++ USB_unlock函数的具体用法?C++ USB_unlock怎么用?C++ USB_unlock使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了USB_unlock函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: USB_lock
/*FUNCTION*----------------------------------------------------------------
*
* Function Name : _usb_host_register_ch9_callback
* Returned Value : USB_OK, or error status
* Comments :
* This function registers a callback function that will be called
* to notify the user of a ch9 command completion. This should be used
* only after enumeration is completed
*
*END*--------------------------------------------------------------------*/
USB_STATUS _usb_host_register_ch9_callback
(
/* usb device */
_usb_device_instance_handle dev_handle,
/* Callback upon completion */
tr_callback callback,
/* User provided callback param */
pointer callback_param
)
{ /* Body */
DEV_INSTANCE_PTR dev_inst_ptr;
USB_STATUS error;
/* Verify that device handle is valid */
USB_lock();
error = usb_hostdev_validate(dev_handle);
if (error != USB_OK) {
USB_unlock();
return USBERR_DEVICE_NOT_FOUND;
} /* Endif */
dev_inst_ptr = (DEV_INSTANCE_PTR)dev_handle;
/* This will be called if the device is already enumerated */
dev_inst_ptr->control_callback = callback;
dev_inst_ptr->control_callback_param = callback_param;
USB_unlock();
return USB_OK;
} /* EndBody */
示例2: USB_lock
/*FUNCTION*----------------------------------------------------------------
*
* Function Name : _usb_device_call_service
* Returned Value : USB_OK or error code
* Comments :
* Calls the appropriate service for the specified type, if one is
* registered. Used internally only.
*
*END*--------------------------------------------------------------------*/
USB_STATUS _usb_device_call_service
(
/* [IN] Type of service or endpoint */
uint_8 type,
/* [IN] pointer to event structure */
PTR_USB_EVENT_STRUCT event
)
{ /* Body */
USB_DEV_STATE_STRUCT_PTR usb_dev_ptr;
SERVICE_STRUCT _PTR_ service_ptr;
usb_dev_ptr = (USB_DEV_STATE_STRUCT_PTR)event->handle;
/* Needs mutual exclusion */
USB_lock();
/* Search for an existing entry for type */
for (service_ptr = usb_dev_ptr->SERVICE_HEAD_PTR;
service_ptr;
service_ptr = service_ptr->NEXT)
{
if (service_ptr->TYPE == type)
{
service_ptr->SERVICE(event,service_ptr->arg);
USB_unlock();
return USB_OK;
} /* Endif */
} /* Endfor */
USB_unlock();
return USBERR_CLOSED_SERVICE;
} /* EndBody */
示例3: DEBUG_LOG_TRACE
void usb_class_mass_init
(
/* [IN] structure with USB pipe information on the interface */
PIPE_BUNDLE_STRUCT_PTR pbs_ptr,
/* [IN] printer call struct pointer */
CLASS_CALL_STRUCT_PTR ccs_ptr
)
{ /* Body */
USB_MASS_CLASS_INTF_STRUCT_PTR intf_ptr = ccs_ptr->class_intf_handle;
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_class_mass_init");
#endif
/* pointer2 validity-checking, clear memory, init header of intf_ptr */
if (usb_host_class_intf_init(pbs_ptr, intf_ptr, &mass_anchor))
{
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_class_mass_init");
#endif
return;
}
USB_lock();
ccs_ptr->code_key = 0;
ccs_ptr->code_key = usb_host_class_intf_validate( ccs_ptr );
if (ccs_ptr->code_key == 0) goto Bad_Exit;
/* Start filling up the members of interface handle (general class already filled) */
intf_ptr->CONTROL_PIPE = usb_hostdev_get_pipe_handle(pbs_ptr,
USB_CONTROL_PIPE, 0);
intf_ptr->BULK_IN_PIPE = usb_hostdev_get_pipe_handle(pbs_ptr,
USB_BULK_PIPE, USB_RECV);
intf_ptr->BULK_OUT_PIPE = usb_hostdev_get_pipe_handle(pbs_ptr,
USB_BULK_PIPE, USB_SEND);
if (intf_ptr->CONTROL_PIPE &&
intf_ptr->BULK_IN_PIPE &&
intf_ptr->BULK_OUT_PIPE)
{
/* Initialize the queue for storing the local copy of interface handles */
usb_class_mass_q_init(intf_ptr);
USB_unlock();
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_class_mass_init, Q init failed");
#endif
return;
} /* Endif */
Bad_Exit:
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_class_mass_init, bad exit");
#endif
memset(intf_ptr, 0, sizeof(USB_MASS_CLASS_INTF_STRUCT_PTR));
ccs_ptr->class_intf_handle = NULL;
ccs_ptr->code_key = 0;
USB_unlock();
} /* Endbody */
示例4: USB_lock
/*FUNCTION*----------------------------------------------------------------
*
* Function Name : usb_audio_recv_data
* Returned Value : USB status
* Comments :
* Receive data on isochronous IN pipe.
*
*END*--------------------------------------------------------------------*/
USB_STATUS usb_audio_recv_data
(
/* [IN] class-interface control pointer */
CLASS_CALL_STRUCT_PTR control_ptr,
/* [IN] class-interface stream pointer */
CLASS_CALL_STRUCT_PTR stream_ptr,
/* [IN] callback upon completion */
tr_callback callback,
/* [IN] user parameter returned by callback */
void *call_parm,
/* [IN] data length */
uint32_t buf_size,
/* [IN] buffer pointer */
unsigned char *buffer
)
{ /* Body */
AUDIO_STREAM_INTERFACE_STRUCT_PTR stream_if_ptr;
AUDIO_CONTROL_INTERFACE_STRUCT_PTR control_if_ptr;
TR_INIT_PARAM_STRUCT tr;
USB_STATUS status = USBERR_NO_INTERFACE;
USB_lock();
/* Validity checking, always needed when passing data to lower API */
if (!usb_host_class_intf_validate(control_ptr)) {
USB_unlock();
return USBERR_NO_INTERFACE;
}
stream_if_ptr = (AUDIO_STREAM_INTERFACE_STRUCT_PTR) stream_ptr->class_intf_handle;
control_if_ptr = (AUDIO_CONTROL_INTERFACE_STRUCT_PTR) control_ptr->class_intf_handle;
/* Do the device use OUT pipe? */
if (stream_if_ptr->iso_in_pipe == NULL) {
USB_unlock();
return USBERR_OPEN_PIPE_FAILED;
}
/* Validity checking, always needed when passing data to lower API */
if (!usb_host_class_intf_validate(control_ptr)) {
USB_unlock();
return USBERR_NO_INTERFACE;
}
usb_hostdev_tr_init(&tr, (tr_callback) callback, (void *) call_parm);
tr.G.RX_BUFFER = (unsigned char *) buffer;
tr.G.RX_LENGTH = buf_size;
status = _usb_host_recv_data(control_if_ptr->AUDIO_G.G.host_handle,
stream_if_ptr->iso_in_pipe, &tr);
USB_unlock();
return status;
} /* Endbody */
示例5: DEBUG_LOG_TRACE
/*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 */
示例6: void
/*FUNCTION*----------------------------------------------------------------
*
* Function Name : _usb_device_register_service
* Returned Value : USB_OK or error code
* Comments :
* Registers a callback routine for a specified event or endpoint.
*
*END*--------------------------------------------------------------------*/
uint_8 _usb_device_register_service
(
/* [IN] Handle to the USB device */
_usb_device_handle handle,
/* [IN] type of event or endpoint number to service */
uint_8 type,
/* [IN] Pointer to the service's callback function */
void(_CODE_PTR_ service)(pointer, uint_8, boolean, uint_8, uint_8_ptr, uint_32, uint_8)
)
{ /* Body */
USB_DEV_STATE_STRUCT_PTR usb_dev_ptr;
SERVICE_STRUCT_PTR service_ptr;
SERVICE_STRUCT_PTR _PTR_ search_ptr;
int lockKey;
usb_dev_ptr = (USB_DEV_STATE_STRUCT_PTR)handle;
/* Needs mutual exclusion */
lockKey = USB_lock();
/* Search for an existing entry for type */
for (search_ptr = &usb_dev_ptr->SERVICE_HEAD_PTR;
*search_ptr;
search_ptr = &(*search_ptr)->NEXT)
{
if ((*search_ptr)->TYPE == type)
{
/* Found an existing entry */
USB_unlock(lockKey);
USB_printf("_usb_device_register_service, service %d already opened\n");
return USBERR_OPEN_SERVICE;
} /* Endif */
} /* Endfor */
/* No existing entry found - create a new one */
service_ptr = (SERVICE_STRUCT_PTR)USB_memalloc(sizeof(SERVICE_STRUCT));
if (!service_ptr)
{
USB_unlock(lockKey);
USB_printf("_usb_device_register_service, malloc for %d bytes failed\n",
sizeof(SERVICE_STRUCT));
return USBERR_ALLOC;
} /* Endif */
service_ptr->TYPE = type;
service_ptr->SERVICE = service;
service_ptr->NEXT = NULL;
*search_ptr = service_ptr;
USB_unlock(lockKey);
return USB_OK;
} /* EndBody */
示例7: USB_lock
/*FUNCTION*----------------------------------------------------------------
*
* Function Name : _usb_device_call_service
* Returned Value : USB_OK or error code
* Comments :
* Calls the appropriate service for the specified type, if one is
* registered. Used internally only.
*
*END*--------------------------------------------------------------------*/
uint_8 _usb_device_call_service
(
/* [IN] Handle to the USB device */
_usb_device_handle handle,
/* [OUT] Type of service or endpoint */
uint_8 type,
/* [OUT] Is it a Setup transfer? */
boolean setup,
/* [OUT] Direction of transmission; is it a Transmit? */
boolean direction,
/* [OUT] Pointer to the data */
uint_8_ptr buffer_ptr,
/* [OUT] Number of bytes in transmission */
uint_32 length,
/* [OUT] Any errors */
uint_8 errors
)
{ /* Body */
USB_DEV_STATE_STRUCT_PTR usb_dev_ptr;
SERVICE_STRUCT _PTR_ service_ptr;
int lockKey;
usb_dev_ptr = (USB_DEV_STATE_STRUCT_PTR)handle;
/* Needs mutual exclusion */
lockKey = USB_lock();
/* Search for an existing entry for type */
for (service_ptr = usb_dev_ptr->SERVICE_HEAD_PTR;
service_ptr;
service_ptr = service_ptr->NEXT)
{
if (service_ptr->TYPE == type)
{
service_ptr->SERVICE(handle, type, setup, direction, buffer_ptr, length, errors);
USB_unlock(lockKey);
return USB_OK;
} /* Endif */
} /* Endfor */
USB_unlock(lockKey);
ARC_DEBUG_TRACE(ARC_DEBUG_FLAG_CTRL, "_usb_device_call_service, service %d is closed\n", type);
return USBERR_CLOSED_SERVICE;
} /* EndBody */
示例8: DEBUG_LOG_TRACE
/*FUNCTION*----------------------------------------------------------------
*
* Function Name : _usb_host_unregister_service
* Returned Value : USB_OK or error code
* Comments :
* Unregisters a callback routine for a specified event or endpoint.
*
*END*--------------------------------------------------------------------*/
USB_STATUS _usb_host_unregister_service
(
/* [IN] Handle to the USB device */
_usb_host_handle handle,
/* [IN] type of event or endpoint number to service */
uint_8 type
)
{ /* Body */
USB_HOST_STATE_STRUCT_PTR usb_host_ptr;
USB_SERVICE_STRUCT_PTR service_ptr;
USB_SERVICE_STRUCT_PTR _PTR_ search_ptr;
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("_usb_host_unregister_service");
#endif
usb_host_ptr = (USB_HOST_STATE_STRUCT_PTR)handle;
/* Needs mutual exclusion */
USB_lock();
/* Search for an existing entry for type */
for (search_ptr = &usb_host_ptr->SERVICE_HEAD_PTR;
*search_ptr;
search_ptr = &(*search_ptr)->NEXT)
{
if ((*search_ptr)->TYPE == type) {
/* Found an existing entry - delete it */
break;
} /* Endif */
} /* Endfor */
/* No existing entry found */
if (!*search_ptr) {
USB_unlock();
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("_usb_host_unregister_service no service found");
#endif
return USB_log_error(__FILE__,__LINE__,USBERR_CLOSED_SERVICE);
} /* Endif */
service_ptr = *search_ptr;
*search_ptr = service_ptr->NEXT;
USB_unlock();
USB_mem_free((pointer)service_ptr);
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("_usb_host_unregister_service SUCCESSFUL");
#endif
return USB_OK;
} /* EndBody */
示例9: USB_lock
/*FUNCTION*-------------------------------------------------------------
*
* Function Name : _usb_host_send_data
* Returned Value : error or status of the transfer
* Comments :
* The Send Data routine is non-blocking routine that causes a block of data
* to be made available for transmission to the USB host.
*
*END*-----------------------------------------------------------------*/
uint_32 _usb_host_send_data
(
/* [IN] the USB Host state structure */
_usb_host_handle hci_handle,
/* [IN] the pipe handle */
_usb_pipe_handle pipe_handle,
/* [IN] transfer parameters */
TR_INIT_PARAM_STRUCT_PTR tr_params_ptr
)
{ /* Body */
PIPE_DESCRIPTOR_STRUCT_PTR pipe_descr_ptr;
USB_HOST_STATE_STRUCT_PTR usb_host_ptr;
uint_32 return_code;
PIPE_TR_STRUCT_PTR pipe_tr_ptr;
USB_lock();
return_code = _usb_host_set_up_TR(pipe_handle, tr_params_ptr, &pipe_tr_ptr);
if (return_code != USB_STATUS_TRANSFER_QUEUED) {
USB_unlock();
return return_code;
} /* Endif */
usb_host_ptr = (USB_HOST_STATE_STRUCT_PTR)hci_handle;
UNUSED(usb_host_ptr);
pipe_descr_ptr = (PIPE_DESCRIPTOR_STRUCT_PTR)pipe_handle;
/*Must Flush and Invalidate the buffer before sending
/receiving the data in it */
USB_dcache_flush_mlines((void *)pipe_tr_ptr->TX_BUFFER, pipe_tr_ptr->TX_LENGTH);
/* We have obtained the current TR on the Pipe's TR list
** from _usb_host_set_up_TR
*/
/* Call the low-level send routine */
return_code = _usb_host_send_call_interface (hci_handle, pipe_descr_ptr, pipe_tr_ptr);
USB_unlock();
if(return_code == USB_OK)
{
return USB_STATUS_TRANSFER_QUEUED;
}
else
{
return return_code;
}
} /* Endbody */
示例10: USB_lock
/*FUNCTION*----------------------------------------------------------------
*
* Function Name : usb_class_mass_get_app
* Returned Value : CLASS_CALL_STRUCT_PTR if class found
* Comments :
* This function returns stored application handle as it was passed as
* a param in select_interface.
*
*END*--------------------------------------------------------------------*/
USB_STATUS usb_class_mass_get_app
(
/* [IN] handle of device */
_usb_device_instance_handle dev_ptr,
/* [IN] pointer to interface descriptor */
_usb_interface_descriptor_handle intf_ptr,
/* [OUT] pointer to CLASS_CALL_STRUCT to be filled in */
CLASS_CALL_STRUCT_PTR _PTR_ ccs_ptr
)
{
USB_STATUS error;
GENERAL_CLASS_PTR parser;
USB_lock();
error = usb_hostdev_validate (dev_ptr);
if (error != USB_OK) {
USB_unlock();
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_class_hub_get_app, FAILED");
#endif
return USB_log_error(__FILE__,__LINE__,error);
} /* EndIf */
for (parser = (GENERAL_CLASS_PTR) mass_anchor; parser != NULL; parser = parser->next) {
if (parser->dev_handle == dev_ptr && parser->intf_handle == intf_ptr)
break;
}
if (parser != NULL) {
USB_MASS_CLASS_INTF_STRUCT_PTR msd = (USB_MASS_CLASS_INTF_STRUCT_PTR) parser;
*ccs_ptr = msd->APP;
}
else {
USB_unlock();
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_class_mass_get_app, not found");
#endif
return USB_log_error(__FILE__,__LINE__,USBERR_NOT_FOUND);
}
USB_unlock();
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_class_mass_get_app, SUCCESSFUL");
#endif
return USB_OK;
}
示例11: DEBUG_LOG_TRACE
void usb_class_mass_get_pending_request
(
/* [IN] interface structure pointer */
USB_MASS_CLASS_INTF_STRUCT_PTR intf_ptr,
/* [OUT] pointer to pointer which will hold the pending request */
COMMAND_OBJECT_PTR *cmd_ptr_ptr
)
{ /* Body */
MASS_QUEUE_STRUCT_PTR Q = &intf_ptr->QUEUE;
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_class_mass_get_pending_request");
#endif
USB_lock();
if (Q->COUNT) {
*cmd_ptr_ptr = (COMMAND_OBJECT_PTR)Q->ELEMENTS[Q->FIRST];
} else {
*cmd_ptr_ptr = NULL;
} /* Endif */
USB_unlock();
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_class_mass_get_pending_request, SUCCESSFUL");
#endif
return;
} /* Endbody */
示例12: DEBUG_LOG_TRACE
/*FUNCTION*-------------------------------------------------------------
*
* Function Name : _usb_device_unstall_endpoint
* Returned Value : USB_OK or error code
* Comments :
* Unstalls the endpoint in specified direction
*
*END*-----------------------------------------------------------------*/
void _usb_device_unstall_endpoint
(
/* [IN] the USB_USB_dev_initialize state structure */
_usb_device_handle handle,
/* [IN] the Endpoint number */
uint_8 ep_num,
/* [IN] direction */
uint_8 direction
)
{ /* Body */
/* uint_8 error = 0; */
USB_DEV_STATE_STRUCT_PTR usb_dev_ptr;
usb_dev_ptr = (USB_DEV_STATE_STRUCT_PTR)handle;
#ifdef _DEVICE_DEBUG_
DEBUG_LOG_TRACE("_usb_device_unstall_endpoint");
#endif
USB_lock();
_usb_dci_vusb20_unstall_endpoint(handle, ep_num, direction);
USB_unlock();
#ifdef _DEVICE_DEBUG_
DEBUG_LOG_TRACE("_usb_device_unstall_endpoint, SUCCESSFULL");
#endif
} /* EndBody */
示例13: USB_lock
USB_STATUS usb_class_hub_get_descriptor
(
/* [IN] The communication device common command structure */
HUB_COMMAND_PTR com_ptr,
/* [IN] descriptor buffer */
uchar_ptr buffer,
/* [IN] buffer length (or, better said, how many bytes to read) */
uchar len
)
{ /* Body */
USB_STATUS error = USB_OK;
USB_lock();
error = usb_class_hub_cntrl_common(
com_ptr,
REQ_TYPE_DEVICE | REQ_TYPE_IN | REQ_TYPE_CLASS,
REQ_GET_DESCRIPTOR,
0,
0,
len,
buffer
);
USB_unlock();
return error;
} /* EndBody */
示例14: USB_lock
USB_STATUS usb_class_cdc_install_driver
(
CLASS_CALL_STRUCT_PTR data_instance,
char_ptr device_name
)
{
USB_DATA_CLASS_INTF_STRUCT_PTR if_ptr;
USB_STATUS status = USB_OK;
USB_lock();
/* Validity checking, always needed when passing data to lower API */
if (usb_host_class_intf_validate(data_instance)) {
if_ptr = (USB_DATA_CLASS_INTF_STRUCT_PTR) data_instance->class_intf_handle;
f_usb->DEV_PTR->DRIVER_INIT_PTR = data_instance;
f_usb->DEV_PTR->IDENTIFIER = device_name;
f_usb->DEV_PTR->IO_OPEN = _io_cdc_serial_open;
f_usb->DEV_PTR->IO_CLOSE = _io_cdc_serial_close;
f_usb->DEV_PTR->IO_READ = _io_cdc_serial_read;
f_usb->DEV_PTR->IO_WRITE = _io_cdc_serial_write;
f_usb->DEV_PTR->IO_IOCTL = _io_cdc_serial_ioctl;
f_usb->DEV_PTR->IO_UNINSTALL = _io_cdc_serial_uninstall;
f_usb->DEV_PTR->DRIVER_TYPE = 0;
if (status == IO_OK)
if_ptr->device_name = device_name;
}
USB_unlock();
return status;
}
示例15: DEBUG_LOG_TRACE
static USB_STATUS usb_class_hid_cntrl_common
(
/* [IN] The communication device common command structure */
HID_COMMAND_PTR com_ptr,
/* [IN] Bitmask of the request type */
uint_8 bmrequesttype,
/* [IN] Request code */
uint_8 brequest,
/* [IN] Value to copy into WVALUE field of the REQUEST */
uint_16 wvalue,
/* [IN] Length of the data associated with REQUEST */
uint_16 wlength,
/* [IN] Pointer to data buffer used to send/recv */
uchar_ptr data
)
{ /* Body */
USB_HID_CLASS_INTF_STRUCT_PTR if_ptr;
USB_SETUP req;
USB_STATUS status = USBERR_NO_INTERFACE;
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_class_hid_cntrl_common");
#endif
USB_lock();
/* Validity checking */
if (usb_host_class_intf_validate(com_ptr->CLASS_PTR)) {
if_ptr =
(USB_HID_CLASS_INTF_STRUCT_PTR)com_ptr->CLASS_PTR->class_intf_handle;
status = usb_hostdev_validate(if_ptr->G.dev_handle);
} /* Endif */
if (!status && if_ptr->IN_SETUP) {
status = USBERR_TRANSFER_IN_PROGRESS;
} /* Endif */
if (!status) {
/* Save the higher level callback and ID */
if_ptr->USER_CALLBACK = com_ptr->CALLBACK_FN;
if_ptr->USER_PARAM = com_ptr->CALLBACK_PARAM;
/* Setup the request */
req.BMREQUESTTYPE = bmrequesttype;
req.BREQUEST = brequest;
*(uint_16*)req.WVALUE = HOST_TO_LE_SHORT(wvalue);
*(uint_16*)req.WINDEX = HOST_TO_LE_SHORT(((INTERFACE_DESCRIPTOR_PTR)if_ptr->G.intf_handle)->bInterfaceNumber);
*(uint_16*)req.WLENGTH = HOST_TO_LE_SHORT(wlength);
status = _usb_hostdev_cntrl_request(if_ptr->G.dev_handle, &req, data,
usb_class_hid_cntrl_callback, if_ptr);
if (status == USB_STATUS_TRANSFER_QUEUED) {
if_ptr->IN_SETUP = TRUE;
} /* Endif */
} /* Endif */
USB_unlock();
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_class_hid_cntrl_common, SUCCESSFUL");
#endif
return status;
} /* Endbody */