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

📄 usbhalinterrupthandler.c

📁 USB source code of Vxworks 5.6. It has device and the host stack.
💻 C
📖 第 1 页 / 共 2 页
字号:
/* usbHalInterruptHandler.c - USB HAL interrupt handler module*//* Copyright 2004 Wind River Systems, Inc. *//*Modification history--------------------01e,17sep04,ami  WindView Instrumentation Changes01d,03aug04,mta  Modification History Changes01c,29jul04,pdg  Diab warnings fixed01b,19jul04,ami Coding Convention Changes01a,08mar04,mta First.*//*DESCRIPTIONThis file contains interrupt handler routines of the Hardware Adaption Layer.INCLUDE FILES: usb/target/usbHal.h, usb/target/usbHalDebug.h, usb/ossLib.h,               usb/target/usbPeriphInstr.h  *//* includes */#include "usb/target/usbHal.h"         #include "usb/ossLib.h"                #include "usb/target/usbHalDebug.h"#include "usb/target/usbPeriphInstr.h"     /********************************************************************************* usbHalEndpointInterruptHandler - hal endpoint interrupt handler.** This function handles interrupts on endpoints** RETURNS: N/A.** ERRNO:*   None.** \NOMANUAL*/VOID usbHalEndpointInterruptHandler    (    pUSBHAL_TCD	pHalTcd			/* USBHAL_TCD */    )    {    UINT8	pipeInfoIndex = 0;	/* pipe index */    UINT8	endptNumber = 0;	/* endpoint number */    TRB_ENDPOINT_INTERRUPT_STATUS_GET trbGet;/*TRB_ENDPOINT_INTERRUPT_STATUS_GET*/     TRB_ENDPOINT_INTERRUPT_STATUS_CLEAR trbClear;					/*TRB_ENDPOINT_INTERRUPT_STATUS_CLEAR*/    STATUS	status = OK;    pUSBHAL_PIPE_INFO	pPipeInfo = NULL;/* USBHAL_PIPE_INFO */    /* WindView Instrumentation */    USB_HAL_LOG_EVENT(USB_HAL_INTERRUPT_HANDLER,    "usbHalEndpointInterruptHandler entered ...", USB_HAL_WV_FILTER);       USBHAL_DEBUG("usbHalEndpointInterruptHandler - Entering\n",0,0,0,0,0,0);    /* Check the validity of the parameters */    if ((pHalTcd == NULL) || (pHalTcd->pTCDHandle == NULL))        {        /* WindView Instrumentation */         USB_HAL_LOG_EVENT(USB_HAL_DEVICE_CNTL,        "usbHalEndpointInterruptHandler exiting: Bad Parameter Received...",        USB_HAL_WV_FILTER);           USBHAL_ERR("usbHalEndpointInterruptHandler : Invalid parameters\n",        0,0,0,0,0,0);        return;        }    /*     * for every active endpoint , get its endpoint interrupt status.     * If an interrupt is pending on endpoint, process the interrupt and     * clear its endpoint interrupt status.     */    while ( (endptNumber < pHalTcd->uActiveEndpoints) &&            (pipeInfoIndex <  pHalTcd->halDeviceInfo.uNumberEndpoints))        {        /* retrieve the pipe handle */        pPipeInfo = pHalTcd->pPipeInfo[pipeInfoIndex];        /* determine if endpoint indexed by pipeInfoIndex is active */        if ( (pPipeInfo!= NULL) &&             ((pHalTcd->uActiveEndpointsBitmap & ( 1 << pipeInfoIndex )) != 0) )            {            /* endpoint is active  */            /* Populate the TRB - start */            trbHeaderInit((pTRB_HEADER)(&trbGet),                           pHalTcd->pTCDHandle,                           TCD_FNC_ENDPOINT_INTERRUPT_STATUS_GET,                           sizeof(TRB_ENDPOINT_INTERRUPT_STATUS_GET));            trbGet.pipeHandle=pPipeInfo->pipeHandle;            /* Populate the TRB - end */            /* call the TCD's SEP to get the endpoint interrupt status*/            status =(*pHalTcd->tcdExecFunc)(&trbGet);            if (status == OK)                {                if (trbGet.uEndptInterruptStatus != 0)                    {                    /*                      * interrupt is pending on endpoint                     * store the endpoint interrupt status                     */                    /* Acquire the mutex */                    OSS_MUTEX_TAKE(pPipeInfo->mutexHandle, OSS_BLOCK);                    pPipeInfo->uEndpointInterruptStatus =                                                 trbGet.uEndptInterruptStatus;                    /* Release the mutex */                    OSS_MUTEX_RELEASE(pPipeInfo->mutexHandle);                    if ((pPipeInfo->uEndpointAddress & 0x80) != 0)                        usbHalProcessEndpointIN(pHalTcd,pPipeInfo);                    else                        usbHalProcessEndpointOUT(pHalTcd,pPipeInfo);                    /* Populate the TRB - start */                    trbHeaderInit((pTRB_HEADER)(&trbClear),                                  pHalTcd->pTCDHandle,                                  TCD_FNC_ENDPOINT_INTERRUPT_STATUS_CLEAR,                                  sizeof(TRB_ENDPOINT_INTERRUPT_STATUS_CLEAR));                    trbClear.pipeHandle=pPipeInfo->pipeHandle;                    /* Populate the TRB - end */                    /*                     * call the TCD's SEP to clear the endpoint interrupt                     * status                     */                    status =(*pHalTcd->tcdExecFunc)(&trbClear);                    }                }            else                {                USBHAL_ERR("usbHalEndpointInterruptHandler :Get Int Status \                           failed...\n",0,0,0,0,0,0);                }            endptNumber++;            }        pipeInfoIndex++;        }    USBHAL_DEBUG("usbHalEndpointInterruptHandler - Exiting\n",0,0,0,0,0,0);    return;    }/********************************************************************************* usbHalDisconnectInterruptHandler - hal disconnect interrupt handler** This function handles the interrupt on a device disconnect** RETURNS: N/A.** ERRNO:*   None.** \NOMANUAL*/VOID usbHalDisconnectInterruptHandler    (    pUSBHAL_TCD	pHalTcd 		/* USBHAL_TCD */    )    {    TRB_HANDLE_DISCONNECT_INTERRUPT trbDisconnectInterruptHandler;    /* WindView Instrumentation */    USB_HAL_LOG_EVENT(USB_HAL_INTERRUPT_HANDLER,    "usbHalDisconnectInterruptHandler entered ...", USB_HAL_WV_FILTER);       USBHAL_DEBUG("usbHalDisconnectInterruptHandler - Entering\n",0,0,0,0,0,0);    /* Check the validity of the parameters */    if ((pHalTcd == NULL) || (pHalTcd->pTCDHandle == NULL) ||        (pHalTcd->mngmtCallback == NULL))        {        /* WindView Instrumentation */         USB_HAL_LOG_EVENT(USB_HAL_DEVICE_CNTL,        "usbHalDisconnectInterruptHandler exiting: Bad Parameter Received...",        USB_HAL_WV_FILTER);           USBHAL_ERR("usbHalDisconnectInterruptHandler : Invalid parameters\n",        0,0,0,0,0,0);        return;        }    /* call the management callback */    (*pHalTcd->mngmtCallback)(pHalTcd->mngmtCallbackParam,                              TCD_MNGMT_DISCONNECT,                              0);    /* Populate the TRB - start */    trbHeaderInit((pTRB_HEADER)(&trbDisconnectInterruptHandler),            pHalTcd->pTCDHandle,            TCD_FNC_HANDLE_DISCONNECT_INTERRUPT,            sizeof(TRB_HANDLE_DISCONNECT_INTERRUPT));    /* Populate the TRB - end */    /* call the TCD's SEP */    (*pHalTcd->tcdExecFunc)(&trbDisconnectInterruptHandler);    USBHAL_DEBUG("usbHalDisconnectInterruptHandler - Exiting\n",0,0,0,0,0,0);    return;    }/********************************************************************************* usbHalResetInterruptHandler - hal reset interrupt handler.** This function handles the interrupt on a device reset** RETURNS: N/A.** ERRNO:*   None.** \NOMANUAL*/VOID usbHalResetInterruptHandler    (    pUSBHAL_TCD	pHalTcd		/* USBHAL_TCD  */    )    {    TRB_HANDLE_RESET_INTERRUPT trbResetInterruptHandler;    /* WindView Instrumentation */    USB_HAL_LOG_EVENT(USB_HAL_INTERRUPT_HANDLER,    "usbHalResetInterruptHandler entered ...", USB_HAL_WV_FILTER);       USBHAL_DEBUG("usbHalResetInterruptHandler - Entering\n",0,0,0,0,0,0);    /* Check the validity of the parameters */    if ((pHalTcd == NULL) || (pHalTcd->pTCDHandle == NULL) ||        (pHalTcd->mngmtCallback == NULL))        {        /* WindView Instrumentation */         USB_HAL_LOG_EVENT(USB_HAL_DEVICE_CNTL,        "usbHalResetInterruptHandler exiting: Bad Parameter Received...",        USB_HAL_WV_FILTER);           USBHAL_ERR("usbHalResetInterruptHandler : Invalid parameters\n",        0,0,0,0,0,0);        return;        }    /* Populate the TRB - start */    trbHeaderInit((pTRB_HEADER)(&trbResetInterruptHandler),            pHalTcd->pTCDHandle,            TCD_FNC_HANDLE_RESET_INTERRUPT,            sizeof(TRB_HANDLE_RESET_INTERRUPT));    /* Populate the TRB - end */    /* call the TCD's SEP */    (*pHalTcd->tcdExecFunc)(&trbResetInterruptHandler);    /* call the management callback */    (*pHalTcd->mngmtCallback)(pHalTcd->mngmtCallbackParam,                              TCD_MNGMT_BUS_RESET,                              (pVOID)trbResetInterruptHandler.uSpeed);    USBHAL_DEBUG("usbHalResetInterruptHandler - Exiting\n",0,0,0,0,0,0);    return;    }/********************************************************************************* usbHalSuspendInterruptHandler - hal suspend interrupt handler.** This function handles the interrupt on device suspend** RETURNS: N/A.*

⌨️ 快捷键说明

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