I'm directly using a WaveRT driver to retrieve PCM capture data. I'm creating a KS pin and using KSPROPERTY_RTAUDIO_BUFFER to get a pointer to the cyclic DMA buffer and using KSPROPERTY_RTAUDIO_POSITIONREGISTER to get a pointer to the mapped position register for the cyclic buffer. This generally works fine, but for some reason, after reading data for a few minutes, the hardware position register gets unmapped and dereferencing the pointer to it causes an access violation. I'm not sure how this can happen, as the documentation says this pointer should stay valid for the lifetime of the pin handle.
while (...)
{
/* Get hold of current ADC position */
if (MmIsAddressValid(HwRegister.Register)) // this is just a debug check
{
if (HwRegister.Width == 64)
StreamPos = *(volatile PULONG64)HwRegister.Register;
else
StreamPos = *(volatile PULONG32)HwRegister.Register;
}
else
{
DbgPrintEx(0, 0, "Register address %p is not valid!\n", HwRegister.Register);
break;
}
logic for copying data out of the buffer goes here...
}
Do I need some kind of heartbeat to signal that the stream should be ongoing? I would appreciate any help as to why the hardware register gets unmapped.