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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * ^" s3 ?+ n( p) r1 J1 k! L
  1. [code]EDMA sample test application
    , d) v3 I2 z% s, C2 @
  2. /*
    ' v, S0 {2 _+ B0 N* N( Q9 g0 S
  3. * edma_test.c
    ! o- S: o' F, q( B) @! T7 w" b
  4. *) S$ W2 T% s$ H
  5. * brief  EDMA3 Test Application, p8 |5 O! d3 G3 p8 A. U
  6. *
    / ^9 T' @6 R; |8 f
  7. *   This file contains EDMA3 Test code.
    & v. u. D9 I- e, E  W1 R
  8. *
    4 j2 ?4 `; t' y- D, s/ F0 ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 I. v1 j6 ]1 W$ A* J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) @. n  ], U% J; g9 ?6 [8 r  k% L7 v
  11. *         TO CHANGE.3 D( ]5 i. N# {6 I" U
  12. *
    - R0 P( d5 K/ G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 p* L5 |9 i* |7 C
  14. *
    2 m3 |9 s# ?0 F! D; W2 V# ?; k
  15. * This program is free software; you can redistribute it and/or
    : s) e" `) O7 z  X: R0 d
  16. * modify it under the terms of the GNU General Public License as
    0 w  Q$ [) k* ^4 S- \
  17. * published by the Free Software Foundation version 2./ F% L7 j+ Z5 r
  18. *
    2 y% r( K; q# t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 D. Y5 c5 F/ r
  20. * kind, whether express or implied; without even the implied warranty
    / m& H2 v+ f8 M* f5 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ a* D0 V  w5 e
  22. * GNU General Public License for more details.$ H) b7 ~6 _. B
  23. */
    1 V7 h2 Y) J: ^; t6 X& C2 k

  24. , X3 e) b0 p3 K. S
  25. #include <linux/module.h>! j" ?% v) G' e. w
  26. #include <linux/init.h>
    # P+ r2 w) u$ U" S# n) ~
  27. #include <linux/errno.h>/ g7 o" S6 W+ n3 S8 S
  28. #include <linux/types.h>
    6 S9 L# Z  i7 I1 f, F) v: M
  29. #include <linux/interrupt.h>
    3 g4 U$ ]* w6 p& x7 a4 v
  30. #include <asm/io.h>
    , c( J7 I( E3 h7 _% I( p; T
  31. #include <linux/moduleparam.h>7 I+ a5 W: G0 c# Q6 f
  32. #include <linux/sysctl.h>
    + \" M+ M, ~0 _1 x& o' ]
  33. #include <linux/mm.h>) P6 i8 {! b1 B# u8 C6 ~8 C
  34. #include <linux/dma-mapping.h>
    ( E: w% i3 ^$ ?& `$ G. ?, ~; V( T

  35. # k9 [3 U. W) I" u
  36. #include <mach/memory.h>
    " g$ v3 w7 D* Q8 }
  37. #include <mach/hardware.h>+ H- O9 v2 F. E8 U) q' f2 }9 z) I
  38. #include <mach/irqs.h>
    6 Y1 `4 `! e6 ?6 v) X9 `# Y" f
  39. #include <asm/hardware/edma.h># q5 Y( T  |0 S1 X8 y$ ]
  40. 0 `6 g" e1 g: ?# c) e3 R
  41. #undef EDMA3_DEBUG
    ' q6 c& C! ?) j4 o
  42. /*#define EDMA3_DEBUG*/7 ], d" ^; c( _
  43. 9 j4 [2 U8 g6 |. h
  44. #ifdef EDMA3_DEBUG
    $ ]" \& n7 _: R$ c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) B6 X4 O) K7 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 H- F0 c; i$ v- D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ F+ @8 d; C; u: K6 y; u/ P/ Z
  48. #else
    4 [2 x. S3 l5 f8 x; P3 c( M
  49. #define DMA_PRINTK( x... ): m, w% O* A' F% m1 Z; D  V, y3 f6 v
  50. #define DMA_FN_IN" o% i% {1 V$ Y# e
  51. #define DMA_FN_OUT3 I3 I- e: \/ h$ w9 j0 z
  52. #endif5 u- o5 d1 X1 p% Q. S/ G8 ]
  53. ) l. j; {# [0 }7 _5 O% h( R. @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 O1 o0 G/ b3 {) v5 \* U, l
  55. #define STATIC_SHIFT                3/ m# I! }8 P5 Z- y: ?
  56. #define TCINTEN_SHIFT               209 w2 p- _, q3 b
  57. #define ITCINTEN_SHIFT              213 h  E* B, Y  f& b
  58. #define TCCHEN_SHIFT                22& m9 q6 i( f9 n) J& g1 C- T
  59. #define ITCCHEN_SHIFT               23
    8 @( O8 W/ I! o

  60. " x, h  E7 K3 z: H0 X! _
  61. static volatile int irqraised1 = 0;* g3 x6 ]; x1 y+ s
  62. static volatile int irqraised2 = 0;
    % M+ x. K7 z) M$ d0 ^! S0 H% ~
  63. 4 Z* T; ?) ?0 L' W+ i( T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 F" v2 u5 U, q( X7 @" C" Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 U' P* Q0 n2 f3 O7 I$ b% R* S2 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  s; j6 V- i  e  y1 w( g
  67. ; H# {  ^8 }2 y) s9 C& [6 a
  68. dma_addr_t dmaphyssrc1 = 0;
      H5 b+ p4 [; u9 h
  69. dma_addr_t dmaphyssrc2 = 0;3 }8 p( y5 I1 V. k! b  ?! }
  70. dma_addr_t dmaphysdest1 = 0;
    , q7 y: l$ c  m9 A, q3 X
  71. dma_addr_t dmaphysdest2 = 0;
    8 W8 e1 G9 A3 |1 v

  72.   ?' q# t& V/ L1 B% s
  73. char *dmabufsrc1 = NULL;; G) W/ D7 l; e6 t6 {) z1 E" ~: ^' J
  74. char *dmabufsrc2 = NULL;: s. _+ @! }( Y! T( h  @9 V
  75. char *dmabufdest1 = NULL;, P) {" O% k) G( [# ~
  76. char *dmabufdest2 = NULL;5 }$ F$ H+ A- T

  77. 6 J( g& W* c) S3 s/ e; h, M
  78. static int acnt = 512;
    4 u  S0 z. s$ p1 {9 h7 `, u
  79. static int bcnt = 8;
    - q8 z* O! c" l) l8 S
  80. static int ccnt = 8;
    ' M0 P7 P" G! a! B
  81. ) [( \3 \1 b7 n+ L) W( y
  82. module_param(acnt, int, S_IRUGO);' O  q0 @! Z8 L# i3 ^! D
  83. module_param(bcnt, int, S_IRUGO);: y" i, _+ o$ A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ e- m5 u3 w: X' n2 m/ h& y1 p4 J& W) K1 Y4 G' U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' s1 C( [  f  i: d; e0 @' i" Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 }" r8 @% K, e( K7 @' R, o# A! ~) t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 t0 Z2 ]- `/ Z1 [, e/ C
: E# u9 x: [2 r) O9 @) ~% C7 e
+ N7 r6 l1 \: R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 08:17 , Processed in 0.039446 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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