|
我在程序中使用MmMapIoSpace操纵GPIO, 可是貌似没有效果,请各位老大帮忙看看!谢拉。
- volatile static S5PC100_GPIO_REG * pGPIOReg = NULL;
- PHYSICAL_ADDRESS ioPhysicalBase = {0,0};
-
- ioPhysicalBase.LowPart = S5PC100_BASE_REG_PA_GPIO;
-
- pGPIOReg = (volatile S5PC100_GPIO_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S5PC100_GPIO_REG), FALSE);
-
- if (pGPIOReg == NULL)
- {
- RETAILMSG(1, (_T("Mapping GPIO failed!!!\n\r")));
- }
- RETAILMSG(1, (_T("pGPIOReg = 0x%08x\n\r")), pGPIOReg);
- RETAILMSG(1, (_T("pGPIOReg = 0x%08x\n\r")), pGPIOReg);
- RETAILMSG(1, (_T("PRE-CONFIG: GPH0CON = 0x%08x\n\r")), pGPIOReg->GPH0CON);
- RETAILMSG(1, (_T("PRE-CONFIG: GPH0CON = 0x%08x\n\r")), pGPIOReg->GPH0CON);
- pGPIOReg->GPH0CON = (pGPIOReg->GPH0CON & ~(0x3<<0)) | (0x1<<0);
- pGPIOReg->GPH0CON = (pGPIOReg->GPH0CON & ~(0x3<<0)) | (0x1<<0);
- RETAILMSG(1, (_T("AFTER-CONFIG: GPH0CON = 0x%08x\n\r")), pGPIOReg->GPH0CON);
- for(int i = 0; i < 100; i++)
- {
- pGPIOReg->GPH0DAT &= ~(1<<0);
- DelayLoop_1ms(7000);
- pGPIOReg->GPH0DAT |= (1<<0);
- RETAILMSG(1, (_T("GPH0CON = 0x%08x\n\r")), pGPIOReg->GPH0CON);
- }
复制代码
打出来的Log:
!!!GPH0 Test!!!
pGPIOReg = 0xffffffff
pGPIOReg = 0x056f0006
PRE-CONFIG: GPH0CON = 0x056f0006
PRE-CONFIG: GPH0CON = 0x056f0006
AFTER-CONFIG: GPH0CON = 0x056f0006
GPH0CON = 0x056f0006
GPH0CON = 0x056f0006
问题:
1. 为什么第一次读出来的数据是ffffffff?
2. 为什么pGPIOReg和其他GPHOCON读出来的值都是056f0006?
|
|