怎样理解dma突发传输模式?

番茄系统家园 · 2021-08-24 15:10:16

怎样理解dma突发传输模式?

[

edit]

,,

[

edit]

,theDMAcontrollerobtainsaccesstothesystembusthesamewayasinburstmode,usingBR(BusRequest)andBG(BusGrant)signals,whicharethetwosignalscontrollingtheinterfacebetweentheCPUandtheDMAcontroller.However,incyclestealingmode,afteronebyteofdatatransfer,thecontrolofthesystembusisdeassertedtotheCPUviaBG.ItisthencontinuallyrequestedagainviaBR,transferringonebyteofdataperrequest,untiltheentireblockofdatahasbeentransferred.Bycontinuallyobtainingandreleasingthecontrolofthesystembus,theDMAcontrolleressentiallyinterleavesinstructionanddatatransfers.TheCPUprocessesaninstruction,thentheDMAcontrollertransfersonedatavalue,andsoon.Ontheonehand,thedatablockisnottransferredasquicklyincyclestealingmodeasinburstmode,butontheotherhandtheCPUisnotidledforaslongasinburstmode.Cyclestealingmodeisusefulforcontrollersthatmonitordatainrealtime.

Transparentmode[

edit]

Transparentmodetakesthemosttimetotransferablockofdata,yetitisalsothemostefficientmodeintermsofoverallsystemperformance.Intransparentmode,theDMAcontrollertransfersdataonlywhentheCPUisperformingoperationsthatdonotusethesystembuses.TheprimaryadvantageoftransparentmodeisthattheCPUneverstopsexecutingitsprogramsandtheDMAtransferisfreeintermsoftime,whilethedisadvantageisthatthehardwareneedstodeterminewhentheCPUisnotusingthesystembuses,whichcanbecomplex.

以下是我的理解

维基百科上分了三种传输模式:

突发模式

循环挪用模式

透明模式

DMA和CPU共用总线,所以这三种模式是为解决如何共用总线提供了三种方法。

突发模式:当DMA申请总线成功后会连续传送数据,而不给cpu使用总线的机会,直到数据传送完毕。比如stm32设置了4个节拍的突发传输,传输宽度位8位,则一个dma请求会连续传送4个字节,是单次传输的4倍。

循环挪用模式:这应该是常用的dma模式,就是一个dma请求就申请一次总线,传输1个字节。

透明模式:dma在总线空闲的时候传输,stm32应该是没有这个模式。

至于什么时候用突发模式,应该就是在《stm32参考手册》中提到的封装/解封:

在封装/解封数据的过程中,如果在数据完全封装/解封前中断操作,则有数据损坏的危险。

因此,为了确保数据一致性,可将数据流配置成生成突发传输:在这种情况下,属于一个突

发的每组传输不可分割(请参见第8.3.11节:单次传输和突发传输)。

为什么封装/解封会有数据损坏的危险呢?举个例子,有个外设的一组寄存器是实时联动的,也就是随着时间的变化,这组寄存器会改变。如果我们第一时刻取前一半寄存器的值,后一时刻区取后后一半寄存器的值,将两者封装起来就会损坏数据。所以我们需要在同一时刻取出所有值,这时就要用到突发传输,因为在传输时只有dma用总线,寄存器不会改变。

还有一个源和目的数据宽度什么时候会不一样呢?比如你有一个外接的小ram,只有8位数据线;有个外设寄存器,少了几根低地址线,只能32位访问,所以。。。。

上面都是自己的纸上谈兵,没在板子上试验过,所以只能提供一个思路。

展开阅读全文​

相关阅读

  • win7 联想 证书
  • win7 dma传输模式
  • 怎样理解dma突发传输模式?
  • 免责声明: 凡标注转载/编译字样内容并非本站原创,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责。如果你觉得本文好,欢迎推荐给朋友阅读;本文链接: https://m.nndssk.com/post/46198.html
    猜你喜欢
    最新应用
    热门应用