1 /**HEADER********************************************************************
3 * Copyright (c) 2008 Freescale Semiconductor;
6 * Copyright (c) 1989-2008 ARC International;
9 ***************************************************************************
11 * THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESSED OR
12 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
13 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14 * IN NO EVENT SHALL FREESCALE OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
15 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
16 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
17 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
18 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
19 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
20 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
21 * THE POSSIBILITY OF SUCH DAMAGE.
23 **************************************************************************
25 * $FileName: host_shut.c$
31 * This file contains the USB Host API specific function to shutdown
34 *END************************************************************************/
40 #include "host_cnfg.h"
42 #include "host_main.h"
43 #include "host_shut.h"
45 /*FUNCTION*-------------------------------------------------------------
47 * Function Name : _usb_host_shutdown
48 * Returned Value : USB_OK or error code
50 * Shutdown an initialized USB Host
52 *END*-----------------------------------------------------------------*/
53 void _usb_host_shutdown
55 /* [IN] the USB_host handle */
56 _usb_host_handle handle
60 USB_HOST_STATE_STRUCT_PTR usb_host_ptr
;
61 usb_host_ptr
= (USB_HOST_STATE_STRUCT_PTR
)handle
;
63 DEBUG_LOG_TRACE("_usb_host_shutdown");
67 /* De-initialize and disconnect the host hardware from the bus */
68 status
= _usb_host_shutdown_call_interface (handle
);
73 DEBUG_LOG_TRACE("_usb_host_shutdown FAILED");
77 /* Free all Pipe Descriptors */
78 USB_mem_free((pointer
)usb_host_ptr
->PIPE_DESCRIPTOR_BASE_PTR
);
80 /* Free the USB state structure */
83 DEBUG_LOG_TRACE("_usb_host_shutdown SUCCESSFUL");
89 /*FUNCTION*-------------------------------------------------------------
91 * Function Name : _usb_host_bus_control
92 * Returned Value : None
94 * _usb_host_bus_control controls the bus operations such as asserting and
95 * deasserting the bus reset, asserting and deasserting resume,
96 * suspending and resuming the SOF generation
98 *END*-----------------------------------------------------------------*/
100 void _usb_host_bus_control
102 /* [IN] the USB Host state structure */
103 _usb_host_handle handle
,
105 /* The operation to be performed on the bus */
111 USB_HOST_STATE_STRUCT_PTR usb_host_ptr
;
114 DEBUG_LOG_TRACE("_usb_host_bus_control");
117 usb_host_ptr
= (USB_HOST_STATE_STRUCT_PTR
)handle
;
119 status
= _usb_host_bus_control_data_call_interface (handle
, bcontrol
);
121 if (status
!= USB_OK
)
124 DEBUG_LOG_TRACE("_usb_host_bus_control FAILED");
129 DEBUG_LOG_TRACE("_usb_host_bus_control SUCCESSFUL");