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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 J! I7 K+ X* |' K8 F; K% B
  1. [code]EDMA sample test application0 G, x# z4 K) m7 \
  2. /*5 C% }; X) u4 ^- s- ^" C2 g/ t
  3. * edma_test.c* I( O4 p: q  M& _
  4. *1 R! D: w& d2 d+ B! k7 u
  5. * brief  EDMA3 Test Application
    / o5 x" A. N: ?/ W" n  g) ^9 H/ j
  6. *
    : a8 l% c* K- k6 I$ O
  7. *   This file contains EDMA3 Test code.
    3 {( w0 @, B4 j6 G
  8. *) K6 U( T  ^6 E3 Y0 Z) a$ [; y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' [. [6 d2 [' D' m- y) W, I6 K$ q9 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' U- x, E( t, ^, D* z' O/ t" q
  11. *         TO CHANGE.+ [( f  b& G+ b* a  h$ @
  12. *
    " B; u/ |( D8 }& b+ q# x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# b3 ~. B! F6 F
  14. *" C) b1 n- W3 C8 J& ~& }
  15. * This program is free software; you can redistribute it and/or
    . D  ~* o5 O) o- p* |8 W
  16. * modify it under the terms of the GNU General Public License as& w: x1 e% n7 P; u: g
  17. * published by the Free Software Foundation version 2.8 N# d$ r1 V( G. Q' E& h
  18. *
      c! Z! ^6 u4 \0 f) d6 ^5 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ z/ \/ `. o: [% \9 ^
  20. * kind, whether express or implied; without even the implied warranty
    ; \; l* T5 g, W7 |" C; n( c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 p5 l) w5 X* [0 e+ z, ]. d& H- Z; R/ f
  22. * GNU General Public License for more details.
    ; L8 a4 U) y6 O/ ]' F
  23. */3 P5 H, l3 G- C( z
  24. 8 C& o7 z* U! B
  25. #include <linux/module.h>
    % h8 M0 R# c& G0 O, ]0 I) D( N
  26. #include <linux/init.h>
    , h  ?4 U' p3 E
  27. #include <linux/errno.h>
    , u4 V9 {' R1 f) V- y' i
  28. #include <linux/types.h>
    6 w/ ~- Q1 |6 _: S% Y
  29. #include <linux/interrupt.h>3 e9 n% ^/ C$ Q, |4 j6 u1 J! R
  30. #include <asm/io.h>
    ; o9 n: p; v2 t; P) s+ N& X
  31. #include <linux/moduleparam.h>
    . {) M; ?# B4 N& M9 d+ ^7 _7 u
  32. #include <linux/sysctl.h>
    * h0 n' u2 M$ q
  33. #include <linux/mm.h>* y1 l7 H' o1 c
  34. #include <linux/dma-mapping.h># y# h/ p6 t/ g! g: `

  35. # p; d: H) |: A! E3 C
  36. #include <mach/memory.h># C. J/ U/ b: }5 Z" D" ^
  37. #include <mach/hardware.h>. a$ ^- |+ K. ?$ h
  38. #include <mach/irqs.h>
    " e4 s! K" C2 F
  39. #include <asm/hardware/edma.h>
    5 G# ?  Y, k; X% e3 F. }

  40. 4 r( C0 ~& V8 t& D! u* g
  41. #undef EDMA3_DEBUG
    : K) O1 O' e7 F; V. `6 m+ f$ a
  42. /*#define EDMA3_DEBUG*/
    1 K& K  W* ]' d5 H( h

  43. % W" Z1 C$ N  `0 X: f/ v; ]& |
  44. #ifdef EDMA3_DEBUG
    # P7 v/ Q" C& A. G# s/ p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' w! i1 |2 A4 s: u0 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . `' F9 u' ]) f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) b) n* z' V% V8 ?+ o
  48. #else
    ! o8 K9 m" E) L( V7 ?6 z
  49. #define DMA_PRINTK( x... )' P1 }. z- T% v) ]8 v# C
  50. #define DMA_FN_IN- K4 ~3 e# d# K& [' h5 \
  51. #define DMA_FN_OUT
    & j8 O4 d$ W4 t
  52. #endif+ q( t5 R+ w$ ^4 F" R! a
  53. ! H. f* m7 R3 h+ M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) U. h' K& u; G" a) X( t3 \; l
  55. #define STATIC_SHIFT                33 C1 H! a2 i3 a( }! C- W  }
  56. #define TCINTEN_SHIFT               205 a  L1 i% [$ R6 D
  57. #define ITCINTEN_SHIFT              21, X$ J. d$ g- Y! B7 [0 R2 z
  58. #define TCCHEN_SHIFT                22
    3 L* p) P/ t; D0 l
  59. #define ITCCHEN_SHIFT               23
    # g1 |2 Z) N/ n$ r) `" {# v+ P
  60. ; p& P. G$ K0 V  k
  61. static volatile int irqraised1 = 0;5 G% V) _/ [+ J' x3 G2 p" ~2 c! O7 Z+ N1 a
  62. static volatile int irqraised2 = 0;: F. n  j& f$ y; [$ z/ F
  63. ! F4 _8 ]7 c! o+ s3 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 w) R# y4 Y( w3 r1 S  C: l7 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# B1 G5 P: U7 ^: o3 r6 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ?  Y3 M6 @% ^6 N5 ?5 h

  67. . e7 R/ [/ C5 y! C0 p# W
  68. dma_addr_t dmaphyssrc1 = 0;
    , w8 T+ }$ r/ ]% y% J
  69. dma_addr_t dmaphyssrc2 = 0;* }' e6 U" X* b, J$ U4 P; C4 E
  70. dma_addr_t dmaphysdest1 = 0;! L& W7 ?3 L0 L4 D+ h
  71. dma_addr_t dmaphysdest2 = 0;
    # |! p  A2 X, }  E3 ^5 _

  72. + y9 ]3 M; T% f4 W) q
  73. char *dmabufsrc1 = NULL;5 @( l4 ]( u9 K( }" E* i
  74. char *dmabufsrc2 = NULL;" }- ^8 n  X: Y8 X, o
  75. char *dmabufdest1 = NULL;( X1 A- o* F6 `; J( B
  76. char *dmabufdest2 = NULL;
    1 H% w  v5 U" u1 B* v  R6 e! n& A
  77. ' |6 L/ y5 h; o% @) X: c  W4 ~
  78. static int acnt = 512;( x5 B, {. l" [5 g
  79. static int bcnt = 8;
    ( W2 g5 I6 Y! c; w0 m$ M' F
  80. static int ccnt = 8;; L3 `% ^  e# u& M

  81. 1 a: r- _7 l. `5 ?+ i0 A
  82. module_param(acnt, int, S_IRUGO);/ f  t& u4 |! M
  83. module_param(bcnt, int, S_IRUGO);2 P: }- c; }7 p: r0 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 M5 i& m; H" M+ X& O& \% T& G( r. D; K/ D; U7 B& @5 Q2 g3 z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! R! u! }9 ?9 N5 Z, q5 b4 Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( M8 Q. a* h2 Y& t4 `/ d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 B3 u: B$ ?/ A

+ J% {4 `! R9 c
) r+ R* E" H6 O4 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 10:49 , Processed in 0.038512 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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