Hi! All,
I’m working on a sensor driver which should automatically read and return data periodically based on the period. The data reading works fine before I implement the EVT_WDF_TIMER call back function, but I get Assertion failure after…
Below are the error log:
Assertion failure - code c0000420 (first chance)
AK8975!DbgRaiseAssertionFailure+0x5:
95801085 cd2c int 2Ch
And below are my codes (interesting parts only):
VOID
ADRV99EvtIoRead (
WDFQUEUE Queue,
WDFREQUEST Request,
size_t Length
)
{
NTSTATUS status;
ULONG_PTR bytesCopied =0;
WDFMEMORY memory;
//Set for Timer
WDF_TIMER_CONFIG timerConfig;
WDF_OBJECT_ATTRIBUTES timerAttributes;
WDFTIMER timerHandle;
BOOLEAN blWdfTimerStart;
UNREFERENCED_PARAMETER(Queue);
UNREFERENCED_PARAMETER(Length);
PAGED_CODE();
status = WdfRequestRetrieveOutputMemory(Request, &memory);
if(NT_SUCCESS(status) ) {
WDF_TIMER_CONFIG_INIT(&timerConfig, ADRV99EvtTimerFunc);
timerConfig.AutomaticSerialization = TRUE;
WDF_OBJECT_ATTRIBUTES_INIT(&timerAttributes);
timerAttributes.ParentObject = Queue;
status = WdfTimerCreate(&timerConfig, &timerAttributes, &timerHandle);
blWdfTimerStart = WdfTimerStart(timerHandle,WDF_REL_TIMEOUT_IN_MS(10));
}
}
VOID
ADRV99EvtTimerFunc(
__in WDFTIMER Timer
)
{
WDFDEVICE device = WdfIoQueueGetDevice((WDFQUEUE)WdfTimerGetParentObject(Timer));
UCHAR ReturnData[10]; //10 bytes Data
int i;
NTSTATUS status;
readData(device, ReturnData);
}
I have tried to adjust the “period” of WdfTimerStart, but nothing changed. Any advise is highly appreciated!
-tftu