|
从HKEY_Local_Machine/Drivers/BuiltIn下删除后重启又自动加载了,而且BuiltIn下又出现了该驱动的键值,不知为何。而且我的驱动每次加载运行到KernelIoControl函数都会出现Data Abort数据中止异常,请高手们指教。我的GIO_Init()函数代码如下:
g_DmaBuffer = (DWORD *)VirtualAlloc(0, DMA_Buffer_Size, MEM_RESERVE, PAGE_NOACCESS);
if (g_DmaBuffer == NULL)
{
RETAILMSG(1,(TEXT("For g_DmaBuffer : VirtualAlloc failed! error code %d\r\n"),GetLastError()));
}
else
{
if (!VirtualCopy((PVOID)g_DmaBuffer, (PVOID)(DMA_Buffer_PA>> 8),
TOTAL_LENGTH, PAGE_PHYSICAL | PAGE_READWRITE | PAGE_NOCACHE))
{
RETAILMSG(1,(TEXT("For g_DmaBuffer: VirtualCopy failed!\r\n")));
}
}
RETAILMSG(1,(TEXT("DMA Buffer Pointer g_DmaBuffer: 0x%08X\r\n"),g_DmaBuffer));
RETAILMSG(1,(TEXT("Set DMA/CAM Clock Register\r\n")));
unsigned int dmaclk;
clkdiv1 = (clkdiv1 & ~(0xf<<26))|((CAMDIV & 0xf)<< 26);
dmaclk = 96000000/(CAMDIV+1);
RETAILMSG(1,(TEXT("DMA Clock(Hz):%d\r\n"),dmaclk));
hclkcon |= (1<<8)|(0x3F<<0); //DMA channel 0~6 HCLK enable//HCLK into camera enable
sclkcon |= (1<<11); // Camera clock enable
misccr = (misccr & ~(7<<8))|(3<<8);
RETAILMSG(1,(TEXT("MISCCR Register output: 0x%08X\r\n"),misccr));
g_dwDMAIrq = IRQ_DMA5;
if (!KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &g_dwDMAIrq, sizeof(UINT32),
(LPVOID)(g_vDmaISTData->g_dwDMASysIrq), sizeof(UINT32), NULL))
{
RETAILMSG(1, (TEXT("ERROR: GIO_INIT: Failed to request sysintr value for DMA interrupt.\r\n")));
return FALSE;
}
RETAILMSG(1,(TEXT("INFO: GIO_INIT: Mapped Irq 0x%x to SysIntr 0x%x.\r\n"), g_dwDMAIrq, g_vDmaISTData->g_dwDMASysIrq));
InitializeCriticalSection(&dma_Lock);
RETAILMSG(1,(TEXT("[GIO_Init]: Initialize Critical Section.\r\n")));
g_vDmaISTData->abort = TRUE;
RETAILMSG(1,(TEXT("Start to request sysintr\r\n")));
if (!InitDmaInterrupt())
{
//RETAILMSG(1,(TEXT("Fail to initialize DMA interrupt event\r\n")));
return FALSE;
} |
|