EvtProgramWriteDma called again

Because of limitations in scatter gather hardware the scenario in which my DMA transfer can’t complete the entire transfer may arise as I setup my hardware(I can’t switch to packet based transfers). Such that I may only program a partial sglist and I won’t know this in advance so I will have to set a flag and store current progress. In this case I was thinking I’d save my WDFTRANSACTION, WDFCONTEXT, WDF_DMA_DRECTION, and current location in PSCATTER_GATHER_LIST and manually call EvtProgramWriteDma again in my DPC. Before I try this and hope it works properly I thought I’d ask if this is valid and if there is another way(better way) to achieve this by possibly reinitializing the transfer. I can’t find functions to handle this scenario but perhaps I’m missing something.

It would be nice to use WdfDmaTransactionInitialize for each additional call but I started with WdfDmaTransactionInitializeUsingRequest and don’t know if it is possible to take my remaining SGL and pass the current pointer position and convert it somehow to the MDL expected by WdfDmaTransactionInitialize

I see I can call WdfDmaTransactionSetMaximumLength() which is helpful and WdfDmaTransactionInitializeUsingRequest() can return STATUS_WDF_TOO_FRAGMENTED. But I see no way to indicate what constitutes too fragmented. I can come up with a value but how does the framework know what what is too fragmented for my hardware? I don’t see a method to set that value like i can set the maximum length.

And if I can set this Too_Fragmented_Value, how then do I resize the buffer to adjust? Do I call WdfDmaTransactionSetMaximumLength() again with a somewhat smaller length until WdfDmaTransactionInitializeUsingRequest() succeeds?