如何使用EVC写寄存器读写软件(哈哈,源码虽小,但是也写出来看看)
2009-05-15 16:31
477 查看
如何使用EVC写寄存器读写软件(作者:wogoyixikexie@gliet)
//-----------------------------------------------------------------------------------------------------------// 作者:wogoyixikexie@gliet
// 版权:桂林电子科技大学一系科协wogoyixikexie@gliet
// 平台:wince5.0 2440 5.0 BSP
// 发布日期:2009年5月15日 16:54:47
// 最后修改:
// 注意事项:未经作者同意,不得在转载的时候擅自修改、删除文章的任何部分
//-----------------------------------------------------------------------------------------------------------
记得在sunrain_hjb的博客里面有wince寄存器读写软件介绍,这个小工具非常强悍,曾经帮我解决了好多问题。但是没有源码,今天正好有空,我来研究一下。本来想使用IDA看看sunrain_hjb使用了什么函数的,可是居然看不到,只能看到它用了CEDDK.dl,后来仔细想想,MmMapIoSpace正是在CEDDK.dl中的,于是我就开始行动起来。
操作过程以及遇到的问题
--------------------Configuration: DlgDemo - Win32 (WCE ARMV4I) Release--------------------
Compiling...
DlgDemoDlg.cpp
C:/Documents and Settings/user/桌面/2.6 对话框控件/DlgDemoDlg.cpp(155) : error C2065:
'PHYSICAL_ADDRESS' : undeclared identifier
C:/Documents and Settings/user/桌面/2.6 对话框控件/DlgDemoDlg.cpp(155) : error C2146: syntax
error : missing ';' before identifier 'PortAddress'
C:/Documents and Settings/user/桌面/2.6 对话框控件/DlgDemoDlg.cpp(155) : error C2065:
'PortAddress' : undeclared identifier
C:/Documents and Settings/user/桌面/2.6 对话框控件/DlgDemoDlg.cpp(155) : error C2059: syntax
error : '{'
C:/Documents and Settings/user/桌面/2.6 对话框控件/DlgDemoDlg.cpp(155) : error C2143: syntax
error : missing ';' before '{'
C:/Documents and Settings/user/桌面/2.6 对话框控件/DlgDemoDlg.cpp(155) : error C2143: syntax
error : missing ';' before '}'
C:/Documents and Settings/user/桌面/2.6 对话框控件/DlgDemoDlg.cpp(156) : error C2065:
'MmMapIoSpace' : undeclared identifier
C:/Documents and Settings/user/桌面/2.6 对话框控件/DlgDemoDlg.cpp(174) : fatal error C1004:
unexpected end of file found
Error executing clarm.exe.
DlgDemoDlg.obj - 8 error(s), 0 warning(s)
加入#include <ceddk.h>
#pragma comment(lib,"ceddk.lib")
c:/program files/windows ce tools/wce500/armsys2440/include/armv4i/ceddk.h(1103) : fatal error
C1083: Cannot open include file: 'pkfuncs.h': No such file or directory
c:/program files/windows ce tools/wce500/armsys2440/include/armv4i/pkfuncs.h(33) : fatal error
C1083: Cannot open include file: 'toolhelp.h': No such file or directory
C:/Documents and Settings/user/桌面/2.6 对话框控件/DlgDemoDlg.cpp(178) : fatal error C1004:
——在PB下找到上述两个头文件,放到 c:/program files/windows ce tools/wce500/armsys2440/include/armv4i 就可以了
后来又有
unexpected end of file found
——晕,原来我在一个for 循环少了个括号。
LINK : fatal error LNK1104: cannot open file 'ceddk.lib'
在project-setting-link-object/library modules
C:/WINCE500/PBWorkspaces/ARMsys2440/WINCE500
/smdk2440a_ARMV4I/cesysgen/oak/lib/ARMV4I/retail/CEDDK.lib
重新编译即可。
现在把源码贴上,虽然只是几行代码,但是真的非常强大。
void CDlgDemoDlg::OnButton1() { // TODO: Add your control notification handler code here //unsigned char *gpio_base; unsigned int *gpio_base; OutputDebugString(L"TestDrv - LedDrive1/n"); //PUCHAR ioPortBase; PHYSICAL_ADDRESS PortAddress = {0x56000060, 0}; gpio_base =(unsigned int *)MmMapIoSpace( PortAddress, 0x04,FALSE ); // 获得内存 *gpio_base = 0x0585ff87; // 直接访问硬件 MmUnmapIoSpace(gpio_base,0x04);//释放内存 }
哈哈,就这样成功了。
补充说明:
一、据说稍作修改,也可以用在wince6.0上,这个等下个月我移植我的2440 BSP到wince6.0 再尝试了;
二、这个只是简单的例子,但是可以稍作修改就可以变成一些很有用的软件,做的可以很人性化。如果你做好更多的东西,请多指点。
转载请标明:作者wogoyixikexie@gliet.桂林电子科技大学一系科协,原文地址:http://www.cnblogs.com/wogoyixikexie/(或者我在CSDN的博客:http://blog.csdn.net/gooogleman)——如有错误,希望能够留言指出;如果你有更加好的方法,也请在博客后面留言,我会感激你的批评和分享。
相关文章推荐
- 如何使用EVC写寄存器读写软件(作者:wogoyixikexie@gliet)
- 如何使用EVC写寄存器读写软件(作者:wogoyixikexie@gliet)
- 市面上所有号称"虚拟机","防火墙"的实时监控杀毒软件无一不是使用的IFSHOOK技术.但是同时也有一些朋友不断写MAIL给我打听如何实现读写的监控.下面给出用VTOOLSD写的代码.也就是所有实时杀毒软件的奥秘.同时,很多拦截文件操作的软件,例如对目录加
- MFC如何使用开源Scintilla库?自动源码质量控制软件 iCode 编写全记录(一)
- 如何使用反编译软件得到java源码
- MFC如何使用开源Scintilla库?自动源码质量控制软件 iCode 编写全记录(二)
- 如何使用反编译软件得到源码
- 如何使用x86汇编对硬盘进行读写
- 使用GPS如何在软件和操作层面上实现快速高精度的定位?
- 如何使用CRM软件供应商
- C#初学者如何使用FileSystemInfo类(源码)
- Linux如何编译安装源码包软件
- 【hadoop】Hadoop学习笔记(八):如何使用Maven构建《hadoop权威指南3》随书的源码包
- 【软件工具】(一)markdown如何打开和使用
- 大势至USB管理软件教你如何禁用U盘、屏蔽USB端口而不影响USB鼠标键盘使用!
- 如何使用dd进行磁盘读写速度测试
- 关于如何在Android源码目录中建立自己的C工程,并用mm命令单独进行该C工程模块的编译,以及Android.mk的使用介绍(2)
- Android 软件开发之如何使用Eclipse Debug调试程序详解
- 常见源码搜索网站介绍及如何嵌入到免费工具VcSmith中使用
- Win8如何不借助第三方软件使用批处理删除缓存文件