📄 usbohciisr.c
字号:
/* usbOhciIsr.c - USB OHCI Driver Interrupt Handler *//* Copyright 2004 - 2005 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--------------------01g,12apr05,pdg Fix for mouseTest application not returning01f,12apr05,ami MS7751SE macro changed to SH775001e,05apr05,pdg Fix for devices not detected on ms7751se01d,28mar05,pdg non-PCI changes01c,02mar05,ami SPR #106373 (OHCI Max Host Controller Issue)01b,27jun03,nld Changing the code to WRS standards01a,17mar02,ssh Initial Version*//*DESCRIPTIONThis file defines the interrupt handler for the USB OHCI Driver.INCLUDE FILES: usbOhci.h, usbOhciRegisterInfo.h*//* INTERNAL ****************************************************************************** * Filename : OHCI_ISR.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 FILES *******************************/#include "usb2/usbOsal.h"#include "usb2/BusAbstractionLayer.h"#include "usb2/usbOhci.h"#include "usb2/usbOhciRegisterInfo.h"/********************** MODULE SPECIFIC MACRO DEFINITION **********************/#define USB_OHCI_HCCA_DONEHEAD_OFFSET 8/******************* MODULE SPECIFIC VARIABLES DEFINITION *********************//* forward declarations *//****************** MODULE SPECIFIC FUNCTIONS DECLARATION *********************/#ifndef USB_OHCI_POLLING_MODELOCAL VOID usbOhciIsr(UINT8 uHostControllerIndex);#endif /* End of #ifndef USB_OHCI_POLLING_MODE */LOCAL VOID usbOhciPollingIsr(UINT8 uHostControllerIndex);/* Function to process the OHCI interrupts */LOCAL VOID usbOhciProcessInterrupts(UINT8 uHostControllerIndex);/* functions *//************************ GLOBAL FUNCTIONS DEFINITION *************************//******************* MODULE SPECIFIC FUNCTIONS DEFINITION *********************/#ifndef USB_OHCI_POLLING_MODE/***************************************************************************** usbOhciIsr - interrupt handler for USB handling OHCI Controller interrupts** This function is registered as the interrupt handler for handling OHCI* Controller interrupts.** PARAMETERS: <nHostControllerIndex (IN)> - Host controller index corresponding * to the host controller for which an interrupt has occurred.** RETURNS: N/A** ERRNO:* None.** \NOMANUAL*/LOCAL VOID usbOhciIsr ( UINT8 uHostControllerIndex ) { /* To hold the value read from the registers */ UINT32 uRegisterValue = 0; /* To hold the pointer to the host controller information */ PUSB_OHCI_INFORMATION pOhciControllerInfo = NULL; /* Debug print */ OS_LOG_MESSAGE_LOW( OHCD, "Entering the function: usbOhciIsr().\n", 0, 0, 0, 0); /* Check whether the host controller index is valid */ if (uHostControllerIndex >= maxOhciCount) { /* Debug print */ OS_LOG_MESSAGE_LOW( OHCD, "Exiting the function: usbOhciIsr().\n", 0, 0, 0, 0); /* Invalid host controller index */ return; } /* Obtain the pointer to the host controller information */ pOhciControllerInfo = &usbOhciControllerInfo[uHostControllerIndex]; /* * NOTE: In a system with shared interrupts, the ISR will be called * under conditions when another device sharing the interrupt * line generates an interrupt. * * Hence, make sure that the OHCI interrupts are enabled. If * not, it indicates that the interrupt was for another device * sharing the interrupt line. Hence, return without proceeding. * * THIS CHECK SHOULD NOT BE MADE AGAINST THE INTERRUPT STATUS * REGISTER. THIS IS BECAUSE, THE INTERRUPTS ARE CLEARED ONLY * AFTER THE INTERRUPT CONDITION IS HANDLED. HENCE, A CHECK * AGAINST THE INTERRUPT STATUS REGISTER WILL GIVE WRONG * INFORMATION. */ /* Read the contents of the interrupt enable register */ uRegisterValue = USB_OHCI_REG_READ(uHostControllerIndex, pOhciControllerInfo->uBaseAddress + USB_OHCI_INTERRUPT_ENABLE_REGISTER_OFFSET); /* If the OHCI interrupts are not enabled, return without proceeding */ if (0 == uRegisterValue) { /* Debug print */ OS_LOG_MESSAGE_LOW( OHCD, "Exiting the function: usbOhciIsr().\n", 0, 0, 0, 0); return; } /* Disable the interrupts */ USB_OHCI_REG_WRITE (uHostControllerIndex, (pOhciControllerInfo->uBaseAddress + USB_OHCI_INTERRUPT_DISABLE_REGISTER_OFFSET), uRegisterValue); /* Signal the ISR event */ OS_RELEASE_EVENT(pOhciControllerInfo->isrEvent); /* Debug print */ OS_LOG_MESSAGE_LOW( OHCD, "Exiting the function: usbOhciIsr().\n", 0, 0, 0, 0); return; } /* End of function usbOhciIsr () */#endif /* End of #ifndef USB_OHCI_POLLING_MODE *//***************************************************************************** usbOhciPollingIsr - thread for handling USB OHCI Controller interrupts** This function is spawn as thread for handling USB OHCI Controller * interrupts.** PARAMETERS: <nHostControllerIndex (IN)> - Host controller index corresponding * to the host controller for which an interrupt has occurred.** RETURNS: N/A** ERRNO:* None.** \NOMANUAL*/LOCAL VOID usbOhciPollingIsr ( UINT8 uHostControllerIndex ) {#ifndef USB_OHCI_POLLING_MODE /* To hold the pointer to the host controller information */ PUSB_OHCI_INFORMATION pOhciControllerInfo = NULL; /* Debug print */ OS_LOG_MESSAGE_LOW( OHCD, "Entering the function: usbOhciPollingIsr().\n", 0, 0, 0, 0); /* Check whether the host controller index is valid */ if (uHostControllerIndex >= maxOhciCount) { /* Debug print */ OS_LOG_MESSAGE_LOW( OHCD, "Exiting the function: usbOhciPollingIsr().\n", 0, 0, 0, 0); /* Invalid host controller index */ return; } /* Obtain the pointer to the host controller information */ pOhciControllerInfo = &usbOhciControllerInfo[uHostControllerIndex];#endif /* End of #ifndef USB_OHCI_POLLING_MODE */ /* Call the OHCI interrupt infinitely */ while (1) {#ifdef USB_OHCI_POLLING_MODE /* * Reschedule the task so that other OHCI polling mode ISR can * execute. */ OS_RESCHEDULE_THREAD();#else /* Wait for the ISR event */ OS_WAIT_FOR_EVENT(pOhciControllerInfo->isrEvent, OS_WAIT_INFINITE);#endif /* Call the interrupt handler */ usbOhciProcessInterrupts (uHostControllerIndex); } return; } /* End of function usbOhciPollingIsr () *//***************************************************************************** usbOhciProcessInterrupts - Function for handling OHCI Controller interrupts** PARAMETERS: <nHostControllerIndex (IN)> - Host controller index corresponding * to the host controller for which an interrupt has occurred.** RETURNS: N/A** ERRNO:* None.** \NOMANUAL*/LOCAL VOID usbOhciProcessInterrupts (
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -