dev_dini.c 2.37 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             
***
*** $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_deinit_endpoint
* Returned Value : USB_OK or error code
* Comments       :
*     Deinitializes an endpoint
* 
*END*--------------------------------------------------------------------*/
uint_8 _usb_device_deinit_endpoint
   (
      /* [IN] Handle to the USB device */
      _usb_device_handle   handle,
      
      /* [IN] The endpoint to initialise */
      uint_8               endpoint_num,
      
      /* [IN] the direction: unused for USB 1.1 */
      uint_8               direction
   )
{ /* Body */
   USB_DEV_STATE_STRUCT_PTR   usb_dev_ptr;
   XD_STRUCT_PTR              pxd;
   
   usb_dev_ptr = (USB_DEV_STATE_STRUCT_PTR)handle;
   USB_lock();

   if (direction) {
      pxd = &usb_dev_ptr->XDSEND[endpoint_num];
   } else {
      pxd = &usb_dev_ptr->XDRECV[endpoint_num];
   } /* Endif */   

   pxd->STATUS = USB_STATUS_IDLE;

#ifdef __USB_OS_MQX__     
   ((USB_CALLBACK_FUNCTIONS_STRUCT_PTR)usb_dev_ptr->CALLBACK_STRUCT_PTR)->\
      DEV_DEINIT_ENDPOINT(handle, endpoint_num, pxd);
#else
   _usb_dci_vusb11_deinit_endpoint(handle, endpoint_num, pxd);
#endif
   
   USB_unlock();
   return USB_OK;
} /* EndBody */
 
/* EOF */