vusbh11sh.c 3.36 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: vusbh11.c
***
*** Comments:      
***   This file contains the low-level Host API functions specific to the VUSB 
***   chip.
***                                                               
**************************************************************************
*END*********************************************************************/

#include "arcusb.h"

/*FUNCTION*-------------------------------------------------------------
*
*  Function Name  : _usb_hci_vusb11_bus_control
*  Returned Value : None
*  Comments       :
*        Bus control
*END*-----------------------------------------------------------------*/

void _usb_hci_vusb11_bus_control
   (
      /* [IN] the USB Host state structure */
      _usb_host_handle        handle,

      /* The operation to be performed on the bus */
      uint_8                  bControl
   )
{ /* Body */
   USB_HOST_STATE_STRUCT_PTR usb_host_ptr;
   
   usb_host_ptr = (USB_HOST_STATE_STRUCT_PTR)handle;
   
   switch(bControl) {
      case USB_ASSERT_BUS_RESET:
         usb_host_ptr->DEV_PTR->CONTROL = (VUSB_CTRL_HOST_MODE_EN | 
            VUSB_CTRL_USB_EN | VUSB_CTRL_RESET);
         break;
      case USB_ASSERT_RESUME:
         usb_host_ptr->DEV_PTR->CONTROL = (VUSB_CTRL_HOST_MODE_EN 
            | VUSB_CTRL_USB_EN | VUSB_CTRL_RESUME);
         break;
      case USB_SUSPEND_SOF:
         usb_host_ptr->DEV_PTR->CONTROL = VUSB_CTRL_HOST_MODE_EN;
         /* Enable the resume interrupt when suspended */
         usb_host_ptr->DEV_PTR->INTENABLE |= VUSB_INT_ENB_RESUME;
         break;
      case USB_DEASSERT_BUS_RESET:
      case USB_RESUME_SOF:
      case USB_DEASSERT_RESUME:
         /* Resume interrupt should not be enabled when not suspended */
         usb_host_ptr->DEV_PTR->INTENABLE &= ~VUSB_INT_ENB_RESUME;
         usb_host_ptr->DEV_PTR->CONTROL = (VUSB_CTRL_HOST_MODE_EN | 
            VUSB_CTRL_USB_EN);
      default:
         break;
   } /* EndSwitch */
} /* EndBody */

/*FUNCTION*-------------------------------------------------------------
*
*  Function Name  : _usb_hci_vusb11_shutdown
*  Returned Value : None
*  Comments       :
*     Shutdown and de-initialize the VUSB1.1 hardware
*
*END*-----------------------------------------------------------------*/

void _usb_hci_vusb11_shutdown
   (
      /* [IN] the USB Host state structure */
      _usb_host_handle        handle
   )
{ /* Body */
   USB_HOST_STATE_STRUCT_PTR         usb_host_ptr;
   
   usb_host_ptr = (USB_HOST_STATE_STRUCT_PTR)handle;   
   
   *usb_host_ptr->ENDPT_HOST_RG = VUSB_ENDPT_DISABLE;
   usb_host_ptr->DEV_PTR->CONTROL = 0x00;        /* Disable VUSB */
   usb_host_ptr->DEV_PTR->INTENABLE = 0x00; /* Mask all interupts */
   usb_host_ptr->DEV_PTR->INTSTATUS = 0xFF;   /* Clear all interupts */
   usb_host_ptr->DEV_PTR->ADDRESS = 0;
   
} /* EndBody */

/* EOF */