MmMapIoSpace函数在EVC中应该注意的问题

作者:wogoyixikexie@gliet

----------------------------------------------------------------------------------------------------------------------

http://www.tech-archive.net/Archive/WindowsCE/microsoft.public.windowsce.embedded.vc/2004-07/0107.html这个牛网,看到这个MmMapIoSpace的使用方法。现在贴出来分析一下

Hi,Bruce Eitman:

    Thank you for your quick answer.
    I uninstall the EVC4 and reinstall it,then I build a WCE
Application(simple application)and build it.

#include "stdafx.h"
#include "ceddk.h"

int WINAPI WinMain( HINSTANCE hInstance,
     HINSTANCE hPrevInstance,
     LPTSTR lpCmdLine,
     int nCmdShow)
{
  // TODO: Place code here.
 PUCHAR ioPortBase;
 PHYSICAL_ADDRESS PortAddress = {0x40e00000, 0};
 ioPortBase =(PUCHAR) MmMapIoSpace( PortAddress, 0x80,FALSE );
 *ioPortBase = 0x1;
 return 0;
}

I got the Link error:
Compiling...
t1.cpp
Linking...
t1.obj : error LNK2019: unresolved external symbol MmMapIoSpace referenced
in function WinMain
ARMV4Dbg/t1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

how to fix it?

Thank you very much!

"Bruce Eitman (eMVP)" <beitmannospam@nospam.neo.rr.com> 写入邮件
news:%233SfTecYEHA.2344@TK2MSFTNGP11.phx.gbl...
> The Problem is most likely before the include statement as these errors
are
> from the ceddk.h file. What is before the include statement?
>
> --
> Bruce Eitman (eMVP)
> Senior Engineer
>
>
>


Next message: Steve Maillet /(eMVP/): "Re: use MmMapIoSpace in EVC4"

<script type=text/javascript> </script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type=text/javascript> </script> <script>window.google_render_ad();</script>


TO get access to that define you need:

#define WINCEOEM 1
#include <windows.h>

-- 
Steve Maillet (eMVP)
EmbeddedFusion
smaillet_AT_EmbeddedFusion_DOT_com

CE5.0下想要用MmMapIoSpace须包括相应的头文件和库,
应该是没问题的

看看PB帮助文档

This function maps a physical address space to a nonpaged, process-dependent address space. It provides a virtual address, which is directly mapped, to the device.

PVOID MmMapIoSpace( 
  PHYSICAL_ADDRESS PhysicalAddress, 
  ULONG NumberOfBytes, 
  BOOLEAN CacheEnable 
);
Parameters
PhysicalAddress
[in] Starting physical address of the I/O range to map.
NumberOfBytes
[in] Number of bytes to map.
CacheEnable
[in] Flag to indicate whether the physical address range can map as cached memory. For device registers, this value is usually FALSE.
Return Values

Returns the base virtual address that maps the base physical address for the range. If space for mapping the range is insufficient, this function returns NULL.

Remarks

Device drivers call this function during initialization to get a logical address for their device memory if a call to HalTranslateBusAddress indicates that the device memory range for the bus can map to a system memory address. For example, drivers of programmed I/O devices that allocate long-term I/O buffers can call this function to make such a buffer accessible or to make device memory accessible.

You can use the TransBusAddrToVirtual function instead of calling HalTranslateBusAddress and MmMapIoSpace. The TransBusAddrToVirtual function performs the necessary steps to convert a bus address or I/O port address into a virtual address.

Requirements

OS Versions: Windows CE 2.10 and later.
Header: CEDDK.h.
Link Library: CEDDK.lib.

See Also

HalTranslateBusAddress

 

——我先验证一下,然后再把结果贴出来。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值