欢迎来到天天文库
浏览记录
ID:38524883
大小:32.00 KB
页数:8页
时间:2019-06-14
《物理地址访问的简单实例》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、物理地址访问的简单实例(控制TE2410的LED)#include#include#include"stdafx.h"#defineIOP_BASE 0xB1600000//0x56000000typedefstruct { unsignedint rGPACON; //00 unsignedint rGPADAT; unsignedint rPAD1[2]; unsignedint rGPBCON; //10 unsignedint rGPBDAT; unsignedint rGPBUP; unsi
2、gnedint rPAD2; unsignedint rGPCCON; //20 unsignedint rGPCDAT; unsignedint rGPCUP; unsignedint rPAD3; unsignedint rGPDCON; //30 unsignedint rGPDDAT; unsignedint rGPDUP; unsignedint rPAD4; unsignedint rGPECON; //40 unsignedint rGPEDAT; unsignedint rGPEUP; unsign
3、edint rPAD5; unsignedint rGPFCON; //50 unsignedint rGPFDAT; unsignedint rGPFUP; unsignedint rPAD6; unsignedint rGPGCON; //60 unsignedint rGPGDAT; unsignedint rGPGUP; unsignedint rPAD7; unsignedint rGPHCON; //70 unsignedint rGPHDAT; unsignedint rGPHUP; unsigned
4、int rPAD8; unsignedint rMISCCR; //80 unsignedint rDCKCON; unsignedint rEXTINT0; unsignedint rEXTINT1; unsignedint rEXTINT2; //90 unsignedint rEINTFLT0; unsignedint rEINTFLT1; unsignedint rEINTFLT2; unsignedint rEINTFLT3; //A0 unsignedint rEINTMASK; unsignedint rEINTPEND; unsi
5、gnedint rGSTATUS0; //AC unsignedint rGSTATUS1; //B0 unsignedint rGSTATUS2; //B4 unsignedint rGSTATUS3; //B8 unsignedint rGSTATUS4; //BC }IOPreg; #ifdef__cplusplusextern"C"{#endifBOOLVirtualCopy(LPVOID,LPVOID,DWORD,DWORD);#ifdef__cplusplus}#endifintWINAPIWinMain(HINSTANCEhInstance,
6、 HINSTANCEhPrevInstance, LPTSTR lpCmdLine, int nCmdShow){ volatileIOPreg*v_pIOPRegs; v_pIOPRegs=(volatileIOPreg*)VirtualAlloc(0,sizeof(IOPreg),MEM_RESERVE,PAGE_NOACCESS); if(v_pIOPRegs==NULL) { DEBUGMSG(1,(TEXT("v_pIOPRegsisnotallocatedr
7、"))); returnTRUE; } if(!VirtualCopy((PVOID)v_pIOPRegs,(PVOID)IOP_BASE,sizeof(IOPreg),PAGE_READWRITE
8、PAGE_NOCACHE)){ DEBUGMSG(1,(TEXT("v_pIOPRegsisnotmappedr"))); returnTRUE; } DEBUGMSG(1,(TEXT("v_pIOPRegsismappedto%x
此文档下载收益归作者所有