Windows内核驱动如何让高速缓存(Cache)失效,
做视频采集卡,采集的视频总是有雪花点,发现DMA传输完成后,驱动取到的数据是不正确的,怀疑是内存与高速缓存(Cache)不一致引起的
使用AllocateCommonBuffer分配内存,看API说明在WIN7及之前版本,CacheEnabled参数是被忽略的,求教各位大神如何在DMA操作完成时,进行刷新。
CacheEnabled
Specifies whether the allocated memory can be cached.
**This parameter is ignored. **The operating system determines whether to enable cached memory in the common buffer that is to be allocated. That decision is based on the processor architecture and device bus.
On computers with x86-based, x64-based, and Itanium-based processors, cached memory is enabled. It is assumed that all DMA operations performed by a device are coherent with the relevant CPU caches, which might be caching that memory. If your driver needs to disable caching, call AllocateCommonBufferEx instead.