⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usbohcitransfermanagement.c

📁 风河的vxworks-6.3 FOR amcc440epx BSP!
💻 C
📖 第 1 页 / 共 5 页
字号:
/* usbOhciTransferManagement.c - Transfer Management of USB OHCI *//* Copyright 2004-2006 Wind River Systems, Inc.                              This software includes software licensed to Wind River Systems, Inc.   by Wipro, Ltd. Wind River licensees may use this software according     to the terms of their Wind River license agreement(s) applicable to    this software.*//*modification history--------------------01l,23jan06,ami  Proper Check made on error in the function                 usbOhciProcessGeneralTransferCompletion () (SPR #109810 Fix)01k,26apr05,mta  Diab compiler warning removal01j,29mar05,pdg  Fix for disconnect issue with ms7727se bsp01i,28mar05,pdg  non-PCI changes01h,02mar05,ami  SPR #106373 (OHCI Max Controller Issue)01g,25feb05,mta  SPR 10627601f,15oct04,ami  Apigen Changes01e,19sep04,hch  Fix diab compilation error01d,16aug04,pdg  Fix for print-stop-reprint01c,03aug04,pdg  Fixed coverity errors01b,27jun03,nld Changing the code to WRS standards01a,17mar02,ssh Initial Version*//*DESCRIPTIONThis file defines the transfer management of the USB OHCI driver.INCLUDE FILES:	usbOhci.h, usbOhciRegisterInfo.h, usbOhciTransferManagement.h*//*INTERNAL ******************************************************************************* * Filename         : OHCI_TransferManagement.c * * Copyright        : * * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD  BANGALORE * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF * THIS COPYRIGHT AS PER APPLICABLE LAWS. * * Description      : This file defines the interrupt handler for the OHCI  *                    driver. * * ******************************************************************************//* includes */#include "usb2/usbOsal.h"#include "usb2/BusAbstractionLayer.h"#include "usb2/usbHst.h"#include "usb2/usbOhci.h"#include "usb2/usbOhciRegisterInfo.h"#include "usb2/usbOhciTransferManagement.h"/* defines *//********************** MODULE SPECIFIC MACRO DEFINITION **********************//*  * To hold the mask value used to obtain the device address from the URB * device handle parameter */#define USB_OHCI_DEVICE_ADDRESS_MASK                                0xFF/* To hold the value for an invalid pipe handle */#define USB_OHCI_INVALID_PIPE_HANDLE                                0/* To hold the value of pipe handle created for the root hub */#define USB_OHCI_ROOT_HUB_PIPE_HANDLE                               0xFFFFFFFF/* To hold the memory alignment for the OHCI endpoint descriptor */#define USB_OHCI_ENDPOINT_DESCRIPTOR_ALIGNMENT                      16/* To hold the memory alignment mask for the OHCI endpoint descriptor */#define USB_OHCI_ENDPOINT_DESCRIPTOR_ALIGNMENT_MASK                 0x0F/* To hold the memory alignment for the OHCI general transfer descriptor */#define USB_OHCI_GENERAL_TRANSFER_DESCRIPTOR_ALIGNMENT              16/* To hold the general transfer descriptor header size */#define USB_OHCI_GENERAL_TRANSFER_DESCRIPTOR_HEADER                 \        sizeof(PUSB_OHCI_ENDPOINT_DESCRIPTOR)/* To hold the memory alignment mask for the OHCI general transfer descriptor */#define USB_OHCI_GENERAL_TRANSFER_DESCRIPTOR_ALIGNMENT_MASK         0x0F/*  * To hold the maximum transfer length that can be submitted with a single  * General Transfer Descriptor (TD). */#define USB_OHCI_GENERAL_TD_MAXIMUM_TRANSFER_LENGTH                 0x1000/* To hold the memory alignment for the OHCI isochronous transfer descriptor */#define USB_OHCI_ISOCHRONOUS_TRANSFER_DESCRIPTOR_ALIGNMENT          32/* To hold the isochronous transfer descriptor header size */#define USB_OHCI_ISOCHRONOUS_TRANSFER_DESCRIPTOR_HEADER             \        sizeof(PUSB_OHCI_ENDPOINT_DESCRIPTOR)/* * To hold the memory alignment mask for the OHCI isochronous transfer  * descriptor  */#define USB_OHCI_ISOCHRONOUS_TRANSFER_DESCRIPTOR_ALIGNMENT_MASK     0x1F/*  * To hold the maximum transfer length that can be submitted with a single  * Isochronous Transfer Descriptor (TD). */#define USB_OHCI_ISOCHRONOUS_TD_MAXIMUM_TRANSFER_LENGTH             0x1000#define USB_OHCI_HCCA_INERRUPT_TABLE_OFFSET      0/*change for isochronous support start *//*  * To hold the software delay required in scheduling a single TD for  * a isochronous transfer. Currently fixed at 2 frames per TD. */#define USB_OHCI_ISOCHRONOUS_SCHEDULING_SOFTWARE_DELAY_PER_TD       4/*  * To hold the number of packets that can be supported by a single  * isochronous transfer descriptor. Each OHCI isochronous transfer  * descriptor can send / receive up to 8 packets. */#define USB_OHCI_NUMBER_OF_ISOCHRONOUS_PACKETS_PER_TD               8/*  * To hold the frame width for isochronous transfers.  * * Currently set from 0 to 1023 frames. */#define USB_OHCI_ISOCHRONOUS_TRANFER_WINDOW_WIDTH                   0x03FF/*change for isochronous support ends *//******************* MODULE SPECIFIC VARIABLES DEFINITION *********************//* NONE *//* forward declarations *//****************** MODULE SPECIFIC FUNCTIONS DECLARATION *********************//*************** THESE FUNCTIONS WILL BE REGISTERED WITH USBD *****************//* Function to create the pipes for the endpoint */LOCAL USBHST_STATUS usbOhciCreatePipe (UINT8      uHostControllerIndex,                                       UINT8      uDeviceAddress,                                       UINT8      uSpeed,                                       PUCHAR     pEndpointDescriptor,                                       UINT16     uHighSpeedHubInfo,                                       PUINT32    puPipeHandle);/* Function to delete a pipe corresponding to an endpoint */LOCAL USBHST_STATUS usbOhciDeletePipe (UINT8      uHostControllerIndex,                                       UINT32     uPipeHandle);/* This function is used to submit a request to the device */LOCAL USBHST_STATUS usbOhciSubmitUrb (UINT8           uHostControllerIndex,                                      UINT32          uPipeHandle,                                      pUSBHST_URB     pUrb);/* This function is used to cancel a request submitted to the device */LOCAL USBHST_STATUS usbOhciCancelUrb (UINT8           uHostControllerIndex,                                      UINT32          uPipeHandle,                                      pUSBHST_URB     pUrb);/*  * Function to determine whether the bandwidth is available to support the  * new configuration or an alternate interface. */LOCAL USBHST_STATUS usbOhciIsBandwidthAvailable (UINT8    uHostControllerIndex,                                      			 UINT8    uDeviceAddress,                                                 UINT8    uDeviceSpeed,                                      			 PUCHAR   pCurrentDescriptor,                                      			 PUCHAR   pNewDescriptor);/*  * Function to modify the properties of the default control pipe, i.e. the  * pipe corresponding to Address 0, Endpoint 0. */LOCAL USBHST_STATUS usbOhciModifyDefaultPipe (UINT8   uHostControllerIndex,                                              UINT32  uDefaultPipeHandle,                                              UINT8   uDeviceSpeed,                                              UINT8   uMaximumPacketSize,                                              UINT16  uHighSpeedHubInfo);/* Function to check whether any request is pending on a pipe */LOCAL USBHST_STATUS usbOhciIsRequestPending (UINT8    uHostControllerIndex,                                             UINT32   uPipeHandle);/* Function to obtain the current frame number */LOCAL USBHST_STATUS usbOhciGetFrameNumber (UINT8      uHostControllerIndex,                                           PUINT16    puCurrentFrameNumber);/* Function to modify the frame width */LOCAL USBHST_STATUS usbOhciSetBitRate (UINT8      uHostContollerIndex,                                       BOOL       bIncrement,                                       PUINT32    puCurrentFrameWidth);/****************** MODULE SPECIFIC FUNCTIONS DECLARATION *********************//***************** THESE FUNCTIONS WILL BE USED INTERNALLY ********************//*  * Function is used to check whether the pipe corresponding to an endpoint  * is valid. */#ifdef DEBUGLOCAL USBHST_STATUS usbOhciIsValidPipe (UINT8  uHostControllerIndex,                                        UINT32 uPipeHandle);#endif/* Function to create a list of general transfer descriptors */LOCAL PUSB_OHCI_GENERAL_TRANSFER_DESCRIPTOR		usbOhciCreateGeneralTransferDescriptorList(                                UINT32	uHostControllerIndex,				UINT32                      	uNumberOfTransferDescriptors,    			PUSB_OHCI_ENDPOINT_DESCRIPTOR   pOhciEndpointDescriptor);/* Function to destroy the list of general transfer descriptors */LOCAL VOID usbOhciDestroyGeneralTransferDescriptorList(    		PUSB_OHCI_GENERAL_TRANSFER_DESCRIPTOR pTransferDescriptorListHead);/* Function to create a list of isochronous transfer descriptors */LOCAL PUSB_OHCI_ISOCHRONOUS_TRANSFER_DESCRIPTOR \usbOhciCreateIsochronousTransferDescriptorList(                        UINT32	uHostControllerIndex,                        UINT32 uNumberOfTransferDescriptors, \    			PUSB_OHCI_ENDPOINT_DESCRIPTOR   pOHCIEndpointDescriptor);/* Function to destroy the list of isochronous transfer descriptors */LOCAL VOID usbOhciDestroyIsochronousTransferDescriptorList(    	PUSB_OHCI_ISOCHRONOUS_TRANSFER_DESCRIPTOR pTransferDescriptorListHead);/* Function to populate the transfer descriptor for control transfers */LOCAL USBHST_STATUS usbOhciPopulateControlTransferDescriptor(    	UINT32                      	uHostControllerIndex,    	PUSB_OHCI_ENDPOINT_DESCRIPTOR   pOhciEndpointDescriptor,    	pUSBHST_URB                 	pUrb);/*  * Function to populate the transfer descriptor for bulk or interrupt transfers  */LOCAL USBHST_STATUS usbOhciPopulateBulkOrInterruptTransferDescriptor(    	UINT32                      	uHostControllerIndex,    	PUSB_OHCI_ENDPOINT_DESCRIPTOR   pOhciEndpointDescriptor,    	pUSBHST_URB                 	pUrb);/* Function to populate the transfer descriptor for isochronous transfers */LOCAL USBHST_STATUS usbOhciPopulateIsochronousTransferDescriptor(    	UINT32                      	uHostControllerIndex,    	PUSB_OHCI_ENDPOINT_DESCRIPTOR   pOhciEndpointDescriptor,    	pUSBHST_URB                 	pUrb);/*  * Function to handle the completion of the transfer. This function is  * called to handle the done head interrupt. */LOCAL VOID usbOhciProcessTransferCompletion (UINT32   uHostControllerIndex,                               				 PVOID    pTransferDescriptor);/* Function to reverse the list of transfers completed */LOCAL PVOID usbOhciReverseTransferCompletionList(        UINT32                      	uHostControllerIndex,        PVOID                           pTransferDescriptor);/* Function to handle the completion of the a general transfer */LOCAL VOID usbOhciProcessGeneralTransferCompletion										(UINT32    uHostControllerIndex,                                      	 PVOID     pTransferDescriptor);/* Function to handle the completion of the an isochronous transfer */LOCAL VOID usbOhciProcessIsochronousTransferCompletion										(UINT32    uHostControllerIndex,                                         PVOID     pTransferDescriptor);/* Function to update the URB information for isochronous transfers */LOCAL VOID usbOhciUpdateIsochronousTransferURBInformation(    UINT32                  uHostControllerIndex,    PUSB_OHCI_URB_LIST      pURBInformation);/******** HELPER FUNCTIONS USED BY OHCI_IsBandwidthAvailable() - BEGIN *******//* Function to release the bandwidth allocated for the current configuration */LOCAL VOIDusbOhciReleaseBandwidthForCurrentConfiguration(    UINT8       uHostControllerIndex,    UINT8       uDeviceAddress,    UINT8       uDeviceSpeed,    PUINT32     puAvailableBandwidth);/* Function to allocate bandwidth for the new configuration */LOCAL USBHST_STATUSusbOhciAllocateBandwidthForNewConfiguration(    UINT8                               uHostControllerIndex,    UINT8                               uDeviceAddress,    UINT8                               uDeviceSpeed,    PUSB_OHCI_CONFIGURATION_DESCRIPTOR  pConfigurationDescriptor,    PUINT32                             puAvailableBandwidth);/* Function to release the bandwidth allocated for the current interface */LOCAL VOIDusbOhciReleaseBandwidthForCurrentInterface(    UINT8                           uHostControllerIndex,    UINT8                           uDeviceAddress,    UINT8                           uDeviceSpeed,    PUSB_OHCI_INTERFACE_DESCRIPTOR  pInterfaceDescriptor,    PUINT32                         puAvailableBandwidth);/* Function to allocate bandwidth for the new interface */LOCAL USBHST_STATUSusbOhciAllocateBandwidthForNewInterface(    UINT8                           uHostControllerIndex,    UINT8                           uDeviceAddress,    UINT8                           uDeviceSpeed,    PUSB_OHCI_INTERFACE_DESCRIPTOR  pInterfaceDescriptor,    PUINT32                         puAvailableBandwidth);/********* HELPER FUNCTIONS USED BY OHCI_IsBandwidthAvailable() - END ********//* Function to add a node to the endpoint descriptor list */LOCAL USBHST_STATUS usbOhciAddNodeToEndpointDescriptorList					(UINT32                      	uHostControllerIndex,    				 PUSB_OHCI_ENDPOINT_DESCRIPTOR  pOHCIEndpointDescriptor,    				 UINT8                       	uPollingInterval,     				 UINT32                      	uEndpointBandwidth);/* Function to obtain the node with the maximum available bandwidth */LOCAL INT8 usbOhciGetNodeWithMaximumAvailableBandwidth											(UINT32 uHostControllerIndex,                                             UINT8  uPollingInterval,                                             UINT32 uEndpointBandwidth);/*  * Function to check whether an endpoint descriptor is already present in  * the periodic list. */LOCAL BOOLEAN usbOhciIsNodeFoundInPeriodicList						(UINT8							uHostControllerIndex,                         UINT8							uPeriodicListIndex,                         PUSB_OHCI_ENDPOINT_DESCRIPTOR	pEndpointDescriptor);/*  * Function to add the endpoint descriptor to a specific interval in the * periodic list. */LOCAL USBHST_STATUS usbOhciAddPeriodicNodeAtSpecifedInterval						(UINT8                      	uHostControllerIndex,						 UINT8                      	uInterruptListNodeIndex,						 PUSB_OHCI_ENDPOINT_DESCRIPTOR  pNewEndpointDescriptor,						 UINT32                     	uEndpointBandwidth);/* Function to delete a pipe from the list of control pipes */LOCAL USBHST_STATUS usbOhciDeleteControlPipe				(UINT8                       	uHostControllerIndex,    			 PUSB_OHCI_ENDPOINT_DESCRIPTOR	pEndpointDescriptor);/* Function to delete a pipe from the list of bulk pipes */LOCAL USBHST_STATUS usbOhciDeleteBulkPipe				(UINT8                       	uHostControllerIndex,    			 PUSB_OHCI_ENDPOINT_DESCRIPTOR  pEndpointDescriptor);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -