本文整理汇总了C++中USB_log_error函数的典型用法代码示例。如果您正苦于以下问题:C++ USB_log_error函数的具体用法?C++ USB_log_error怎么用?C++ USB_log_error使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了USB_log_error函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _usb_rtos_host_init
/*FUNCTION*-------------------------------------------------------------
*
* Function Name : _usb_host_init_call_interface
* Returned Value : USB_OK or error
* Comments :
* _usb_host_init_call_interface routine is used to initialize device
* drivers when the USB host stack is initialized. Device drivers may
* perform device register, interrupt, and internal data structure
* initialization.
*
*END*-----------------------------------------------------------------*/
USB_STATUS _usb_host_init_call_interface
(
/* [IN] the USB Host state structure */
_usb_host_handle handle
)
{
USB_STATUS error = USB_OK;
USB_HOST_CALLBACK_FUNCTIONS_STRUCT_PTR temp_ptr;
USB_HOST_STATE_STRUCT_PTR usb_host_ptr = (USB_HOST_STATE_STRUCT_PTR)handle;
#ifdef USB_HOST_INCLUDE_TASK_SUPPORT
error = _usb_rtos_host_init ();
if (error != USB_OK)
{
return USB_log_error(__FILE__,__LINE__,error);
}
#endif
temp_ptr = (USB_HOST_CALLBACK_FUNCTIONS_STRUCT_PTR)usb_host_ptr->CALLBACK_STRUCT_PTR;
if (temp_ptr->HOST_INIT != NULL)
{
error = temp_ptr->HOST_INIT (handle);
}
#ifdef USB_HOST_INCLUDE_TASK_SUPPORT
if (error != USB_OK)
{
error = _usb_rtos_host_shutdown();
}
#endif
return USB_log_error(__FILE__,__LINE__,error);
}
示例2: 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 */
示例3: DEBUG_LOG_TRACE
USB_STATUS usb_class_mass_getmaxlun_bulkonly
(
CLASS_CALL_STRUCT_PTR ccs_ptr,
uint_8_ptr pLUN,
tr_callback callback
)
{ /* Body */
USB_STATUS status = USBERR_NO_INTERFACE;
USB_SETUP request;
USB_MASS_CLASS_INTF_STRUCT_PTR intf_ptr;
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_class_mass_getmaxlun_bulkonly");
#endif
/* Pointer validity-checking, clear memory, init header */
USB_lock();
if (usb_host_class_intf_validate(ccs_ptr)) {
intf_ptr = (USB_MASS_CLASS_INTF_STRUCT_PTR) ccs_ptr->class_intf_handle;
status = usb_hostdev_validate(intf_ptr->G.dev_handle);
} /* Endif */
if (status) {
USB_unlock();
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_class_mass_getmaxlun_bulkonly, error status");
#endif
return USB_log_error(__FILE__,__LINE__,status);
} /* Endif */
/* Get the number of logical units on the device */
request.BMREQUESTTYPE = REQ_TYPE_CLASS | REQ_TYPE_INTERFACE | REQ_TYPE_IN;
request.BREQUEST = GET_MAX_LUN;
*(uint_16*)request.WVALUE = HOST_TO_LE_SHORT_CONST(0);
*(uint_16*)request.WINDEX = HOST_TO_LE_SHORT(((INTERFACE_DESCRIPTOR_PTR)intf_ptr->G.intf_handle)->bInterfaceNumber);
*(uint_16*)request.WLENGTH = HOST_TO_LE_SHORT_CONST(1);
/* Send request */
status = _usb_hostdev_cntrl_request (intf_ptr->G.dev_handle,
&request, (uchar_ptr)pLUN, callback, NULL);
USB_unlock();
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_class_mass_getmaxlun_bulkonly, SUCCESSFUL");
#endif
return USB_log_error(__FILE__,__LINE__,status);
} /* Endbody */
示例4: 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;
}
示例5: USB_log_error
/*FUNCTION*-------------------------------------------------------------
*
* Function Name : _usb_host_cancel_call_interface
* Returned Value : USB_OK or error
* Comments :
* _usb_host_cancel_call_interface routine is used to cancel pending
* transactions. Device drivers may update/free internal data structures
* and/or modify registers to cancel the transaction.
*
*END*-----------------------------------------------------------------*/
USB_STATUS _usb_host_cancel_call_interface
(
/* [IN] the USB Host state structure */
_usb_host_handle handle,
/* [IN] Pipe descriptor */
struct pipe_struct _PTR_ pipe_ptr,
/* [IN] Pipe transfer descriptor */
struct tr_struct _PTR_ tr_ptr
)
{
USB_STATUS error = USB_OK;
USB_HOST_CALLBACK_FUNCTIONS_STRUCT_PTR temp_ptr;
USB_HOST_STATE_STRUCT_PTR usb_host_ptr = (USB_HOST_STATE_STRUCT_PTR)handle;
temp_ptr = (USB_HOST_CALLBACK_FUNCTIONS_STRUCT_PTR)usb_host_ptr->CALLBACK_STRUCT_PTR;
if (temp_ptr->HOST_CANCEL != NULL)
{
error = temp_ptr->HOST_CANCEL (handle, pipe_ptr, tr_ptr);
}
return USB_log_error(__FILE__,__LINE__,error);
}
示例6: _mqx_dll_get_head_node
/*FUNCTION*-------------------------------------------------------------
*
* Function Name : _usb_host_iso_packet_desc_list_alloc
* Returned Value : USB_OK or error
* Comments :
* _usb_host_iso_packet_desc_list_alloc is used by Host Controller Drivers (HCDs)
* to allocate Isochronous Packet Descriptors. HCDs allocate Isochronous Packet
* Descriptors in response to HCD Requests from the USB Host Stack to initiate
* isochronous transfers over the USB bus. Note that the USB Host Stack passes
* a PIPE_TR_STRUCT along with each data transfer request made to the HCD (see
* definition of USB_CALLBACK_FUNCTIONS_STRUCT for a list of all HCD Requests).
*
* As isochronous packets are completed by physical host controllers, HCDs
* store status, transfer size, and memory offsets of data for each completed
* isochronous packet in Isochronous Packet Descriptors for later consumption
* by USB Clients (e.g. class drivers, applications, etc.). Note that a single
* PIPE_TR_STRUCT representing an isochronous transfer may transfer multiple
* isochronous packets across the USB bus.
*
* As an implementation note, each PIPE_TR_STRUCT structure provides ISO_PACKET_DESC_LIST
* and ISO_PACKET_DESC_CURRENT_PTR members. These members are owned by the HCD until
* the HCD invokes the ISO_TR_CALLBACK function pointer in the PIPE_TR_STRUCT. After
* ISO_TR_CALLBACK is invoked the HCD reliquishes control of the PIPE_TR_STRUCT to
* the USB Client which registered the callback (see usb_hostdev_iso_tr_init). While
* the HCD has ownership of the PIPE_TR_STRUCT, the ISO_PACKET_DESC_LIST member is used
* to store the HCD-allocated descriptors while the ISO_PACKET_DESC_CURRENT_PTR member
* is used by the HCD to keep track of the next unused descriptor on the list.
*
* Note: Isochronous Packet Descriptors are allocated from the Isochronous Packet
* Descriptor Pool created during USB Host Stack initialization. The number of descriptors
* in the Isochronous Packet Descriptor Pool is user-configurable and can be changed by
* adjusting the value of the USBCFG_HOST_NUM_ISO_PACKET_DESCRIPTORS macro in user_config.h.
*
* Note: This function is not thread-safe
*
*END*-----------------------------------------------------------------*/
USB_STATUS _usb_host_iso_packet_desc_list_alloc
(
uint_32 num_descs, /* must not be zero */
USB_ISO_PACKET_DESC_LIST_STRUCT_PTR desc_list_ptr /* output */
)
{
MQX_DLL_NODE_PTR sublist_head_ptr;
MQX_DLL_NODE_PTR sublist_tail_ptr;
uint_32 i;
/* always allocate descriptors from the head of the free list */
_mqx_dll_get_head_node (&usb_host_iso_packet_desc_pool.free_list, &sublist_head_ptr);
/* check for allocation errors */
sublist_tail_ptr = sublist_head_ptr;
for (i = 0; i < num_descs - 1; i++)
{
_mqx_dll_get_next_node (sublist_tail_ptr, &sublist_tail_ptr);
if (sublist_tail_ptr == NULL)
{
return USB_log_error(__FILE__,__LINE__,USBERR_ALLOC);
}
}
/* allocate a block of descriptors */
_mqx_dll_create_sublist ((MQX_DLL_LIST_PTR)&usb_host_iso_packet_desc_pool.free_list, sublist_head_ptr, sublist_tail_ptr, &desc_list_ptr->desc_list);
return USB_OK;
}
示例7: sizeof
USB_STATUS _usb_host_iso_packet_desc_pool_create
(
uint_32 num_descs
)
{
uchar_ptr mem_ptr;
uint_32 pool_num_bytes;
uint_32 i;
pool_num_bytes = sizeof (USB_ISO_PACKET_DESC_STRUCT) * num_descs;
mem_ptr = (uchar_ptr)USB_mem_alloc_zero(pool_num_bytes);
if (mem_ptr == NULL)
{
return USB_log_error(__FILE__,__LINE__,USBERR_ALLOC);
}
_mem_set_type(mem_ptr, MEM_TYPE_USB_ISO_PACKET_DESC_STRUCT);
usb_host_iso_packet_desc_pool.mem_ptr = mem_ptr;
_mqx_dll_list_init ((MQX_DLL_LIST_PTR)&usb_host_iso_packet_desc_pool.free_list);
for (i = 0; i < num_descs; i++)
{
_mqx_dll_node_init (&((USB_ISO_PACKET_DESC_STRUCT_PTR)mem_ptr)[i].node);
_mqx_dll_insert_at_tail ((MQX_DLL_LIST_PTR)&usb_host_iso_packet_desc_pool.free_list, &((USB_ISO_PACKET_DESC_STRUCT_PTR)mem_ptr)[i].node);
((USB_ISO_PACKET_DESC_STRUCT_PTR)mem_ptr)[i].buf_offset = 0;
((USB_ISO_PACKET_DESC_STRUCT_PTR)mem_ptr)[i].buf_length = 0;
((USB_ISO_PACKET_DESC_STRUCT_PTR)mem_ptr)[i].packet_status = USB_OK;
}
return USB_OK;
}
示例8: DEBUG_LOG_TRACE
/*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 */
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_configuration");
#endif
request.bmrequesttype = REQ_TYPE_DEVICE | REQ_TYPE_IN;
request.brequest = REQ_GET_CONFIGURATION;
*(uint16_t*)request.wlength = USB_HOST_TO_LE_SHORT_CONST(1);
error = usb_host_ch9_dev_req(dev_handle, &request, buffer);
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("_usb_host_ch9_get_configuration, SUCCESSFUL");
#endif
return USB_log_error(__FILE__,__LINE__,error);
} /* EndBody */
示例9: DEBUG_LOG_TRACE
/*FUNCTION*----------------------------------------------------------------
*
* Function Name : usb_hostdev_validate
* Returned Value : USB_OK or USBERR_DEVICE_NOT_FOUND
* Comments :
* Function to verify pointer is address of an instance on device list.
* It is presumed that this function is called with USB interrupts disabled
*
*END*--------------------------------------------------------------------*/
usb_status usb_hostdev_validate
(
usb_device_instance_handle device_handle
)
{ /* Body */
dev_instance_t* dev_ptr = (dev_instance_t*)device_handle;
usb_host_state_struct_t* usb_host_ptr;
dev_instance_t* test_ptr;
usb_status error;
//uint32_t i;
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_hostdev_validate");
#endif
if (device_handle == NULL)
{
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_hostdev_validate FAILED, invalid device number");
#endif
return USB_log_error(__FILE__,__LINE__,USBERR_INVALID_DEVICE_NUM);
}
usb_host_ptr = (usb_host_state_struct_t*)dev_ptr->host;
USB_Host_lock();
/* usb_host_ptr is valid host state structure, check for list of attached device instances */
test_ptr = (dev_instance_t*)usb_host_ptr->device_list_ptr;
while ((test_ptr != dev_ptr) && (test_ptr != NULL))
{
test_ptr = test_ptr->next;
}
USB_Host_unlock();
#ifdef _HOST_DEBUG_
if (test_ptr == NULL)
{
DEBUG_LOG_TRACE("usb_hostdev_validate null device handle");
}
else
{
DEBUG_LOG_TRACE("usb_hostdev_validate SUCCESSFUL");
}
#endif
error = (test_ptr == NULL) ? USBERR_DEVICE_NOT_FOUND : USB_OK;
return USB_log_error(__FILE__,__LINE__,error);
} /* EndBody */
示例10: 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 */
示例11: DEBUG_LOG_TRACE
/*FUNCTION*----------------------------------------------------------------
*
* Function Name : usb_dev_list_free_memlist
* Returned Value : USB_OK if valid device, else error code
* Comments :
* Close pipes & free memory on device's linked list, whose
* anchor is dev_handle-->memlist
*
*END*--------------------------------------------------------------------*/
USB_STATUS usb_dev_list_free_memlist
(
/* [IN] Handle for the USB device */
_usb_device_instance_handle dev_handle
)
{ /* Body */
DEV_INSTANCE_PTR dev;
DEV_MEMORY_PTR mem_ptr, list_ptr;
USB_STATUS error;
uint_8 intf_no;
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_dev_list_free_memlist");
#endif
error = usb_hostdev_validate(dev_handle);
// EAI - missing {} so failed if debug on
if (error != USB_OK) {
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_dev_list_free_memlist invalid device handle");
#endif
return USB_log_error(__FILE__,__LINE__,error);
}
dev = (DEV_INSTANCE_PTR)dev_handle;
/* Deleting interfaces closes their pipes */
for (intf_no = 0; intf_no < dev->num_of_interfaces; intf_no++)
usb_hostdev_delete_interface(dev, dev->intf_descriptor[intf_no]);
/* Free memory blocks on this device's list */
USB_lock();
mem_ptr = dev->memlist;
while (mem_ptr != NULL) {
list_ptr = mem_ptr->next;
USB_mem_free(mem_ptr);
mem_ptr = list_ptr;
}
dev->memlist = NULL;
USB_unlock();
#ifdef _HOST_DEBUG_
DEBUG_LOG_TRACE("usb_dev_list_free_memlist SUCCESSFUL");
#endif
return USB_OK;
} /* Endbody */