OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 14351|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 C7 v" U+ M# W& v
  1. [code]EDMA sample test application2 D$ n2 D) T$ }+ {& @. k$ }
  2. /*
    3 v& G# [0 L! ?# N9 l
  3. * edma_test.c. T" Y8 C. @2 T% W- {& K
  4. *
    ; _2 A! j& t! R# M* Y0 `4 @! V7 _
  5. * brief  EDMA3 Test Application2 C$ O: i) G1 X1 K" l6 |* T
  6. *
    8 k2 x7 ?9 H/ P
  7. *   This file contains EDMA3 Test code.7 x* v  B, U8 v2 h( Q' D$ R. q4 z, e
  8. *+ d4 \4 n# q7 X  U6 `& c& J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , n7 }* N) `8 _# ~8 \" H' v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 A6 v+ o# }5 [- g9 C8 m4 F# }
  11. *         TO CHANGE.
    + ?- m$ y/ }0 B, w3 K
  12. *
    6 V6 ^* i- ~  k8 |5 X+ U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ P) I: W0 v1 y5 `& B
  14. *6 `" j) L1 ^1 ^& G5 }
  15. * This program is free software; you can redistribute it and/or
    5 p  |% E+ B7 [: c
  16. * modify it under the terms of the GNU General Public License as
    / Q( \2 I) Q* e5 r6 l
  17. * published by the Free Software Foundation version 2.
    * A" b' }6 @% x5 y9 v  o+ s! k
  18. *
    % P) S# X5 Z3 f+ S' L7 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % s# X" R* E: r
  20. * kind, whether express or implied; without even the implied warranty
    $ }8 b. y& X3 P8 Z! s2 n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & w6 y3 J; d( t% ~
  22. * GNU General Public License for more details.4 [- R1 Q; p" Y- ]* A
  23. */
    / b+ T8 z% B/ c+ r3 \. O
  24. - `* b8 D$ z" ?1 Q5 f- Y
  25. #include <linux/module.h>. g' D' D4 h% V) x6 Z( G9 B$ p
  26. #include <linux/init.h>
    ! D+ [7 b/ \' M  B. E
  27. #include <linux/errno.h>
    ' ]- u# d4 O  n% W: k' H+ K1 v7 Q
  28. #include <linux/types.h>  F- T, R9 F* m% p: k
  29. #include <linux/interrupt.h>
    % M5 e5 x  l0 F' U& Q/ B$ _) m0 @/ V
  30. #include <asm/io.h>
    " V; B1 p: Y; ?4 E
  31. #include <linux/moduleparam.h>
    % [# n8 C$ `4 S( n1 ]
  32. #include <linux/sysctl.h>6 @/ }7 x, L; S  ~# E
  33. #include <linux/mm.h>
    6 @6 n- D. ]+ ~# }# I4 r: V
  34. #include <linux/dma-mapping.h>
    ; o4 f( ~  f+ z  C9 {

  35. ; x1 `9 W7 o. i, U+ q
  36. #include <mach/memory.h>
    $ ]$ }9 \4 {  Z5 n* G& O+ T+ Z4 k
  37. #include <mach/hardware.h>) n8 [+ w9 R, f& _# R: a+ o! n
  38. #include <mach/irqs.h>7 M0 h  B: [# r7 W. C$ [3 I
  39. #include <asm/hardware/edma.h>
    , B8 \7 L8 w6 {, H& r( Z7 N1 f
  40. " q2 d, g7 u: L. ?# X; }; p( i
  41. #undef EDMA3_DEBUG
    0 B; H8 W# p5 l
  42. /*#define EDMA3_DEBUG*/
    # u% S# Q- ]9 J; k6 }/ l" f0 O

  43. 8 r4 m; h- H# Y( v, r. P6 U2 E
  44. #ifdef EDMA3_DEBUG+ {5 Y8 _+ e& h3 a# ~8 P8 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( U4 E3 l6 x3 y8 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 m  W* n' j" K/ Y# W& h* U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 Z; s% O$ X+ {( }
  48. #else
    % x6 Z$ D1 |. B- K& e
  49. #define DMA_PRINTK( x... )
    ) V" Y' k$ x$ A. \' Z
  50. #define DMA_FN_IN& x. p/ h( J  ]9 W4 N' h  w# H
  51. #define DMA_FN_OUT% p: R; ?; Q7 i9 o2 o% S" S$ f
  52. #endif
    # {- o1 d3 m' o  \& @3 I
  53. * L( J2 Z% G8 H2 z7 ]$ s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  A1 u7 q9 A" a- q7 E- e. c  W
  55. #define STATIC_SHIFT                3
    % \! g+ |' `' c+ D% U- E7 |( }3 l$ O
  56. #define TCINTEN_SHIFT               20* S9 D9 e8 q1 N' I7 J' d6 p: t
  57. #define ITCINTEN_SHIFT              21. i" @2 _3 C- K% Y8 G1 p6 B
  58. #define TCCHEN_SHIFT                22
    ! C. a( ~" R' @$ d" N
  59. #define ITCCHEN_SHIFT               23
    : |: F6 l/ Q% k3 C# M
  60. 4 Y# j0 v$ k: |9 s+ y* J
  61. static volatile int irqraised1 = 0;8 G, u- u. l3 e  I8 \/ U3 {
  62. static volatile int irqraised2 = 0;
    $ N) y' e5 d' [6 f$ g

  63. / c, J, Y* z: n  _8 ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 K( ?& D1 q% l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : A* f( m$ \& }, b' m8 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 q+ q1 d. t) Y1 D& X3 e' |8 Q
  67. / a2 x! X* Y& w4 i0 J5 M
  68. dma_addr_t dmaphyssrc1 = 0;2 F9 o+ I+ _- V. c& J& E
  69. dma_addr_t dmaphyssrc2 = 0;' g5 v* \! B, |
  70. dma_addr_t dmaphysdest1 = 0;
    " j$ r  F3 S1 ]5 s  g
  71. dma_addr_t dmaphysdest2 = 0;) G( D5 J5 |. W  s7 s* e
  72. 1 p6 [( v( `8 {- l: r
  73. char *dmabufsrc1 = NULL;/ G0 Q6 o8 {9 p1 }
  74. char *dmabufsrc2 = NULL;
    * t4 J3 t1 ~0 z+ Z4 l- N# j
  75. char *dmabufdest1 = NULL;
    $ i; q: B3 }5 g8 K: c5 K, ^5 W0 C
  76. char *dmabufdest2 = NULL;
    ; B6 z2 V8 y% K0 X4 A* I, j6 z

  77. ; K9 j& `0 f0 l) P$ ]+ \0 e
  78. static int acnt = 512;
    - v2 y! U7 F3 o) I4 O. T
  79. static int bcnt = 8;
    ! z( @+ d' o8 d- W* O2 I1 {; N; Z2 ~
  80. static int ccnt = 8;
    : m3 f7 g2 e) }/ E
  81. * s+ E% h: @* R3 F5 Q
  82. module_param(acnt, int, S_IRUGO);
    9 ~2 F2 w$ I6 ^9 G4 J  o3 }
  83. module_param(bcnt, int, S_IRUGO);
    5 L2 ]5 \' [$ ^8 I" @9 u: ?+ w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  W0 [+ u( k( ?% C7 R! w
5 y; D$ k6 P! v! s+ u. A! X7 q! G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* c4 N' L+ ^/ k- T- V+ I+ E2 {9 Xarm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 L/ |  @# s" K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: m2 Z0 n/ ^" I* j5 p7 a+ i, e
: i/ P8 l6 x2 r& A: L) h& }" Z" Y5 N3 I% `9 H4 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号 ) 

GMT+8, 2026-10-29 14:07 , Processed in 0.043968 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表