[Also refer to "DMA Interrupts" thread.]
Now my shared DMA IRQ is working.
I ran the test for five or six times and it never
failed or crashed. It always displayed the number
4 (1024 datasize / 256 bufsize) meaning that it
saw four descriptors reaching their ends.
The following comment was buried deep inside my
code for weeks and was never taken into cosideration
anymore.
/*
if (!TransBusAddrToStatic(
Internal, 0, PortAddress,
ulIoLen, &inIoSpace, &PhysAddr))
{
//return FALSE; i'm feeling lucky!
}
*/
Please notice the my NOTE
Lesson learned: "Only Google may be feeling lucky!!"
I actually used BusTransBusAddrToStatic this time
--
In the constructor:
CreateBusAccessHandle
(L"HKEY_LOCAL_MACHINE\\Drivers\\Active")
(still not sure about its purpose as i don't specify
a driver under Active nor it adds one to it)
--
In the destructor:
if (m_hBusAccess != NULL)
CloseBusAccessHandle(m_hBusAccess);
--
In the Hook member:
BOOL bRet = BusTransBusAddrToStatic(
m_hBusAccess,
Internal,
0,
PortAddress,
// {DMA_BASE, 0}
MapSize,
// sizeof (DMA_REG)
&inIoSpace,
// 0
&KernPhysAddr
// + 0xF0 is dma_reg->DINT
// seen by the Kernel
);
feel free to add comments...