亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? s3c6410otgdevice.cpp

?? 6410BSP3
?? CPP
?? 第 1 頁 / 共 5 頁
字號(hào):
                        WriteEPSpecificReg(dwEndpoint, DOEPDMA, pContext->pPAddrEP[dwEndpoint][pContext->dwPipelinedStrIdx]);
                        WriteEPSpecificReg(dwEndpoint, DOEPTSIZ, pContext->dwPipelinedPktCnt<<PACKET_COUTNT_IDX | pContext->dwPipelinedXferSize);
                        WriteEPSpecificReg(dwEndpoint, DOEPCTL, EP_ENABLE | CLEAR_NAK | SET_TYPE_BULK | USB_ACT_EP | peps->dwPacketSizeAssigned);
                    }
                    
                    CompleteTransfer(pContext, peps, UFN_NO_ERROR);
                }
            }
            else
            {
                DWORD dwPktcnt, dwBytes;
                dwPktcnt = pTransfer->cbBuffer / peps->dwPacketSizeAssigned;
                dwBytes = pTransfer->cbBuffer % peps->dwPacketSizeAssigned;
                if (dwBytes) dwPktcnt++;        

                pContext->dwPipelinedXferSize = pTransfer->cbBuffer;
                EnableEndpointInterrupt(pContext, dwEndpoint, peps->dwDirectionAssigned);
                WriteEPSpecificReg(dwEndpoint, DOEPDMA, pContext->pPAddrEP[dwEndpoint][pContext->dwPipelinedStrIdx]);
                WriteEPSpecificReg(dwEndpoint, DOEPTSIZ, dwPktcnt<<PACKET_COUTNT_IDX | pTransfer->cbBuffer);
                WriteEPSpecificReg(dwEndpoint, DOEPCTL, EP_ENABLE | CLEAR_NAK | SET_TYPE_BULK | USB_ACT_EP | peps->dwPacketSizeAssigned);
            }
        }        
    }

    UNLOCK_ENDPOINT(peps);
    FUNCTION_LEAVE_MSG();
}


DWORD
WINAPI
UfnPdd_IssueTransfer(
    PVOID          pvPddContext,
    DWORD          dwEndpoint,
    PSTransfer     pTransfer
    )
{
    SETFNAME();
    FUNCTION_ENTER_MSG();

    DEBUGCHK(EP_VALID(dwEndpoint));
    PCTRLR_PDD_CONTEXT pContext = (PCTRLR_PDD_CONTEXT) pvPddContext;
    ValidateContext(pContext);
    PEP_STATUS peps = GetEpStatus(pContext, dwEndpoint);
    DEBUGCHK(peps->bInitialized);
    DEBUGCHK(pTransfer->cbTransferred == 0);

    DWORD dwRet = ERROR_SUCCESS;

    DEBUGCHK(peps->pTransfer == NULL);
    StartTransfer(pContext, peps, pTransfer);

    FUNCTION_LEAVE_MSG();

    return dwRet;
}


DWORD
WINAPI
UfnPdd_AbortTransfer(
    PVOID       pvPddContext,
    DWORD       dwEndpoint,
    PSTransfer    pTransfer
    )
{
    SETFNAME();
    FUNCTION_ENTER_MSG();

    PREFAST_DEBUGCHK(pTransfer);
    DEBUGCHK(EP_VALID(dwEndpoint));

    PCTRLR_PDD_CONTEXT pContext = (PCTRLR_PDD_CONTEXT) pvPddContext;
    ValidateContext(pContext);

    PEP_STATUS peps = GetEpStatus(pContext, dwEndpoint);
    LOCK_ENDPOINT(peps);
    DEBUGCHK(peps->bInitialized);

    ValidateTransferDirection(pContext, peps, pTransfer);

    DEBUGCHK(pTransfer == peps->pTransfer);
    CompleteTransfer(pContext, peps, UFN_CANCELED_ERROR);

    if (dwEndpoint == 0)
    {
        pContext->Ep0State = EP0_STATE_IDLE;
    }

    ResetEndpoint(pContext,peps);
    
    DisableEndpointInterrupt(pContext, 0, USB_IN_TRANSFER);
    DisableEndpointInterrupt(pContext, 0, USB_OUT_TRANSFER);
    
    UNLOCK_ENDPOINT(peps);

    FUNCTION_LEAVE_MSG();

    return ERROR_SUCCESS;
}


BOOL 
SetOtgDevicePower (
    PCTRLR_PDD_CONTEXT         pContext,
    CEDEVICE_POWER_STATE    cpsNew
    )
{
    if (cpsNew == D0)
    {
        RETAILMSG(UFN_ZONE_POWER,(_T("[UFNPDD] USB_POWER : D0\r\n")));
        InterruptDone(pContext->dwSysIntr);

        pContext->pSYSCONregs->HCLK_GATE |= OTG_HCLK_EN;     //OTG HClk enable
            SetAllOutEpNak();
        ClearSoftDisconnect();
        ResetDevice(pContext);        
            ClearAllOutEpNak();      

        pContext->IsFirstReset = TRUE;
        DWORD dwGOTGCTL = ReadReg(GOTGCTL);
        if(!(dwGOTGCTL & (B_SESSION_VALID)))
        {
            Delay(100);      //for OTG cable detahced state.
        }
    }

    else if (cpsNew == D4)
    {
        RETAILMSG(UFN_ZONE_POWER,(_T("[UFNPDD] USB_POWER : D4\r\n")));
        SetSoftDisconnect();        
        
        pContext->pSYSCONregs->HCLK_GATE &= ~OTG_HCLK_EN;    //OTG HClk disable
    }
    return TRUE;
}


static
CEDEVICE_POWER_STATE
SetPowerState(
    PCTRLR_PDD_CONTEXT      pContext,
    CEDEVICE_POWER_STATE    cpsNew
    )
{
    SETFNAME();
    FUNCTION_ENTER_MSG();
    
    PREFAST_DEBUGCHK(pContext);
    DEBUGCHK(VALID_DX(cpsNew));
    ValidateContext(pContext);

    // Adjust cpsNew.
    if (cpsNew != pContext->cpsCurrent)
    {
        if (cpsNew == D1 || cpsNew == D2)
        {
            // D1 and D2 are not supported.
            cpsNew = D0;
        }
        else if (pContext->cpsCurrent == D4)
        {
            // D4 can only go to D0.
            cpsNew = D0;
        }
    }

    if (cpsNew != pContext->cpsCurrent)
    {
        DEBUGMSG(UFN_ZONE_POWER, (_T("%s Going from D%u to D%u\r\n"), pszFname, pContext->cpsCurrent, cpsNew));

        if ( (cpsNew < pContext->cpsCurrent) && pContext->hBusAccess )
        {
            SetDevicePowerState(pContext->hBusAccess, cpsNew, NULL);
        }

        switch (cpsNew)
        {
            case D0:
                SetOtgDevicePower (pContext, D0);
                KernelIoControl(IOCTL_HAL_DISABLE_WAKE, &pContext->dwSysIntr, sizeof(pContext->dwSysIntr), NULL, 0, NULL);

                if (pContext->fRunning)
                {
                    // Cause the IST to restart.
                    pContext->fRestartIST = TRUE;
                    SetInterruptEvent(pContext->dwSysIntr);
                }
            break;

            case D3:
                KernelIoControl(IOCTL_HAL_ENABLE_WAKE, &pContext->dwSysIntr, sizeof(pContext->dwSysIntr), NULL, 0, NULL);
            break;

            case D4:
                SetOtgDevicePower (pContext, D4);
                KernelIoControl(IOCTL_HAL_DISABLE_WAKE, &pContext->dwSysIntr, sizeof(pContext->dwSysIntr), NULL, 0, NULL);
            break;
        }

        if ( (cpsNew > pContext->cpsCurrent) && pContext->hBusAccess )
        {
            SetDevicePowerState(pContext->hBusAccess, cpsNew, NULL);
        }
        pContext->cpsCurrent = cpsNew;
    }
    
    FUNCTION_LEAVE_MSG();

    return pContext->cpsCurrent;
}


static
VOID
FreeCtrlrContext(
    PCTRLR_PDD_CONTEXT    pContext
    )
{
    PREFAST_DEBUGCHK(pContext);
    DEBUGCHK(!pContext->hevInterrupt);
    DEBUGCHK(!pContext->hIST);
    DEBUGCHK(!pContext->fRunning);
    pContext->dwSig = GARBAGE_DWORD;

    UnmapRegisterSet(pContext);

    if (pContext->hBusAccess) CloseBusAccessHandle(pContext->hBusAccess);

    if (pContext->dwSysIntr)
    {
        KernelIoControl(IOCTL_HAL_DISABLE_WAKE, &pContext->dwSysIntr, sizeof(pContext->dwSysIntr), NULL, 0, NULL);
    }

    if (pContext->dwIrq != IRQ_UNSPECIFIED)
    {
        KernelIoControl(IOCTL_HAL_RELEASE_SYSINTR, &pContext->dwSysIntr, sizeof(DWORD), NULL, 0, NULL);
    }

    DeleteCriticalSection(&pContext->csRegisterAccess);
    LocalFree(pContext);
}


DWORD
WINAPI
UfnPdd_Deinit(
    PVOID    pvPddContext
    )
{
    SETFNAME();
    FUNCTION_ENTER_MSG();

    PCTRLR_PDD_CONTEXT pContext = (PCTRLR_PDD_CONTEXT) pvPddContext;
    ValidateContext(pContext);

    FUNCTION_ENTER_MSG();

    FreeCtrlrContext(pContext);

    FUNCTION_LEAVE_MSG();

    return ERROR_SUCCESS;
}


DWORD
WINAPI
UfnPdd_Start(
    PVOID    pvPddContext
    )
{
    SETFNAME();
    FUNCTION_ENTER_MSG();

    UFN_CLIENT_INFO currentDriver; 
    DWORD dwRet;
    PCTRLR_PDD_CONTEXT pContext = (PCTRLR_PDD_CONTEXT) pvPddContext;
    ValidateContext(pContext);

    DEBUGCHK(!pContext->fRunning);

    BOOL fIntInitialized = FALSE;

    RETAILMSG(UFN_ZONE_INIT,(_T("[UFNPDD] USB DRIVER VERSION : %d\r\n"), USB_DD_VERSION));
    // Some application can change the usbfn client dirver dynamically.
    // In this case, below codes are needed.
    if (USBCurrentDriver((PUFN_CLIENT_INFO)&currentDriver)) 
    {
        if(!wcscmp(currentDriver.szName, TEXT("RNDIS")) ||!wcscmp(currentDriver.szName, TEXT("rndis")))
        {
            pContext->dwUSBClassInfo = USB_RNDIS;
            pContext->dwUsingEPCnt = 4;
            RETAILMSG(UFN_ZONE_INIT,(_T("[UFNPDD] USB RNDIS Function Class Enabled\r\n")));
        }
        else if(!wcscmp(currentDriver.szName, TEXT("Serial_Class")) ||!wcscmp(currentDriver.szName, TEXT("serial_class")))
        {
            pContext->dwUSBClassInfo = USB_SERIAL;
            pContext->dwUsingEPCnt = 3;
            RETAILMSG(UFN_ZONE_INIT,(_T("[UFNPDD] USB Serial Function Class Enabled\r\n")));
        }
        else if(!wcscmp(currentDriver.szName, TEXT("Mass_Storage_Class")) ||!wcscmp(currentDriver.szName, TEXT("mass_storage_class")))
        {
            pContext->dwUSBClassInfo = USB_MSF;
            pContext->dwUsingEPCnt = 3;
            RETAILMSG(UFN_ZONE_INIT,(_T("[UFNPDD] USB Mass Storage Function Class Enabled\r\n")));
        }
    } 
    else 
    {
        RETAILMSG(UFN_ZONE_ERROR,(_T("[UFNPDD] USB Function Class Read Error!!!!!!!\r\n")));
    }

    do
    {
        // Create the interrupt event
        pContext->hevInterrupt = CreateEvent(0, FALSE, FALSE, NULL);
        if (pContext->hevInterrupt == NULL)
        {
            dwRet = GetLastError();
            DEBUGMSG(ZONE_ERROR, (_T("%s Error creating  interrupt event. Error = %d\r\n"), pszFname, dwRet));
            break;
        }

        fIntInitialized = InterruptInitialize(pContext->dwSysIntr, pContext->hevInterrupt, NULL, 0);
        if (fIntInitialized == FALSE)
        {
            dwRet = ERROR_GEN_FAILURE;
            DEBUGMSG(ZONE_ERROR, (_T("%s  interrupt initialization failed\r\n"), pszFname));
            break;
        }
        InterruptDone(pContext->dwSysIntr);

        pContext->fExitIST = FALSE;
        pContext->hIST = CreateThread(NULL, 0, ISTMain, pContext, 0, NULL);
        if (pContext->hIST == NULL)
        {
            DEBUGMSG(ZONE_ERROR, (_T("%s IST creation failed\r\n"), pszFname));
            dwRet = GetLastError();
            break;
        }

        InitPDDContext(pContext);
        if(pContext->bMemoryAllocFlag == FALSE)
        {
            for(DWORD i=0; i<pContext->dwUsingEPCnt; i++)
            {
                for(DWORD j=0; j<PIPELINED_FIFO_DEPTH; j++)
                {
                    pContext->pVAddrEP[i][j] = (PDWORD)AllocPhysMem(pContext->dwPipelinedXferSize, PAGE_READWRITE, 0, 0, &pContext->pPAddrEP[i][j]);
                    memset(pContext->pVAddrEP[i][j], 0, pContext->dwPipelinedXferSize);
                    pContext->dwPipelinedXfered[i][j] = 0;
                }
            }
            pContext->bMemoryAllocFlag  = TRUE;
        }
        
        pContext->fRunning = TRUE;
        dwRet = ERROR_SUCCESS;
    }while(FALSE);
    
    if (pContext->fRunning == FALSE)
    {
        DEBUGCHK(dwRet != ERROR_SUCCESS);
        if (fIntInitialized) InterruptDisable(pContext->dwSysIntr);
        if (pContext->hevInterrupt) CloseHandle(pContext->hevInterrupt);
        pContext->hevInterrupt = NULL;
    }

    FUNCTION_LEAVE_MSG();

    return dwRet;
}


// Stop the device.
DWORD
WINAPI
UfnPdd_Stop(
    PVOID    pvPddContext
    )
{
    SETFNAME();
    FUNCTION_ENTER_MSG();

    PCTRLR_PDD_CONTEXT pContext = (PCTRLR_PDD_CONTEXT) pvPddContext;
    ValidateContext(pContext);

    DEBUGCHK(pContext->fRunning);

    // Stop the IST
    pContext->fExitIST = TRUE;
    InterruptDisable(pContext->dwSysIntr);
    SetEvent(pContext->hevInterrupt);
    WaitForSingleObject(pContext->hIST, INFINITE);
    CloseHandle(pContext->hevInterrupt);
    CloseHandle(pContext->hIST);
    pContext->hIST = NULL;
    pContext->hevInterrupt = NULL;

    WriteReg(DAINTMSK,0);                // IN, OUT EP ALL MASK

    WriteReg(DOEPMSK, 0);                // DOEP INT MASK
    WriteReg(DIEPMSK, 0);                // DIEP INT MASK

    WriteReg(GINTMSK, 0);                // GINT MASK
    WriteReg(GAHBCFG, 0);                // GLOBAL INT MASK

    WriteReg(GOTGINT, 0xE0304);            // OTG INT All CLEAR
    WriteReg(GINTSTS, INT_RESUME | INT_EPMIS | INT_SDE | INT_RESET | INT_SUSPEND); // GINT Clear

    for (DWORD dwEpIdx = 0; dwEpIdx < ENDPOINT_COUNT; ++dwEpIdx) 
    {
        EP_STATUS *peps = GetEpStatus(pContext, dwEpIdx);
        ResetEndpoint(pContext, peps);
    }

    if(pContext->bMemoryAllocFlag == TRUE)
    {
        for(DWORD i=0; i<pContext->dwUsingEPCnt; i++)
        {
            for(DWORD j=0; j<PIPELINE

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色哟哟一区二区| 制服丝袜亚洲色图| 奇米色777欧美一区二区| 欧美国产一区视频在线观看| 欧美日韩五月天| a亚洲天堂av| 国内精品伊人久久久久av影院 | 日韩高清不卡一区二区三区| 国产目拍亚洲精品99久久精品| 欧美三级日韩三级国产三级| 大尺度一区二区| 麻豆精品国产91久久久久久| 亚洲国产裸拍裸体视频在线观看乱了 | 日韩精品一级二级| **欧美大码日韩| 久久久久免费观看| 日韩视频一区在线观看| 欧美日韩成人高清| 91美女在线看| 色综合久久久久久久久| 成人看片黄a免费看在线| 国产永久精品大片wwwapp| 天堂蜜桃一区二区三区 | 亚洲视频免费观看| 国产欧美精品一区| 久久久一区二区三区| 欧美一区二区三区播放老司机| 色伊人久久综合中文字幕| 成人激情免费网站| 国产剧情一区在线| 国产在线精品国自产拍免费| 麻豆免费精品视频| 亚洲高清视频中文字幕| 亚洲超碰精品一区二区| 亚洲成av人片在线观看| 亚洲v中文字幕| 无码av免费一区二区三区试看| 亚洲国产欧美在线| 亚洲一二三四区不卡| 亚洲一区二区三区四区不卡| 亚洲一区免费观看| 亚洲成人黄色小说| 免费在线看成人av| 久久不见久久见免费视频1| 精品综合久久久久久8888| 精品综合久久久久久8888| 麻豆91在线观看| 久久不见久久见中文字幕免费| 久草这里只有精品视频| 九一久久久久久| 国产成人在线免费| 成人av免费观看| 色88888久久久久久影院野外| 91欧美一区二区| 欧美色爱综合网| 日韩亚洲欧美高清| 精品少妇一区二区三区日产乱码| 精品日韩一区二区| 国产精品全国免费观看高清| 亚洲欧美色图小说| 视频一区视频二区在线观看| 久久69国产一区二区蜜臀| 国产a久久麻豆| 色94色欧美sute亚洲线路一ni | 色综合久久综合| 777欧美精品| 久久精品这里都是精品| 中文字幕一区二区三区视频| 亚洲午夜电影在线| 另类小说图片综合网| 成人h动漫精品一区二区| 在线观看网站黄不卡| 日韩亚洲欧美成人一区| 国产精品久久久久毛片软件| 一区二区欧美精品| 精品一区二区三区在线播放| 成人av网站免费| 欧美精品久久久久久久多人混战| 久久美女艺术照精彩视频福利播放| 中文字幕日韩一区| 另类小说图片综合网| 色综合天天综合给合国产| 日韩一二在线观看| 亚洲免费在线视频| 激情久久五月天| 在线观看91视频| 国产视频不卡一区| 天天色天天爱天天射综合| 粉嫩久久99精品久久久久久夜| 欧美日韩一级视频| 国产精品人成在线观看免费| 日韩av一区二区三区四区| 99久久99久久精品免费看蜜桃| 欧美大度的电影原声| 亚洲综合无码一区二区| 国产成人一区在线| 5月丁香婷婷综合| 亚洲视频香蕉人妖| 国产风韵犹存在线视精品| 91精品国产综合久久蜜臀| **欧美大码日韩| 国产一区二区三区香蕉| 欧美日韩国产首页| 亚洲色图清纯唯美| 国产精品一区二区免费不卡| 日韩欧美一区二区免费| 亚洲国产另类av| 99精品视频一区| 欧美激情中文不卡| 国产一区二区中文字幕| 91精品国产欧美一区二区18| 一区二区三区四区激情| 成人免费精品视频| 国产日韩欧美不卡| 国产美女精品在线| 日韩欧美国产wwwww| 婷婷夜色潮精品综合在线| 色悠悠久久综合| 日韩久久一区二区| 99视频有精品| 亚洲国产精品高清| 韩国一区二区三区| 精品毛片乱码1区2区3区| 七七婷婷婷婷精品国产| 欧美一区二区视频在线观看| 亚洲午夜电影在线| 欧美日韩国产123区| 亚洲国产成人高清精品| 欧美日韩午夜精品| 首页亚洲欧美制服丝腿| 欧美中文字幕久久| 亚洲一区中文在线| 欧美在线观看你懂的| 亚洲午夜成aⅴ人片| 欧美日韩中文字幕一区二区| 亚洲国产综合91精品麻豆| 欧美老女人第四色| 日韩av中文字幕一区二区| 欧美一区午夜视频在线观看| 美日韩一级片在线观看| 精品久久久久久综合日本欧美| 蜜臀久久99精品久久久久宅男| 欧美一区国产二区| 精品一区二区三区久久| 久久久久国产精品麻豆| 懂色av一区二区三区免费观看 | 日韩免费性生活视频播放| 男男成人高潮片免费网站| 精品国产一区二区亚洲人成毛片| 蜜桃av一区二区| 久久噜噜亚洲综合| www.久久久久久久久| 亚洲精品国产a| 欧美高清性hdvideosex| 免费成人你懂的| 国产亚洲女人久久久久毛片| 成人av免费在线播放| 亚洲一区二区偷拍精品| 日韩天堂在线观看| 国产成a人亚洲精品| 一区二区三区精品| 日韩午夜电影在线观看| 成人精品在线视频观看| 亚洲国产日日夜夜| 2024国产精品视频| 99r精品视频| 日本中文一区二区三区| 久久久久九九视频| 在线区一区二视频| 精品一区二区在线观看| 国产精品久久久久aaaa| 欧美日韩aaa| 国产精品一区二区免费不卡| 夜夜嗨av一区二区三区四季av | 亚洲一级二级在线| 2023国产精华国产精品| 91免费国产在线| 久久国产福利国产秒拍| 亚洲人成人一区二区在线观看 | 91精品国产一区二区人妖| 国产一区二区三区久久久| 亚洲一区二区三区四区五区黄| 精品国产一区a| 色天天综合色天天久久| 精品综合免费视频观看| 亚洲一区免费在线观看| 久久久久国产精品麻豆ai换脸| 欧美日韩一区国产| 成人一级黄色片| 男男视频亚洲欧美| 亚洲男同性恋视频| 久久久久久久国产精品影院| 欧美日韩国产成人在线免费| 成人丝袜18视频在线观看| 日本欧美一区二区在线观看| 中文字幕一区二区三区在线不卡 | 日本大香伊一区二区三区| 精品写真视频在线观看| 亚洲一级二级在线| 国产精品久久久久9999吃药|