예제 #1
0
/*FUNCTION*-------------------------------------------------------------
*
*  Function Name  : _usb_device_deinit
*  Returned Value : USB_OK or error code
*  Comments       :
*  uninitializes the USB device specific data structures and calls 
*  the low-level device controller chip initialization routine.
*
*END*-----------------------------------------------------------------*/
uint_8 _usb_device_deinit
   (
      /* [OUT] the USB_USB_dev_initialize state structure */
      _usb_device_handle  handle
   )
{ /* Body */
   USB_DEV_STATE_STRUCT_PTR         usb_dev_ptr;
   uint_8                           error;
   error = _usb_device_shutdown(handle);
   USB_mem_free((void*)(handle));
   return error;
} /* EndBody */
예제 #2
0
파일: usb_dev.c 프로젝트: BillyZhangZ/wifi
/*FUNCTION*-------------------------------------------------------------
*
*  Function Name  : usb_device_deinit
*  Returned Value : USB_OK or error code
*  Comments       :
*  uninitializes the USB device specific data structures and calls 
*  the low-level device controller chip initialization routine.
*
*END*-----------------------------------------------------------------*/
usb_status usb_device_deinit
(
    /* [OUT] the USB_USB_dev_initialize state structure */
    usb_device_handle  handle
)
{
#if (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_MQX)
    uint32_t i;
#endif
    usb_dev_state_struct_t*      usb_dev_ptr;
    //usb_class_fw_object_struct_t* usb_fw_ptr = NULL;
    if (handle == NULL)
    {
        #if _DEBUG
            printf("_usb_device_shutdowna: handle is NULL\n");
        #endif  
        return USBERR_ERROR;
    }
    
    usb_dev_ptr = (usb_dev_state_struct_t*)handle;
    
    OS_Mutex_destroy(usb_dev_ptr->mutex);
    _usb_device_shutdown(handle);

    _usb_device_release_handle(usb_dev_ptr);
    
#if (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_MQX)
	for(i = 0; i < USBCFG_DEV_NUM; i++)
	{
		if(NULL != g_usb_dev_data_ptr[i])
		{
			OS_Mem_free(g_usb_dev_data_ptr[i]);
            g_usb_dev_data_ptr[i] = NULL;
		}
	}
#endif

    return USB_OK;
} /* EndBody */