OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; Z, O2 ~0 z. x% }  h
  1. [code]EDMA sample test application. g4 D) e. Q, @; k
  2. /*: \( B" K9 X; U# {
  3. * edma_test.c( c1 K& q( _/ W/ a9 ]! [
  4. *
    + a. |' w6 B1 ^/ O7 t2 a9 N+ G8 w
  5. * brief  EDMA3 Test Application4 @% X% o) m. J8 X1 \
  6. *" g7 E" a" J2 e6 }; J
  7. *   This file contains EDMA3 Test code.
    3 t5 g5 n' X, v. u( T3 d: P" \0 G& r
  8. *
    4 y& D+ H3 k7 F; n2 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( J/ P+ C% f! x9 V; d. m0 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' d: m- ?, q! `
  11. *         TO CHANGE.
    $ F! l) c3 u0 w! a# S
  12. *
    7 v4 l+ j2 B5 A; n7 ~+ I. S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; z/ p8 u- w+ f$ Z, b4 @; n* A& D
  14. *
    / W0 s. C. I3 E6 ]& @& a- a
  15. * This program is free software; you can redistribute it and/or
    ! @$ F* d4 {. X: ?
  16. * modify it under the terms of the GNU General Public License as1 ?8 q5 r: r% a: w9 a
  17. * published by the Free Software Foundation version 2.& _& {8 {! b. g- {" H$ n: v
  18. *( m1 ^# ^# I$ l+ r% z. l+ [* E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ Z* R- |  w/ V) Y/ _+ W+ {& y  B1 |
  20. * kind, whether express or implied; without even the implied warranty
    2 O; ~, E1 g9 W3 b3 z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 W* S: _/ @6 ~7 g) Y
  22. * GNU General Public License for more details.
    # C, e1 Y' B6 E; Z6 n8 w8 D2 \. i
  23. */
      B1 E, l: [& m! H/ L, ?" l

  24. 4 M& K5 w$ h5 i4 ^5 C3 n6 B
  25. #include <linux/module.h>
    $ ~# r4 q  P- M4 H
  26. #include <linux/init.h>5 u3 H& D! C& `8 l& B3 P  H, ?
  27. #include <linux/errno.h>
    & x3 i! S5 L* e/ |6 m6 R! M
  28. #include <linux/types.h>7 \: G9 O  F$ |% A( a* G% n% ^
  29. #include <linux/interrupt.h>
    " G: ~9 E: t  U' c1 j
  30. #include <asm/io.h>
    & Z' c) `) O% K1 x/ V3 o
  31. #include <linux/moduleparam.h>
    , b* h2 `; w! ^! z
  32. #include <linux/sysctl.h>6 p/ V2 z& \  ]# V. T2 Y
  33. #include <linux/mm.h>
    1 o+ r. L1 C  G& W
  34. #include <linux/dma-mapping.h>
    & k9 O3 I0 O8 d2 r! V  \

  35. % n& x& u, G6 i& a9 _! `) T) c
  36. #include <mach/memory.h>
    - J/ @9 ?) r* p, L, ]6 x
  37. #include <mach/hardware.h>
    / r2 }+ h% e- s0 C4 P" e/ ~
  38. #include <mach/irqs.h>- w) w- f! H$ \8 x" N* }1 b
  39. #include <asm/hardware/edma.h>
    8 T0 B$ n8 m& i1 c3 c+ h
  40. % e6 t7 d- K8 J9 a
  41. #undef EDMA3_DEBUG0 L) x! \! X$ c. V7 O; x3 u
  42. /*#define EDMA3_DEBUG*/+ }' S8 b& |: ^' j3 }. D
  43. % U# J- i2 d3 \" A0 q
  44. #ifdef EDMA3_DEBUG" Q5 H/ U& _  K/ S* Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( K$ R4 D  X7 Q  ~' E* ]# r4 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* B4 G: I8 _  @8 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 I5 d  f6 \/ V, W0 B& |) ?
  48. #else2 F8 K4 W6 G) ?
  49. #define DMA_PRINTK( x... )- j( O3 u" O. y- G
  50. #define DMA_FN_IN
    8 t) _/ C2 D0 C
  51. #define DMA_FN_OUT# }2 x% d0 X$ L$ d1 _4 c! K
  52. #endif9 q5 L0 T  n* ?* y: S
  53. 7 B* J0 @& C" ?! _& U( J& l! Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; v' m' q- D0 U) z
  55. #define STATIC_SHIFT                3
    ! I$ ]: r" ~' W1 n; K
  56. #define TCINTEN_SHIFT               20
    1 i( b8 m6 k) _4 v5 z+ D
  57. #define ITCINTEN_SHIFT              21
    / B; `) A8 Z5 ^% ]4 C' H
  58. #define TCCHEN_SHIFT                22
    - s! H2 ]5 O6 j+ ?  T8 y
  59. #define ITCCHEN_SHIFT               236 ~4 ]- i9 i' y' e) s2 r
  60.   x# n( X" A! ]. h, H3 `+ c
  61. static volatile int irqraised1 = 0;9 t% }! o. q5 g- s  _6 p) H
  62. static volatile int irqraised2 = 0;- P' g/ Z8 j. S; j; r, F( }5 L. v4 F9 X

  63. / W* J. _# o7 C( n! Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 E( i. l  L( L  m( `4 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 o" I9 G, `' Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* }% i( x' x" T+ t& d  a& W! i- M

  67. , B# e  w! j1 C7 k( x, _
  68. dma_addr_t dmaphyssrc1 = 0;
    4 U& A2 w* S4 R$ {, G8 m  O
  69. dma_addr_t dmaphyssrc2 = 0;
    ! \$ B4 k3 m5 z9 n
  70. dma_addr_t dmaphysdest1 = 0;
      S2 u8 X7 a. e3 L7 H" }
  71. dma_addr_t dmaphysdest2 = 0;
      k4 K1 O( k; C. T, F: ^6 W
  72. 6 {% @; E7 l0 ~( z* T" H
  73. char *dmabufsrc1 = NULL;  i1 D# \) @. n; N; A1 }) v
  74. char *dmabufsrc2 = NULL;" {2 ?7 K7 z! p% K- A4 s' o
  75. char *dmabufdest1 = NULL;% E8 H6 J4 J/ D0 Y' ~" G& ]8 I
  76. char *dmabufdest2 = NULL;
    1 Y1 K1 ^% c3 o5 S/ X: U3 F
  77.   P3 u2 n. t# ~- d: Q7 m
  78. static int acnt = 512;" r  `- u5 j: a# J$ v& w
  79. static int bcnt = 8;
    ) j1 o( d  C. e3 C* `0 A9 Z4 A6 n/ c
  80. static int ccnt = 8;
    7 ?) ^, [1 J1 {, H% @8 F# ^

  81. 1 ^, d9 l/ N) Y2 T$ e
  82. module_param(acnt, int, S_IRUGO);' ?: K, R- l1 i& l% m0 a$ ~- q
  83. module_param(bcnt, int, S_IRUGO);" K. x+ X  @& L5 {+ `9 d& P" M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% Z8 H, @, V7 s5 C; s
" I4 |5 ^& N3 f, g9 w, C6 ~% U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 T9 H' e4 {9 t- [$ N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ e8 F; p9 @0 U0 u* x, p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 X# a  A# O1 i) A, K  x! W* B$ r8 R
9 h8 ~7 X( i. x

7 \* U3 }# _% }$ K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 20:25 , Processed in 0.047381 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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