host_shu.c 3.08 KB
/*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             
***
*** File: hostapi.c
***
*** Comments:      
***   This file contains the USB Host API specific functions.
***                                                               
**************************************************************************
*END*********************************************************************/
#ifdef __USB_OS_MQX__
#include "mqx.h"
#include "bsp.h"
#else
#include "types.h"
#include "vusb11.h"
#include "usb.h"
#include "hostapi.h"
#endif
#include "usbprv.h"
#include "usbhprv.h"

/*FUNCTION*-------------------------------------------------------------
*
*  Function Name  : _usb_host_shutdown
*  Returned Value : USB_OK or error code
*  Comments       :
*        Shutdown an initialized USB Host
*
*END*-----------------------------------------------------------------*/
void _usb_host_shutdown
   (
      /* [IN] the USB_host handle */
      _usb_host_handle         handle
   )
{ /* Body */
   USB_HOST_STATE_STRUCT_PTR         usb_host_ptr;
   
   usb_host_ptr = (USB_HOST_STATE_STRUCT_PTR)handle;

#ifdef __USB_OS_MQX__   
   /* De-initialize and disconnect the host hardware from the bus */
   ((USB_CALLBACK_FUNCTIONS_STRUCT_PTR)usb_host_ptr->CALLBACK_STRUCT_PTR)->\
      HOST_SHUTDOWN(handle);
#else
   _usb_hci_vusb11_shutdown(handle);
#endif
   
   /* Free all Pipe Descriptors */
   USB_memfree(usb_host_ptr->PIPE_DESCRIPTOR_BASE_PTR);

   /* Free the USB state structure */
   USB_memfree(handle);
   
} /* EndBody */

/*FUNCTION*-------------------------------------------------------------
*
*  Function Name  : _usb_host_bus_control
*  Returned Value : None
*  Comments       :
* _usb_host_bus_control controls the bus operations such as asserting and 
* deasserting the bus reset, asserting and deasserting resume, 
* suspending and resuming the SOF generation
*
*END*-----------------------------------------------------------------*/

void _usb_host_bus_control
   (
      /* [IN] the USB Host state structure */
      _usb_host_handle           handle,
      
      /* The operation to be performed on the bus */
      uint_8                     bcontrol
   )
{ /* Body */

#ifdef __USB_OS_MQX__   
   USB_HOST_STATE_STRUCT_PTR         usb_host_ptr;
   
   usb_host_ptr = (USB_HOST_STATE_STRUCT_PTR)handle;

   ((USB_CALLBACK_FUNCTIONS_STRUCT_PTR)usb_host_ptr->CALLBACK_STRUCT_PTR)->\
      HOST_BUS_CONTROL(handle, bcontrol);
#else
   _usb_hci_vusb11_bus_control(handle, bcontrol);
#endif
  
} /* Endbody */

/* EOF */