转载 usb_alloc_coherent 和 usb_free_coherent
今天做移植的时候,随手记录一下,今天所遇到的问题解决方法。
在linux2.6.34和之前的代码中还可以使用usb_buffer_alloc 和 usb_buffer_free 这两个函数,在2.6.35和之后的内核中
usb_buffer_alloc 和 usb_buffer_free这两个函数已不在使用了,可以用usb_alloc_coherent 和 usb_free_coherent代替。把驱动里分配内存与释放内存释放函数修改就好了。
这是rename的patch:
USB: rename usb_buffer_alloc() and usb_buffer_free()
For more clearance what the functions actually do,
usb_buffer_alloc() is renamed to usb_alloc_coherent()
usb_buffer_free() is renamed to usb_free_coherent()
They should only be used in code which really needs DMA coherency.
[added compatibility macros so we can convert things easier - gregkh]
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Pedro Ribeiro <pedrib@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
说是为了更好的从名字看出这个函数真实做的事情:DMA coherency
linux提供两种方式,来保证使用dma时,内存和硬件cache的一致性:
1.Coherent DMA mapping
When using this mapping, the kernel ensures that there will be no cache coherency problems between the memory and the hardware device; this means that every write operation performed by the CPU on a RAM location is immediately visible to the hardware device, and vice versa. This type of mapping is also called "synchronous" or "consistent."
2.Streaming DMA mapping
When using this mapping, the device driver must take care of cache coherency problems by using the proper synchronization helper functions. This type of mapping is also called "asynchronous" or "non-coherent."
如果采用第一种方式的话,就是由kernel来保证一致性,驱动程序是不用考虑的,这种方法的缺点是在某些体系结构上,效率很低;如果采用第二种方式的话,那么是有驱动程序来保证一致性的,所以当驱动要使用dma来进行数据传输时,必须首先检测内存和硬件cache的一致性,linux提供了这类方法。
转载 usb_alloc_coherent 和 usb_free_coherent的更多相关文章
- Crystal Clear Applied: The Seven Properties of Running an Agile Project (转载)
作者Alistair Cockburn, Crystal Clear的7个成功要素,写得挺好. 敏捷方法的关注点,大家可以参考,太激动所以转载了. 原文:http://www.informit.com ...
- RTP与RTCP协议介绍(转载)
RTSP发起/终结流媒体.RTP传输流媒体数据 .RTCP对RTP进行控制,同步.RTP中没有连接的概念,本身并不能为按序传输数据包提供可靠的保证,也不提供流量控制和拥塞控制,这些都由RTCP来负责完 ...
- 《Walking the callstack(转载)》
本文转载自:https://www.codeproject.com/articles/11132/walking-the-callstack Download demo project with so ...
- [转载]MVVM模式原理分析及实践
没有找到很好的MVVM模式介绍文章,简单找了一篇,分享一下.MVVM实现了UI\UE设计师(Expression Blend 4设计界面)和软件工程师的合理分工,在SilverLight.WPF.Wi ...
- [转载]:STM32为什么必须先配置时钟再配置GPIO
转载来源 :http://blog.csdn.net/fushiqianxun/article/details/7926442 [原创]:我来添两句,就是很多同学(包括我)之前搞低端单片机,到了stm ...
- [转载]从MyEclipse到IntelliJ IDEA-让你摆脱鼠标,全键盘操作
从MyEclipse转战到IntelliJ IDEA的经历 注转载址:http://blog.csdn.net/luoweifu/article/details/13985835 我一个朋友写了一篇“ ...
- TCP同步与异步,长连接与短连接【转载】
原文地址:TCP同步与异步,长连接与短连接作者:1984346023 [转载说明:http://zjj1211.blog.51cto.com/1812544/373896 这是今天看到的一篇讲到T ...
- 在CentOS 7/6.5/6.4 中安装Java JDK 8(转载)
转载在CentOS 7/6.5/6.4 中安装Java JDK 8 首先,在你的服务器上运行一下更新. yum update 然后,在您的系统上搜索,任何版本的已安装的JDK组件. rpm -qa | ...
- 用C#实现MD5的加密(转载)
方法一 首先,先简单介绍一下MD5 MD5的全称是message-digest algorithm 5(信息-摘要算法,在90年代初由mit laboratory for computer scien ...
随机推荐
- WinIo驱动级键盘模拟编程
转自:http://blog.sina.com.cn/s/blog_455d7a320100vr37.html 前天无聊,翻翻自己的兴趣项目文件夹,发现了这个放下很久的项目!那是大三时候的事了.当时是 ...
- Java当中的异常2
1.throw的作用 如果一行有可能代码抛出Execption对象或者check exception 就必须对这行代码进行处理 2.throws的作用 Throws表明这个类或者方法可能会产生一个指定 ...
- Assembly.LoadFrom加载程序集无法释放资源的解决方案
下面此方法加载程序集会导致程序集一直被占用 Assembly asm = Assembly.LoadFrom(dllPath); 解决方案: //通过此方法读取可以解决dll被占用问题 byte[] ...
- oracle中的listener.ora和tnsnames.ora
一.oracle的客户端与服务器端 oracle在安装完成后服务器和客户端都需要进行网络配置才能实现网络连接. 服务器端配置监听器,客户端配置网络服务名. 服务器端可配置一个或多个监听程序 . ...
- servlet 拦截器 (filter)
使用: 创建一个类实现javax.servlet.Filter接口,并重写接口中所有的方法: 在web.xml配置所需要拦截的请求. 过程说明: 1>在应用启动的时候就进行装载Filter类(与 ...
- CMC+混频v103测试(scrt,vbs文件)
Sub Main Dim cnte Dim cnt Dim delay Dim time Dim onetime onetime = 9999999 delay = 5000 time = 700 F ...
- Idea使用说明
快捷键 ctrl + alt + b : 查找接口的实现类 ctrl + h : 查找类或接口的继承关系 double shift : 搜索任何地方 ctrl + shift + n : 查找文件 c ...
- DDoS攻击及防御措施
SYN flood 伪造大量的源IP地址,分别向服务器端发送大量的SYN包,此时服务器端会返回SYN/ACK 包,因为伪造的IP并不会答应,服务器端并没有收到伪造的IP的回应,会重试3~5次并等待一个 ...
- Django中cookie和session使用
cookie和session的简单使用 def cookie(request): """ 操作cookie """ resp = HttpR ...
- asp.net core 使用NLog记录日志到txt文件
一.使用VisualStudioCode创建一个webapi项目(也可以是mvc等).一个类库(用于封装记录日志方法,当然如果使用依赖注入到控制台项目,就不需要此类库了). 二.在类库中添加NLog. ...