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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& e( C0 S3 S% B  l  t/ q/ n3 z
  1. [code]EDMA sample test application
    9 D+ s" u1 L+ b& J6 J
  2. /*
      A2 L& J7 D; F! J# _/ m- Y
  3. * edma_test.c5 o: @, N& b7 I7 [( g- v
  4. *
    3 ^3 a/ f* q7 N: _2 b3 b3 M1 E% e& L
  5. * brief  EDMA3 Test Application4 C- e, [% [- l0 C& s5 E/ x
  6. *7 B6 o3 b9 k, d. g* H
  7. *   This file contains EDMA3 Test code.
    0 [8 C* _! H5 w6 x1 p
  8. *
    5 y; E2 h7 z  R# l9 z0 L- F! W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) v9 O. q. I0 O- I0 @& d, W4 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( O2 E+ w# }) R0 ^+ r6 X+ t' C
  11. *         TO CHANGE.
    # M: O4 V: j1 ^- E, W
  12. *
    ' D! V5 k4 |. Y( O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: J: S4 F; x9 r; b1 y% c0 K- n) T
  14. *( P; y! u. y) K' l$ x
  15. * This program is free software; you can redistribute it and/or7 k! A8 q2 h+ k9 a. c: _( q
  16. * modify it under the terms of the GNU General Public License as
    ; n8 Z/ b# q" i& l
  17. * published by the Free Software Foundation version 2.
    . P' L/ z3 |' l7 w
  18. *  G- F8 h% g  K3 E  ]' W3 S* Q0 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      X: W! T4 ]4 Q' j+ H, S
  20. * kind, whether express or implied; without even the implied warranty' h8 G+ [5 v6 ]1 V7 F" y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 u9 I( ^' g; h. x( e1 f' T
  22. * GNU General Public License for more details.
    4 I* ?, Y) i* Y# U  i; {( `
  23. */: w0 O6 z- s3 h9 Z+ {
  24. & w* S. @8 I7 u+ {0 y$ S/ n1 d" F% V
  25. #include <linux/module.h>
    - E  ~7 K* e5 i( K9 H  X( K
  26. #include <linux/init.h>
    : L5 D5 L: F3 I
  27. #include <linux/errno.h>+ P0 Q& D3 }) T0 d
  28. #include <linux/types.h>7 O' W, x! w+ g  }# _% t! ?! k
  29. #include <linux/interrupt.h>7 O" l( @/ ?& ~( S$ i0 q
  30. #include <asm/io.h>8 p! C# }1 S% t
  31. #include <linux/moduleparam.h>8 P2 A# ]4 ]7 w
  32. #include <linux/sysctl.h>, w4 g+ E% ]$ Q- ]5 U" Z" G
  33. #include <linux/mm.h>  s" |) D( Q( Q
  34. #include <linux/dma-mapping.h>
    ' o  q1 }9 F) B7 s

  35. ) @+ I0 C2 c7 u/ M7 f* T6 j
  36. #include <mach/memory.h>
    * R. ?6 C7 M9 F) g* L; p" c$ W
  37. #include <mach/hardware.h>
    0 x" i4 l( B2 X' w4 U
  38. #include <mach/irqs.h>7 D( q: l8 L# b6 y  [9 M. |
  39. #include <asm/hardware/edma.h>
      e! b$ g4 [* F0 v; `( I6 X
  40. 4 s* o$ [( S5 R% Q
  41. #undef EDMA3_DEBUG
    $ s( v, T8 Z3 o; F7 ^
  42. /*#define EDMA3_DEBUG*/
    4 _: Y& ?) u. W) q9 p6 F: _& b

  43. + f- X& v5 K4 ?4 Q! C: v
  44. #ifdef EDMA3_DEBUG8 x5 `3 Y7 y9 c, c# }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# W" m! D) f7 `8 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); ?- }5 [8 N8 z1 f9 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( ?6 M# D, P+ s( M6 @+ B' P4 e
  48. #else
    1 S" N/ G1 z: w; D$ e, K
  49. #define DMA_PRINTK( x... )2 p: m1 ]' t+ K
  50. #define DMA_FN_IN
    & B. ]; M! f+ T/ O' h0 G
  51. #define DMA_FN_OUT
    5 F9 G# J6 V7 B0 ?$ Y  R# o) M8 |1 e
  52. #endif
    9 ]4 N# k4 a/ @# C* J
  53. : S- u& C4 G& i/ A2 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / }. w% s1 ~* ]# }5 d
  55. #define STATIC_SHIFT                36 Z2 @! j+ p0 u/ ]* q
  56. #define TCINTEN_SHIFT               205 N6 D9 M6 s* y
  57. #define ITCINTEN_SHIFT              21& a% _  _& A) C5 i# ~
  58. #define TCCHEN_SHIFT                22
    4 C- c8 \/ L+ h% o' \2 {: O$ s+ g
  59. #define ITCCHEN_SHIFT               23
    ' c/ P8 v2 M+ A7 s2 ^3 G% ^5 ~+ G

  60. 8 g8 _& m9 I- p/ Q: S  z! D
  61. static volatile int irqraised1 = 0;9 H, `+ @$ ]6 Q; }5 f
  62. static volatile int irqraised2 = 0;% N( Z- K; R, d5 M* z$ b
  63. 0 `' s7 A. P5 \( O2 S/ K- b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 R3 a! ]& {& ]) ]( Y/ g1 H" f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 |/ ]' K/ z# L/ a( c8 q3 r- b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # A6 k! A+ h7 ?1 a, {

  67. ( ^% u7 f4 f6 {
  68. dma_addr_t dmaphyssrc1 = 0;1 }# P6 d8 R" A9 G6 L
  69. dma_addr_t dmaphyssrc2 = 0;' w+ Q  r1 `2 [0 @: @
  70. dma_addr_t dmaphysdest1 = 0;8 h* ]/ E3 |5 Q& T" D
  71. dma_addr_t dmaphysdest2 = 0;5 s% O( h. W0 ^+ e! Y

  72. " y; S' }) |8 ~9 p0 [
  73. char *dmabufsrc1 = NULL;( k& Z! U1 b/ |9 Q+ [& k8 L# \$ A
  74. char *dmabufsrc2 = NULL;
    # V, }( W" K" ]& N9 V( F) M( [
  75. char *dmabufdest1 = NULL;8 a" J1 ^1 J) a
  76. char *dmabufdest2 = NULL;- Z6 N5 {' z' {8 c. d' d

  77. 9 h. Z5 A/ C" b/ ?# V
  78. static int acnt = 512;0 `6 k- X! a3 }8 t
  79. static int bcnt = 8;
    - d/ i$ X, e6 t" O; u1 u* ~
  80. static int ccnt = 8;
    + p& C9 q( q6 T. V; r/ [1 E% @

  81. ' ?' e, f0 l/ Y7 p* `0 ?: l
  82. module_param(acnt, int, S_IRUGO);
    6 n; f8 N% c0 s2 @! Q8 j  x' H
  83. module_param(bcnt, int, S_IRUGO);
    * A# Z5 }. D6 \7 d! Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! {: ^. X) E0 y3 {' F
- ^- M$ q+ Z0 y. x& H  n6 O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 }7 v8 k6 Q: X6 ~; X! k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; \1 d7 x- C# L- O  |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: x3 c6 _- D5 ^1 p8 J1 Q1 E& s2 f) z% D) l2 y6 g, p1 R+ p, c& s

* T% G0 v" e" G+ o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 10:04 , Processed in 0.042842 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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