host_din.c 3.05 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_close_pipe
*  Returned Value : None
*  Comments       :
*        _usb_host_close_pipe routine removes the pipe from the open pipe list
*
*END*-----------------------------------------------------------------*/
void  _usb_host_close_pipe
   (
      /* [IN] the USB Host state structure */
      _usb_host_handle     handle,
      
      /* [IN] the pipe id to close */
      int_16               pipeid
   )
{ /* Body */
   USB_HOST_STATE_STRUCT_PTR usb_host_ptr;
   
   usb_host_ptr = (USB_HOST_STATE_STRUCT_PTR)handle;

   USB_lock();

   /* de-initialise the pipe descriptor */
   USB_memzero(&usb_host_ptr->PIPE_DESCRIPTOR_BASE_PTR[pipeid], 
      sizeof(PIPE_DESCRIPTOR_STRUCT));   

   USB_unlock();

} /* Endbody */

/*FUNCTION*-------------------------------------------------------------
*
*  Function Name  : _usb_host_close_all_pipes
*  Returned Value : None
*  Comments       :
*  _usb_host_close_all_pipes routine removes the pipe from the open pipe list
*
*END*-----------------------------------------------------------------*/
void  _usb_host_close_all_pipes
   (
      /* [IN] the USB Host state structure */
      _usb_host_handle  handle
   )
{ /* Body */
   int_16 i;
   USB_HOST_STATE_STRUCT_PTR usb_host_ptr;
   
   usb_host_ptr = (USB_HOST_STATE_STRUCT_PTR)handle;

   USB_lock();

   for (i=0; i<usb_host_ptr->MAX_PIPES; i++) {
      if (!(usb_host_ptr->PIPE_DESCRIPTOR_BASE_PTR[i].OPEN)) {
         break;
      } else {
         /* de-initialise the pipe descriptor */
         USB_memzero(&usb_host_ptr->PIPE_DESCRIPTOR_BASE_PTR[i], 
            sizeof(PIPE_DESCRIPTOR_STRUCT));
      } /* Endif */
   } /* Endfor */
   
   /* Initialize the current pipe id to -1 indicating that there are no pipes 
   ** queued
   */
   usb_host_ptr->CURRENT_PIPE_ID = -1;

   USB_unlock();
} /* Endbody */

/* EOF */