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

📄 sdiodev.cpp

📁 WINCE5.0下
💻 CPP
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
#include "bthsdio.h"

#ifdef DEBUG

// Need this for sdcard modules
DBGPARAM dpCurSettings = {
    _T("BTHSDIO"), 
    {
        _T(""), _T(""), _T(""), _T(""),
        _T(""), _T(""), _T(""), _T(""),
        _T(""), _T(""), _T(""), _T(""),
        _T(""), _T(""), _T(""), _T("") 
    },
    0x0 
};

#endif


/*

This function is called by the SDHC when the BT device is inserted.

*/
extern "C" DWORD BSD_Init(DWORD dwContext)
{
    BOOL fRetVal = TRUE;

    // Only support one device
    if (g_pSdioDevice->IsAttached()) {
        fRetVal = FALSE;
        goto exit;
    }
    
    if (! g_pSdioDevice->Attach(dwContext)) {
        fRetVal = FALSE;
        goto exit;
    }
    
exit:    
    DWORD dwRet;
    if (fRetVal) {
        dwRet = (DWORD) g_pSdioDevice;
    }
    else {
        dwRet = 0;
    }
    
    return dwRet;
}


/*

This function is called by the SDHC when the BT device is ejected.

*/
extern "C" BOOL BSD_Deinit(DWORD hDeviceContext)
{
    g_pSdioDevice->Detach();
    return TRUE;
}

extern "C" DWORD BSD_Open(DWORD hDeviceContext, DWORD AccessCode, DWORD ShareMode)
{
    return hDeviceContext;
}

extern "C" BOOL BSD_Close(DWORD hOpenContext)
{
    return TRUE;
}

extern "C" BOOL BSD_IOControl(DWORD hOpenContext, DWORD dwCode, 
    PBYTE pBufIn, DWORD dwLenIn, PBYTE pBufOut, DWORD dwLenOut, PDWORD pdwActualOut)
{
    CSdioDevice *pSdioDevice = (CSdioDevice*) hOpenContext; 
    DEBUGCHK(pSdioDevice == g_pSdioDevice);

    DWORD dwErr = pSdioDevice->IOControl(dwCode, pBufIn, dwLenIn, pBufOut, dwLenOut, pdwActualOut);
    if (dwErr != ERROR_SUCCESS) {
        SetLastError(dwErr);
    }
    
    return (dwErr == ERROR_SUCCESS);
}



⌨️ 快捷键说明

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