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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! R! @# W$ @& r3 }0 [5 {3 ?
  1. [code]EDMA sample test application$ I: m. Q3 Q8 L7 x4 B7 g9 ~
  2. /*
    * E  w2 u1 Q9 x& p* ]: Z
  3. * edma_test.c
    - u) N) O5 L5 F/ E. o
  4. *
    . L9 `2 i$ P0 v6 |! w% u8 f
  5. * brief  EDMA3 Test Application
      e' m- ]5 q) f
  6. *
    ; b  W" j& a& V8 c+ F6 O
  7. *   This file contains EDMA3 Test code.% B, q+ k/ j% H5 c; y
  8. *9 U9 ~0 a# s; K. U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 M) f! M  ]8 ]6 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) W, F. a, B) O% A
  11. *         TO CHANGE.
    - t9 Z; ^3 ~9 b5 v
  12. *
    8 _  Y' q* r9 r& Y5 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; H+ d1 j  d, T
  14. *: @- c" s( g2 ^& u
  15. * This program is free software; you can redistribute it and/or
    ' d- \7 ?2 S  q" ?
  16. * modify it under the terms of the GNU General Public License as
    $ p2 T" d3 ^9 f# b: @* ^+ q
  17. * published by the Free Software Foundation version 2.* }* G/ R" N& m; Z8 c
  18. *
    + s- b  E* _# m* o- s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : V! x2 t8 e# y; s- B* I0 s
  20. * kind, whether express or implied; without even the implied warranty, T4 t" H. O. y5 L- |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 y4 u5 A8 C; n, \, T! l! o
  22. * GNU General Public License for more details.
    2 Q% Y. u3 H( R% e' o) B
  23. */
    * P- j1 S$ e8 H/ F
  24. 6 J; }; \+ w! R- ?) ~
  25. #include <linux/module.h>
    1 I7 I. z; A/ B% _6 _7 M; b6 W
  26. #include <linux/init.h>) l! C+ q+ V# q4 M8 G7 W
  27. #include <linux/errno.h>
    : R4 K9 Y6 \" S. ^1 [' J" m8 @+ j
  28. #include <linux/types.h>  ?# }( _: |2 G- w3 W/ l1 G
  29. #include <linux/interrupt.h>
    ( J9 b" R& _$ z8 ]! z. l; z
  30. #include <asm/io.h>
    # N4 R* V  ^' z3 V0 m$ W
  31. #include <linux/moduleparam.h>3 @8 ]6 a1 T+ H1 [
  32. #include <linux/sysctl.h>6 L/ |. p0 n1 ^% E& {
  33. #include <linux/mm.h>+ _" `+ }$ ^6 ?% L8 f
  34. #include <linux/dma-mapping.h>
    % S6 U2 H3 G# |9 P2 W
  35. ! E% v" B4 P7 f$ N; S6 B  O5 T
  36. #include <mach/memory.h>$ H# L+ g6 o8 V; t, l6 R
  37. #include <mach/hardware.h>' k* `3 ^( d. ~
  38. #include <mach/irqs.h>4 c0 X8 U. K; X9 `# Q9 K
  39. #include <asm/hardware/edma.h>
    : R. O/ i0 h2 `0 I5 t" ?

  40. * F0 X$ x& }# L
  41. #undef EDMA3_DEBUG
    $ a- V7 u+ k% n( i) k# E, v
  42. /*#define EDMA3_DEBUG*// J3 ^1 @4 z. ~' x

  43. $ e+ U  c: X& S+ }$ b  s) l
  44. #ifdef EDMA3_DEBUG
    ! R9 J- l& H5 v  k2 f& l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); G& w. C9 d: `* A3 `- J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 B6 s1 l$ s8 [+ H; V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! h6 c+ X+ _6 Z5 R  v  C5 z
  48. #else9 {' Q5 N8 r% u+ C) w1 g7 Z
  49. #define DMA_PRINTK( x... )
    * x" v( B: U/ m
  50. #define DMA_FN_IN" X7 t  r4 Z8 M% l3 f- `
  51. #define DMA_FN_OUT/ L8 i/ Q& I7 Y2 U7 Z
  52. #endif2 L2 h) a* D8 B

  53. # H! x8 U) Q# d) u6 U" \, [. c) p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * }3 }5 Z* s( _  |
  55. #define STATIC_SHIFT                3
    - M! a9 H9 o- S
  56. #define TCINTEN_SHIFT               20
    6 e* c; o  Q/ ]) C2 N
  57. #define ITCINTEN_SHIFT              219 G# C9 Z. Z( E8 s6 N$ \$ g
  58. #define TCCHEN_SHIFT                222 E: P/ n. \9 @+ w5 `
  59. #define ITCCHEN_SHIFT               237 ]9 v: w5 @9 w( r

  60. ' g4 s2 _) |. Y% d0 i3 i
  61. static volatile int irqraised1 = 0;
    ) u3 F0 j! \# F, a+ |
  62. static volatile int irqraised2 = 0;
    " ]4 }+ r( r7 v3 f3 M, v

  63. # d. M/ R: q: n$ P3 U6 J' l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 I6 E2 q1 J+ |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 r3 j7 g& n. U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- w( P: {% _* ?" U7 T' G+ a

  67. 4 M; I& I0 o* c7 }; A0 ~0 T; g  T4 V" q
  68. dma_addr_t dmaphyssrc1 = 0;
    9 x, P5 p9 w6 n# p6 j2 T  \
  69. dma_addr_t dmaphyssrc2 = 0;
    ( f6 L1 G' p6 s7 p
  70. dma_addr_t dmaphysdest1 = 0;
    & o+ \9 h/ w' N8 \5 N+ o/ k, m3 F
  71. dma_addr_t dmaphysdest2 = 0;* P# L. o# k* E  @  p  g5 n

  72. 6 z2 W  |8 G# Q. ~/ _& w
  73. char *dmabufsrc1 = NULL;
    0 {  `, u  l5 t' E) h
  74. char *dmabufsrc2 = NULL;, i' e# E- H5 _- r5 `
  75. char *dmabufdest1 = NULL;
    : R. N, ]( S: A3 o, f- W
  76. char *dmabufdest2 = NULL;
    5 s. w; S6 F0 Q
  77. $ u" }' \$ x; ~4 z) A- g+ _7 `4 Q
  78. static int acnt = 512;4 K8 ?$ ~( M4 I0 ~4 ^/ A
  79. static int bcnt = 8;) F- q9 ]4 B7 h1 [, l$ J6 }. H4 a; r
  80. static int ccnt = 8;
    0 C/ o* e# I: M: I

  81. : m% Q4 _5 \* `. p
  82. module_param(acnt, int, S_IRUGO);
    9 i. M0 l$ k! i: ~; }
  83. module_param(bcnt, int, S_IRUGO);' K2 K3 O" }  N7 L1 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" U  y. v5 e/ z& }9 |
) D# _' C& Q) V9 x5 z: b7 l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* E* u0 I/ w, p* y. Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. c# Q( j3 T8 z& W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 G, X/ D! ^& b5 c
1 c4 y/ x2 F; V6 l9 g) n7 T8 E1 _2 Z
/ v7 _; ^% p+ X0 I& H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 07:28 , Processed in 0.052010 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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