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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; @0 H' ]( t. L7 J, x  ?5 Y
  1. [code]EDMA sample test application* P. v/ k( q2 C! i# e! q6 I
  2. /*
    $ @& ^; i7 U( L% X8 {5 K
  3. * edma_test.c) o6 [' B8 b( [- x9 c
  4. *
    2 K2 o4 Z. p3 H
  5. * brief  EDMA3 Test Application
    ; e7 {% {; j9 {: W; c$ T
  6. *
    8 b( s/ w5 E+ [9 u
  7. *   This file contains EDMA3 Test code.9 E/ ], g9 I( J6 Q, ]* n, j
  8. *
    ) P  O9 F- J4 c) k( O( j2 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " K- k$ {& N- V  r& i! i3 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 T5 @- b+ W: ]8 Y% N" }7 E% K
  11. *         TO CHANGE.( C, v9 |: m# b; W: s
  12. *
      s8 Y/ I3 @! e) j! x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- w5 W+ S' ~* C, ?! |! }
  14. *
    ( `  w# @9 ?$ t9 \, k1 |+ v
  15. * This program is free software; you can redistribute it and/or
    5 O5 R3 T6 G* a2 c7 ~, K
  16. * modify it under the terms of the GNU General Public License as
    ' ?1 J! ]- l! I* n! e0 T6 F+ u- t
  17. * published by the Free Software Foundation version 2.
    . Z- g$ V" ]" e& w. @
  18. *. v, S+ N$ ~1 d% r$ N7 ~2 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 Q  O5 \6 M2 U) e
  20. * kind, whether express or implied; without even the implied warranty
    8 {7 K' ^. \- h- i, k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) G, C  [1 [1 T) {% W6 z# p( U" X( a
  22. * GNU General Public License for more details.
    + \- e$ C  G& u5 V' c2 w2 W
  23. */
    ' \; s% A# z4 `
  24. / c2 T, |2 P! Y  D! B
  25. #include <linux/module.h>5 P# ]' \& f5 @* `6 B) v) p
  26. #include <linux/init.h>3 T1 c- M+ \- d; D( B: L2 Q
  27. #include <linux/errno.h>
    : Y; H) \9 N0 T3 _! n
  28. #include <linux/types.h>
    ; X3 _+ ?8 W7 l6 b2 z: i' L
  29. #include <linux/interrupt.h>
      ~7 _6 s( s/ S
  30. #include <asm/io.h>3 Y8 [, |$ ?! }; f+ w2 W: k1 q
  31. #include <linux/moduleparam.h>* @8 L" B  |& v# u
  32. #include <linux/sysctl.h>
    5 J8 |: t0 ~( B4 A% S
  33. #include <linux/mm.h>  f0 y  b0 I* l7 j- J9 V' L0 D
  34. #include <linux/dma-mapping.h>. i1 B! H( C5 C# V  [% E/ H9 I

  35. 0 h& ^7 A4 K  j! U2 R$ s* X6 R5 I3 a* ?
  36. #include <mach/memory.h>+ k; r% x) i  [
  37. #include <mach/hardware.h>7 G1 V/ }5 r( M3 F4 o
  38. #include <mach/irqs.h>9 L; |# N2 P- n1 m
  39. #include <asm/hardware/edma.h>0 w' R+ o' W4 B# ^! k
  40. 5 ^6 d; |0 Z# r% |+ Q8 Z
  41. #undef EDMA3_DEBUG, Q4 c& X: [( j5 A2 @* z  s- I
  42. /*#define EDMA3_DEBUG*/
    " r) c0 d7 w. p7 i2 }& N" [1 w

  43. 1 j  G0 d) u7 y& h
  44. #ifdef EDMA3_DEBUG
    1 |8 n; O$ ^3 x/ L# u3 p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' @& ^& r2 \+ V! v. \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 k$ i) T6 Q& t& H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 C6 `0 `8 Y5 l& a' L' G
  48. #else9 D! l9 _. `+ ^1 E0 [8 i$ A3 a
  49. #define DMA_PRINTK( x... )
    , E$ b, X/ u/ r: A* r
  50. #define DMA_FN_IN
    3 V2 U) i8 _6 {. x
  51. #define DMA_FN_OUT
    , e4 r9 }1 C, @" c- E- W
  52. #endif
    5 ^- b! e  U( v1 j3 A; V9 L8 u

  53. 8 _9 d0 b: u- t9 O8 f4 d4 e8 ]! g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 d9 }" }* c7 j) n  g' M0 C( Z9 M3 u
  55. #define STATIC_SHIFT                3; ^: i$ N2 n3 Y' e2 M( }3 H2 I
  56. #define TCINTEN_SHIFT               20
    : f8 R3 s0 u& E7 [6 R+ e, t
  57. #define ITCINTEN_SHIFT              21
    2 E% y) k1 a% I3 ~5 j8 u
  58. #define TCCHEN_SHIFT                22% f  x4 D9 A( h
  59. #define ITCCHEN_SHIFT               230 B: @- u% i/ [* e

  60. 1 X! a7 F. `+ A
  61. static volatile int irqraised1 = 0;
    $ H( s- I" n# {  U) k" \9 N
  62. static volatile int irqraised2 = 0;! m; ?- P! \8 `4 P1 h9 T# u# X

  63. : j( ?7 T6 f- f. o; }) O" o7 V. N" t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 N! e! L, P" K3 }5 o. `$ T' H8 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 k/ r. R' B2 N% o6 x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! K" i7 ]% n+ p/ B9 O; \
  67. . q0 J& b( r4 [! F5 R. i3 x
  68. dma_addr_t dmaphyssrc1 = 0;
    ; |5 A5 V6 ^7 W7 T
  69. dma_addr_t dmaphyssrc2 = 0;
    # i. s0 j9 G# c& T; q) s5 K
  70. dma_addr_t dmaphysdest1 = 0;
    * |6 C4 k$ O/ h6 V# ^( a8 h
  71. dma_addr_t dmaphysdest2 = 0;$ o9 V7 f% ?) q6 g
  72. 0 x+ j1 a/ L8 e* [0 U# P. w
  73. char *dmabufsrc1 = NULL;& \) ~' z+ y7 }9 x9 l% p, F- w. J# m/ u
  74. char *dmabufsrc2 = NULL;0 e/ M+ B2 Q' G: f8 b
  75. char *dmabufdest1 = NULL;
      b) ]- |3 c# h$ m
  76. char *dmabufdest2 = NULL;( b9 C0 N. U" _7 e, w8 }# k1 k# |0 P& n

  77. 1 P3 C& \# F! E" [# @: q$ i
  78. static int acnt = 512;' W  @  f- r# O, P) w
  79. static int bcnt = 8;
    - |& F5 p/ k+ W" n1 O
  80. static int ccnt = 8;% r2 b/ x; ?( B* U; @+ z9 I3 g
  81. ) a! ]) [) c9 Q9 c* W
  82. module_param(acnt, int, S_IRUGO);
    & m+ Q& C7 A  {1 B( h& |% x
  83. module_param(bcnt, int, S_IRUGO);
    6 C- d5 j0 Y- F! t9 _9 L' x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  }; r& M: A* N0 K5 q& G) C6 c6 J' p3 q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 C# i3 x& }. n4 j# }4 g; c
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. H6 t: Z  s7 p9 q  O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% i4 s; y5 I& m/ ]/ k. A. y6 |

9 y" }  o5 R& w/ p; [$ Z' i, B- @: ^' j# t0 d4 H: @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 21:44 , Processed in 0.038969 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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