mini2440引脚中断输入配置

今天做一个测试软件,需要修改驱动。即把mini2440的GPIO口之GPG1(EINT9)、GPG9(EINT17)、GPG10(EINT18)设置为中断输入,Both edge triggered,参照wince5.0 BSP驱动userkey进行设置。对

IRQ = 36; //IRQ_EINT8;  GPG0
    if (!KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &IRQ, sizeof(UINT32), &g_KeySysIntr[0], sizeof(UINT32), NULL))    {
        RETAILMSG(1, (TEXT("ERROR: kEYBD: Failed to request sysintr value.\r\n")));
        return FALSE;
    }

IRQ =36。为什么是36而不是别的,根据我以往的经验,这个肯定在什么地方定义了,在MSDN中查找KernelIoControl,查到末尾也没有结果,因为这个函数调用的最后是不开源的,见不到函数原型。我转而开始查看包含的头文件,终于在s3c2440a_intr.h中找到了定义。


在初始化过程中,需要先把引脚配置成输入,然后配置中断触发方式。

s2440IOP->rGPGCON  = (s2440IOP->rGPGCON  & ~(0x3 << 2)) | (0x2 << 2);    // GPG1 == EINT9
s2440IOP->rEXTINT1 = (s2440IOP->rEXTINT1 & ~(0x7<< 4)) | (0x6 << 4);    // Both edge triggered


s2440IOP->rGPGCON  = (s2440IOP->rGPGCON  & ~(0x3 << 18)) | (0x2 << 18);    // GPG9 == EINT17
s2440IOP->rEXTINT2 = (s2440IOP->rEXTINT2 & ~(0x7<< 4)) | (0x6 << 4);    // Both edge triggered


s2440IOP->rGPGCON  = (s2440IOP->rGPGCON  & ~(0x3 << 20)) | (0x2 << 20);    // GPG10 == EINT18
s2440IOP->rEXTINT2 = (s2440IOP->rEXTINT2 & ~(0x7<< 8)) | (0x6 << 8);    // Both edge triggered

你可能感兴趣的:(c,测试,null,WinCE)