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

📄 data.c

📁 Windows CE 6.0 BSP for VOIPAC Board (PXA270) Version 2b.
💻 C
字号:
//
// 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.
//
//------------------------------------------------------------------------------
//
//  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 + -