Hi all,
In my pc camera driver, there must be a SRB_READ_DATA command function, such
as "VideoReadData" named, to receive images captured from digital camera into
SRB data buffer. This will make a pc camera preview function on PC. At
VideoReadData function, I use the ExInterlockedInsertTailList API function to
queue each incoming SRB. But I find that it must be after calling
StreamClassStreamNotification, a new SRB is still passed into VideoReadData
function. This will make SRB queue nonsense because there is only one SRB in
the queue at a time. Is there any method or setting to queue more incoming
SRBs at a time?
Sample code as followings,
typedef struct {
LIST_ENTRY ListEntry;
PHW_STREAM_REQUEST_BLOCK pSrb;
ULONGLONG FrameNumber;
} *P_SRB_EXTENSION;
typedef struct {
LIST_ENTRY PendingIoList;
KSPIN_LOCK PendingIoListSpin;
LIST_ENTRY CompletedReadSrbList;
KSPIN_LOCK DispatchSpinLock;
}*P_DEVICE_EXTENSION;
int VideoReadData(PHW_STREAM_REQUEST_BLOCK pSrb)
{
P_DEVICE_EXTENSION pDevExt = (PS_PA_DEVICE_EXTENSION)
pSrb->HwDeviceExtension;
P_SRB_EXTENSION pSrbEx = (PS_PA_SRB_EXTENSION)pSrb->SRBExtension;
ExInterlockedInsertTailList( &(pDevExt->PendingIoList),
&(pSrbEx->ListEntry),
&pDevExt->PendingIoListSpin);
{
//actions to fill in SRB data buffer
...
...
...
}
StreamNotification(pSrb,StreamRequestComplete);
return 0;
}
Regards, Allen