阅读:1368回复:3
初哥请教GPIO口的设置和应用
想在WINCE下操作GPIO口。已经在2410。H中找到了GPIO的地址了 。我在网上看了要用到两个函数把地址影射成虚拟地址。但是不会用。那为大虾能告诉我以下步骤是什么吗?
在PB中怎么做 。在EVC中怎么做呢。下面是我的板子的GPIO地址 #define IOP_BASE 0xB1600000 // 0x56000000 typedef struct { unsigned int rGPACON; // 00 unsigned int rGPADAT; unsigned int rPAD1[2]; unsigned int rGPBCON; // 10 unsigned int rGPBDAT; unsigned int rGPBUP; unsigned int rPAD2; unsigned int rGPCCON; // 20 unsigned int rGPCDAT; unsigned int rGPCUP; unsigned int rPAD3; unsigned int rGPDCON; // 30 unsigned int rGPDDAT; unsigned int rGPDUP; unsigned int rPAD4; unsigned int rGPECON; // 40 unsigned int rGPEDAT; unsigned int rGPEUP; unsigned int rPAD5; unsigned int rGPFCON; // 50 unsigned int rGPFDAT; unsigned int rGPFUP; unsigned int rPAD6; unsigned int rGPGCON; // 60 unsigned int rGPGDAT; unsigned int rGPGUP; unsigned int rPAD7; unsigned int rGPHCON; // 70 unsigned int rGPHDAT; unsigned int rGPHUP; unsigned int rPAD8; unsigned int rMISCCR; // 80 unsigned int rDCKCON; unsigned int rEXTINT0; unsigned int rEXTINT1; unsigned int rEXTINT2; // 90 unsigned int rEINTFLT0; unsigned int rEINTFLT1; unsigned int rEINTFLT2; unsigned int rEINTFLT3; // A0 unsigned int rEINTMASK; unsigned int rEINTPEND; unsigned int rGSTATUS0; // AC unsigned int rGSTATUS1; // B0 unsigned int rGSTATUS2; // B4 unsigned int rGSTATUS3; // B8 unsigned int rGSTATUS4; // BC }IOPreg; |
|
沙发#
发布于:2007-03-29 11:30
怎么没人帮我啊 ?
|
|
板凳#
发布于:2007-03-29 16:47
VirtualAlloc和VirtualCopy
如何使用看MSDN |
|
|
地板#
发布于:2007-04-04 11:50
PVOID pVirtualAddr;
pVirtualAddr = (PBYTE) VirtualAlloc (NULL,size, MEM_RESERVE, PAGE_NOACCESS); if (pVirtualAddr == NULL ) { eturn 0; } if (!VirtualCopy ((LPVOID)pVirtualAddr , (LPVOID)phyMem, size, PAGE_READWRITE| PAGE_NOCACHE)) { VirtualFree(pVirtualAddr, size, MEM_RELEASE); return 0; } 你可以参照上面的代码。注意phyMem是影射后的地址,不是实际的物理地址。 |
|