GPIO口的操作

GPIO的操作流程大致为:
volatile S3C6410_GPIO_REG *pIOPregs = NULL;  // GPIO registers
 
     pIOPregs = (volatile S3C6410_GPIO_REG*)TSP_RegAlloc((PVOID)S3C6410_BASE_REG_PA_GPIO, sizeof(S3C6410_GPIO_REG));
    if (pIOPregs == NULL)
    {
  RETAILMSG(1,(TEXT("HcdPdd_Init -> g_pIOPregs: VirtualAlloc failed!\r\n")));
    }
 
 pIOPregs->GPEPUD = (pIOPregs->GPEPUD & ~(0x3<<8)) |(0x1 << 8);      //gpe4 pull down enable
 pIOPregs->GPECON = (pIOPregs->GPECON & ~(0x3<<16)) | (0x1<<16);  //GPE4 as output port
 pIOPregs->GPEDAT = (pIOPregs->GPEDAT & ~(0x1<<4)) ;
 
 
地址映射也可以用
 g_pGPIOReg = (S3C6410_GPIO_REG *)DrvLib_MapIoSpace(S3C6410_BASE_REG_PA_GPIO, sizeof(S3C6410_GPIO_REG), FALSE);
A000 0000 - C000 0000是无缓存的
8000 0000 - A000 0000是有缓存的
DCD     0x91600000, 0x56000000,  1      ; I/O Port register 有说是:0x41600000+(0x8000 0000 - 0x3000 0000) = 0x91600000 具体不详
原文地址:https://www.cnblogs.com/xfdarm/p/1659101.html