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

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

?? sdiofeat.cpp

?? 6410BSP3
?? CPP
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
//
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.

Module Name:  
    SDIOFeat.cpp
Abstract:
    SDBus SDIO Setup Feature Implementation.

Notes: 
--*/

#include <windows.h>
#include <types.h>

#include "../HSMMCCh1/s3c6410_hsmmc_lib/sdhcd.h"

#include "sdbus.hpp"
#include "sdslot.hpp"
//#include "sdbusreq.hpp"
#include "sddevice.hpp"

///////////////////////////////////////////////////////////////////////////////
//  SDEnableFunction  - enable/disable the device function 
//  Input:  pDevice   - the device 
//          pInfo   - enable info (required if Enable is TRUE)
//          Enable  - enable
//  Output: 
//  Return: SD_API_STATUS code
//          
//  Notes: 
///////////////////////////////////////////////////////////////////////////////
SD_API_STATUS CSDDevice::SDEnableDisableFunction(PSD_IO_FUNCTION_ENABLE_INFO pInfo,BOOL Enable)
{
    UCHAR                       regValue;       // temp register value
    ULONG                       retryCount;     // ready retry count
    SD_API_STATUS               status;         // intermediate status
    BOOL                        fSkipIfMatch;   // Test for setting the same bit twice
    FUNCTION_POWER_STATE        PowerState;     // The function's power state

    if (m_FuncionIndex == 0 ) {
        DEBUGCHK(FALSE);
        return SD_API_STATUS_INVALID_PARAMETER;
    }

    DEBUGMSG(SDBUS_ZONE_DEVICE, (TEXT("SDEnableDisableFunction: Enabling/Disabling SDIO Device Function %d \n"), m_FuncionIndex));
    

        // Get the functions power state
    status = GetFunctionPowerState(&PowerState);

    if (!SD_API_SUCCESS(status)) {
        return status;
    }

    // First check if states already match
    fSkipIfMatch = FALSE;
    if (PowerState.fFunctionEnabled == Enable) {
        if (Enable) { 
            DEBUGMSG(SDCARD_ZONE_WARN,(TEXT("SDEnableDisableFunction: Attempting to enable function that is already enabled \n")));
            fSkipIfMatch = TRUE;
        }
        else {
            DEBUGMSG(SDCARD_ZONE_WARN,(TEXT("SDEnableDisableFunction: Attempting to disable function that is already disabled \n")));
            fSkipIfMatch = TRUE;
        }
    }
        
    if (!fSkipIfMatch) {
        // Attempt to change cards power draw
        status = m_sdSlot.GetHost().ChangeCardPowerHandler(m_sdSlot.GetSlotIndex(),PowerState.EnableDelta);

        if (!SD_API_SUCCESS(status)) {
            return status;
        }

            //update the power used at the slot
        {
            INT SlotPower = m_sdSlot.GetSlotPower();
            SlotPower += PowerState.EnableDelta;
            m_sdSlot.SetSlotPower( SlotPower >= 0? (USHORT)SlotPower : 0 );
        }

        CSDDevice *pDevice0 = m_sdSlot.GetFunctionDevice(0 );
        status = SD_API_STATUS_NO_SUCH_DEVICE;
        if (pDevice0) {
                // update the parent device shadow register
            if (Enable) {     
                pDevice0->m_SDCardInfo.SDIOInformation.pCommonInformation->CCCRShadowIOEnable 
                    |= (1 <<  m_SDCardInfo.SDIOInformation.Function);
            } else {
                pDevice0->m_SDCardInfo.SDIOInformation.pCommonInformation->CCCRShadowIOEnable &= 
                    ~(1 <<  m_SDCardInfo.SDIOInformation.Function);
            }
            // get a copy
            regValue = pDevice0->m_SDCardInfo.SDIOInformation.pCommonInformation->CCCRShadowIOEnable;

            // update the register
            status = pDevice0->SDReadWriteRegistersDirect_I(SD_IO_WRITE, SD_IO_REG_ENABLE,FALSE, &regValue, 1);
            pDevice0->DeRef();
        }        
        if (!SD_API_SUCCESS(status)) {
            return status;
        }
    }

    // if enabling we check for I/O ready
    if (Enable) { 
        CSDDevice *pDevice0 = m_sdSlot.GetFunctionDevice(0 );
        status = SD_API_STATUS_NO_SUCH_DEVICE;
        if (pDevice0) {
            retryCount = pInfo->ReadyRetryCount;

            while (retryCount) {
                // delay the interval time
                Sleep(pInfo->Interval);

                // read the I/O ready register
                status = pDevice0->SDReadWriteRegistersDirect_I( SD_IO_READ, SD_IO_REG_IO_READY,FALSE,&regValue,1);         // one byte
                if (!SD_API_SUCCESS(status)) {
                    break;
                }

                // see if it is ready
                if (regValue & (1 << m_SDCardInfo.SDIOInformation.Function)) {
                    DEBUGMSG(SDBUS_ZONE_DEVICE, (TEXT("SDEnableDisableFunction: Card Function %d is now ready \n"),
                        m_SDCardInfo.SDIOInformation.Function));
                    break;
                }
                // decrement the count
                retryCount--; 
                DEBUGMSG(SDBUS_ZONE_DEVICE, (TEXT("SDEnableDisableFunction: Card Function %d, Not Ready, re-checking (%d) \n"),
                    m_SDCardInfo.SDIOInformation.Function, retryCount));
            }

            if (0 == retryCount) {
                DEBUGMSG(SDBUS_ZONE_DEVICE, (TEXT("SDEnableDisableFunction: Card Function %d, Not ready , exceeded retry count\n"),
                    m_SDCardInfo.SDIOInformation.Function));
                status = SD_API_STATUS_DEVICE_NOT_RESPONDING;
            }
            pDevice0->DeRef();
        }
    }

    return status;
} 


///////////////////////////////////////////////////////////////////////////////
//  SDFunctionSelectPower  - switch device function to High or Low power state
//  Input:  pDevice   - the device 
//          fLowPower - High or Low Power state
//  Output: 
//  Return: SD_API_STATUS code
//          
//  Notes: 
///////////////////////////////////////////////////////////////////////////////
SD_API_STATUS CSDDevice::SDFunctionSelectPower( BOOL  fLowPower)
{
    UCHAR                       regValue;       // temp register value
    SD_API_STATUS               status;         // intermediate status
    FUNCTION_POWER_STATE        PowerState;     // The function's power state
    DWORD                       FBROffset;      // calculated FBR offset


        // get the parent device
    
    if (0 == m_FuncionIndex) {
        DEBUG_ASSERT(FALSE);
        return SD_API_STATUS_INVALID_PARAMETER;
    }

    DEBUGMSG(SDBUS_ZONE_DEVICE, (TEXT("SDFunctionSelectPower: SDIO Device Function %d Power Select\n"),
            m_SDCardInfo.SDIOInformation.Function));

        // Get the functions power state
    status = GetFunctionPowerState(&PowerState);

    if (!SD_API_SUCCESS(status)) {
        return status;
    }

    //check if power selection is supported
    if((!PowerState.fPowerControlSupport) || (!PowerState.fSupportsPowerSelect)) {
        DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDFunctionSelectPower: Card or Function does not support Power Select.\n")));
        return SD_API_STATUS_INVALID_DEVICE_REQUEST;
    }
    // Check if states already match
    if (PowerState.fLowPower == fLowPower){
        if (fLowPower) { 
            DEBUGMSG(SDCARD_ZONE_WARN, (TEXT("SDFunctionSelectPower: Attempting to select low power state when that is already enabled \n")));
        }
        else{
            DEBUGMSG(SDCARD_ZONE_WARN, (TEXT("SDFunctionSelectPower: Attempting to select high power state when that is already enabled \n")));
        }
        return SD_API_STATUS_SUCCESS;
    }
        
    // Attempt to change cards power draw
    status = m_sdSlot.GetHost().ChangeCardPowerHandler(m_sdSlot.GetSlotIndex(),PowerState.SelectDelta);
    if (!SD_API_SUCCESS(status)) {
        return status;
    }

    //update the power used at the slot
    {
        INT SlotPower = m_sdSlot.GetSlotPower();
        SlotPower += PowerState.SelectDelta;
        m_sdSlot.SetSlotPower( SlotPower >= 0? (USHORT)SlotPower : 0 );
    }

    CSDDevice *pDevice0 = m_sdSlot.GetFunctionDevice(0 );
    status = SD_API_STATUS_NO_SUCH_DEVICE;
    if (pDevice0) {
        // select the function's power state
        FBROffset = SD_IO_FBR_1_OFFSET + (m_SDCardInfo.SDIOInformation.Function - 1) * SD_IO_FBR_LENGTH;
        status = pDevice0->SDReadWriteRegistersDirect_I(SD_IO_READ,FBROffset + SD_IO_FBR_POWER_SELECT,FALSE,&regValue,1); 

        if (SD_API_SUCCESS(status)) {
            if(fLowPower) {
                regValue |= SD_IO_FUNCTION_POWER_SELECT_STATE;
            }
            else {
                regValue &= ~SD_IO_FUNCTION_POWER_SELECT_STATE;
            }

            status = pDevice0->SDReadWriteRegistersDirect_I(SD_IO_WRITE,FBROffset + SD_IO_FBR_POWER_SELECT,FALSE,&regValue,1);
        }
        pDevice0->DeRef();
    }
    return status;
} 

///////////////////////////////////////////////////////////////////////////////
//  SDSetFunctionBlockSize  - set the block size of the function
//  Input:  pDevice   - the device 
//          BlockSize - block size to set
//  Output: 
//  Return: SD_API_STATUS code
//          
//  Notes: 
///////////////////////////////////////////////////////////////////////////////
SD_API_STATUS CSDDevice::SDSetFunctionBlockSize(DWORD BlockSize)
{
    USHORT bytesPerBlock = (USHORT)BlockSize; // desired block size
    DWORD                  FBROffset;         // FBR offset
    SD_API_STATUS          status;
    
    DEBUGCHK(0 != m_SDCardInfo.SDIOInformation.Function);
    // calculate the FBR offset based on the function number
    FBROffset = SD_IO_FBR_1_OFFSET + (m_SDCardInfo.SDIOInformation.Function - 1) * SD_IO_FBR_LENGTH;
    CSDDevice *pDevice0 = m_sdSlot.GetFunctionDevice(0 );
    status = SD_API_STATUS_NO_SUCH_DEVICE;
    
    if (pDevice0) {
        // update the register
        status = pDevice0->SDReadWriteRegistersDirect_I( SD_IO_WRITE, FBROffset + SD_IO_FBR_IO_BLOCK_SIZE, FALSE,(PUCHAR)&bytesPerBlock,sizeof(USHORT));           // two bytes    
        pDevice0->DeRef();
    }
    
    return status;
}
SD_API_STATUS CSDDevice::SetCardFeature_Interface(SD_CARD_INTERFACE_EX& CardInterfaceEx)
{
    SD_API_STATUS               status = SD_API_STATUS_SUCCESS;  // intermediate status
    // Check if the slot can accept this interface request
    // For multifunction card or combo card, the requested interface may not be fitted
    // for other functions.
    {
        BOOL bAllFunctionsAcceptThisInterface = TRUE;

        // Start from parent device
        BOOL fContinue = TRUE; 
        for (DWORD dwIndex = 0; dwIndex < SD_MAXIMUM_DEVICE_PER_SLOT && fContinue ; dwIndex++) {
            CSDDevice * pDevice = m_sdSlot.GetFunctionDevice(dwIndex);
            if (pDevice != NULL ) {
                if (dwIndex!=GetDeviceFuncionIndex() &&  pDevice->GetDeviceType() != Device_Unknown ) {
                    // Check if current device supports 4 bit mode request
                    if (CardInterfaceEx.InterfaceModeEx.bit.sd4Bit && !(pDevice->m_CardInterfaceEx.InterfaceModeEx.bit.sd4Bit)) {
                        bAllFunctionsAcceptThisInterface = FALSE;
                        fContinue = FALSE;
                    }
                    else
                    // Check if request clock rate is too high for this device
                    if (CardInterfaceEx.ClockRate > pDevice->m_CardInterfaceEx.ClockRate) {
                        bAllFunctionsAcceptThisInterface = FALSE;
                        fContinue = FALSE;
                    }
                    else 
                    if (!(CardInterfaceEx.InterfaceModeEx.bit.sdHighSpeed) && pDevice->m_CardInterfaceEx.InterfaceModeEx.bit.sdHighSpeed){
                        bAllFunctionsAcceptThisInterface = FALSE;
                        fContinue = FALSE;
                    }
                }
                pDevice->DeRef();
            }
        }

        if (bAllFunctionsAcceptThisInterface == FALSE) {
            DbgPrintZo(SDCARD_ZONE_ERROR, (TEXT("SDSetCardFeature: SD_SET_CARD_INTERFACE - invalod interface request\n")));

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲va韩国va欧美va精品| 在线播放国产精品二区一二区四区| 91精品国产色综合久久久蜜香臀| 国产精品国产三级国产普通话三级 | 亚洲成va人在线观看| 精品视频免费在线| 午夜一区二区三区视频| 日本大香伊一区二区三区| 一区二区日韩电影| 欧美一二三区在线观看| 日韩精品亚洲专区| 日韩欧美黄色影院| 国产精品一二三四| 亚洲精品成a人| 日韩欧美激情在线| 91首页免费视频| 久久精品国产亚洲a| 亚洲国产精品99久久久久久久久 | 国产一区二区伦理| 亚洲视频免费在线观看| 日韩精品一区二区三区在线播放 | 午夜精品在线视频一区| 亚洲一区在线观看视频| 精品国产乱码久久久久久蜜臀 | 欧美日韩在线观看一区二区 | 日韩免费成人网| 色狠狠综合天天综合综合| 美女精品一区二区| 亚洲国产三级在线| 中文字幕一区二区三区不卡在线 | 国产麻豆精品久久一二三| 亚洲视频一区在线| 欧美国产乱子伦| 国产午夜精品一区二区三区视频 | 成人美女视频在线看| 美腿丝袜亚洲三区| 天天av天天翘天天综合网| 国产精品不卡一区二区三区| 欧美成人a视频| 欧美一区二区三区色| 欧美性猛交xxxx黑人交| 成人午夜av在线| 成人看片黄a免费看在线| 国产精品99久久久久久久vr| 日韩黄色一级片| 免费在线一区观看| 琪琪一区二区三区| 蜜乳av一区二区三区| 久久精品99国产精品| 美女视频网站久久| 国产精品影视在线| 成人动漫中文字幕| 97国产精品videossex| 成人黄色电影在线| 在线精品观看国产| 日韩欧美电影一区| 久久久久久久久久久久电影 | 678五月天丁香亚洲综合网| 91精品国产综合久久精品app| 555夜色666亚洲国产免| 久久亚洲一级片| 日韩美女视频一区二区| 国产.欧美.日韩| 欧美偷拍一区二区| 亚洲精品在线免费播放| 亚洲色图欧美偷拍| 久久成人免费网站| 91免费国产在线| 欧美成人精品1314www| 1000精品久久久久久久久| 亚洲综合激情小说| 国产99久久久久| 欧美久久久久久蜜桃| 国产精品亲子伦对白| 日韩电影免费在线| 成年人国产精品| 精品国产乱码久久久久久牛牛| 一区二区三区日韩欧美| 亚洲免费色视频| 成人18精品视频| 久久久久久久综合| 精彩视频一区二区三区| 91久久精品一区二区| 欧美国产欧美综合| 国产精品原创巨作av| 91精品午夜视频| 亚洲大片一区二区三区| 色哟哟国产精品| 亚洲色欲色欲www| 91香蕉视频在线| 亚洲激情图片小说视频| 91丨九色丨蝌蚪丨老版| 中文字幕一区三区| 91免费小视频| 亚洲精品视频在线看| 欧美日韩国产乱码电影| 日韩欧美视频在线| 亚洲高清视频在线| 欧美成人女星排名| 色综合欧美在线视频区| 九九视频精品免费| 日韩欧美一区电影| 狠狠色丁香婷婷综合| 精品乱人伦小说| 国产**成人网毛片九色 | 日韩三级电影网址| 久久精品噜噜噜成人av农村| 91精品国产综合久久久蜜臀粉嫩| 丝袜美腿亚洲色图| 久久久久久9999| 成人性生交大合| 亚洲综合免费观看高清完整版在线 | 自拍偷拍国产精品| 69p69国产精品| 大陆成人av片| 亚洲电影视频在线| 国产欧美精品日韩区二区麻豆天美| 99久久精品国产网站| 久久国产精品色婷婷| 综合久久一区二区三区| 精品88久久久久88久久久| 3d动漫精品啪啪一区二区竹菊 | 日韩影院在线观看| 国产精品欧美久久久久一区二区| 久久久久88色偷偷免费| 国产日韩av一区| 亚洲女子a中天字幕| 久久香蕉国产线看观看99| 欧美在线看片a免费观看| 成人午夜电影久久影院| 成人免费视频播放| 岛国精品一区二区| av在线播放不卡| av亚洲精华国产精华精| 国产精品中文字幕欧美| 久久99这里只有精品| 老司机一区二区| 日产国产欧美视频一区精品| 亚洲精品一二三| 亚洲午夜免费电影| 免费观看一级特黄欧美大片| 国产最新精品精品你懂的| 亚洲成人动漫精品| 日本欧美一区二区在线观看| 欧美a级一区二区| 久久国产人妖系列| 岛国精品在线播放| 欧美在线观看一区二区| 欧美一区日本一区韩国一区| 日韩一区二区电影| 久久精品综合网| 国产精品久久久久久久久晋中| 日本一区二区三区电影| 亚洲女子a中天字幕| 亚洲一区在线播放| 久久国产综合精品| 成人做爰69片免费看网站| 欧美午夜不卡视频| 精品欧美一区二区久久| 亚洲免费观看高清完整版在线| 亚洲成人免费观看| 不卡免费追剧大全电视剧网站| 欧洲一区在线电影| 中文无字幕一区二区三区 | 亚洲少妇中出一区| 成人一区二区视频| 久久久99免费| 亚洲精品中文在线| 国产在线视频精品一区| 欧美日韩国产欧美日美国产精品| 国产无一区二区| 麻豆国产欧美日韩综合精品二区| 成人sese在线| 亚洲精品一区二区三区福利| 亚洲一区中文在线| 一本色道久久综合亚洲精品按摩| 久久中文字幕电影| 美女视频第一区二区三区免费观看网站 | 日韩欧美一区二区三区在线| 亚洲福利视频三区| 久久精品理论片| 91成人在线精品| 中日韩av电影| 蜜桃av噜噜一区二区三区小说| 欧美三级视频在线| 18成人在线视频| 国产激情精品久久久第一区二区| 欧美精品电影在线播放| 亚洲欧美日韩精品久久久久| 成人免费高清视频| 国产精品视频第一区| 国产成人精品综合在线观看| 欧美va亚洲va在线观看蝴蝶网| 亚洲午夜精品17c| 91福利在线导航| 一区二区三区视频在线观看| 一本到不卡精品视频在线观看| 亚洲欧美日韩久久| 欧美日韩成人高清| 久久99精品久久久久久久久久久久|