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

📄 data.c

📁 Windows CE 6.0 BSP for VOIP sample phone. Intel PXA270 platform.
💻 C
字号:
//
// 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.
//
//------------------------------------------------------------------------------
//
//  File: data.c
//
//  This file implements generic OALIoReadBusData/OALIoWriteBusData functions.
//  It is compiled in several versions depending on supported bus (none, PCI
//  currently). Another buses with configuration space (like PCMCIA) can
//  be added when required.
//
#include <windows.h>
#include "oal_log.h"
#include "oal_io.h"
#include "oal_pci.h"

//------------------------------------------------------------------------------
//
//  Function: OALIoReadBusData
//
//  This function reads data from device configuration space. It returns
//  number of bytes read. Implementation simply dispatch call to bus
//  specific function depending on device location.
//
UINT32 OALIoReadBusData(
    DEVICE_LOCATION *pDevLoc, UINT32 address, UINT32 size, VOID *pData
) {
    UINT32 rc = 0;
    
    switch (pDevLoc->IfcType) {
#ifdef OAL_IO_PCI        
    case PCIBus:
        rc = OALPCICfgRead(
            pDevLoc->BusNumber, *(OAL_PCI_LOCATION*)&pDevLoc->LogicalLoc,
            address, size, pData
        );
        // Workaround PCIBus enumeration issue
        if (rc == 0) {
            memset(pData, 0xFF, size);
            rc = size;
        }
        break;
#endif        
    }
    return rc;
}

//------------------------------------------------------------------------------
//
//  Function: OALIoWriteBusData
//
//  This function writes data from device configuration space. It returns
//  number of bytes written. Implementation simply dispatch call to bus
//  specific function depending on device location.
//
UINT32 OALIoWriteBusData(
    DEVICE_LOCATION *pDevLoc, UINT32 address, UINT32 size, VOID *pData
) {
    UINT32 rc = 0;
    
    switch (pDevLoc->IfcType) {
#ifdef OAL_IO_PCI
    case PCIBus:
        rc = OALPCICfgWrite(
            pDevLoc->BusNumber, *(OAL_PCI_LOCATION*)&pDevLoc->LogicalLoc, 
            address, size, pData
        );
        break;
#endif        
    }
    return rc;
}

//------------------------------------------------------------------------------

⌨️ 快捷键说明

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