----------------------------------------------------------------------------------------------------------------------
在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"
- Previous message: Bruce Eitman /(eMVP/): "Re: use MmMapIoSpace in EVC4"
- In reply to: Bruce Eitman /(eMVP/): "Re: use MmMapIoSpace in EVC4"
- Next in thread: Steve Maillet /(eMVP/): "Re: use MmMapIoSpace in EVC4"
- Reply: Steve Maillet /(eMVP/): "Re: use MmMapIoSpace in EVC4"
- Messages sorted by: [ date ] [ thread ]
<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
——我先验证一下,然后再把结果贴出来。