dev_shut.c
2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*HEADER******************************************************************
**************************************************************************
***
*** Copyright (c) 2001-2002 ARC International.
*** All rights reserved
***
*** This software embodies materials and concepts which are
*** confidential to ARC International and is made
*** available solely pursuant to the terms of a written license
*** agreement with ARC International
***
*** $Workfile:devapi.c$
*** $Revision: 1.1 $
*** $Date: 2003/02/17 20:49:01 $
***
*** Comments:
*** This file contains the USB device API.
***
**************************************************************************
*END*********************************************************************/
#ifdef __USB_OS_MQX__
#include "mqx.h"
#include "bsp.h"
#else
#include "devapi.h"
#include "usb.h"
#include "vusb11.h"
#endif
#include "usbprv.h"
#include "usbdprv.h"
/*FUNCTION*-------------------------------------------------------------
*
* Function Name : _usb_device_shutdown
* Returned Value : USB_OK or error code
* Comments :
* Shutdown an initialized USB device
*
*END*-----------------------------------------------------------------*/
void _usb_device_shutdown
(
/* [IN] the USB_USB_dev_initialize state structure */
_usb_device_handle handle
)
{ /* Body */
USB_DEV_STATE_STRUCT_PTR usb_dev_ptr;
usb_dev_ptr = (USB_DEV_STATE_STRUCT_PTR)handle;
#ifdef __USB_OS_MQX__
((USB_CALLBACK_FUNCTIONS_STRUCT_PTR)usb_dev_ptr->CALLBACK_STRUCT_PTR)->\
DEV_SHUTDOWN(handle);
#else
_usb_dci_vusb11_shutdown((_usb_device_handle)usb_dev_ptr);
#endif
USB_memfree((uchar_ptr)usb_dev_ptr->SERVICE_HEAD_PTR);
/* Free all internal transfer descriptors */
USB_memfree((uchar_ptr)usb_dev_ptr->XDSEND);
USB_memfree((uchar_ptr)usb_dev_ptr->XDRECV);
/* Free the USB state structure */
USB_memfree((uchar_ptr)usb_dev_ptr);
} /* EndBody */
/* EOF */