wince6.0下的GPIO口操作(s3c6410)

文章转载自:

http://blog.163.com/caina1984@126/blog/static/1016069772011112143852940/

 

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 具体不详

文章来源: http://www.cnblogs.com/urbetter/archive/2010/01/29/1659101.html

 

你可能感兴趣的:(wince6.0下的GPIO口操作(s3c6410))