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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! ?9 Z$ f# R) R, t
  1. [code]EDMA sample test application6 R, r& a8 [; M& H- l
  2. /*6 p" M+ E. O4 s$ j
  3. * edma_test.c
    , u, w& y4 ]* j: ^8 |
  4. *
    $ y- A( [) A3 R% K+ y/ O
  5. * brief  EDMA3 Test Application: C: @; Y3 z; `- {6 S0 [
  6. *7 u! [9 \7 a* K
  7. *   This file contains EDMA3 Test code.
    * i# U2 r6 x& H5 B; R5 F$ U
  8. *
    " j+ Y' F0 h; c  e  D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 ?$ g4 Q0 r! V0 [+ y) j. Y/ F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ o) c% I# T9 Y5 K3 Z- ~& S
  11. *         TO CHANGE.
    . W5 B: O. |  U! ]; K. R8 b
  12. *
    ( l9 m& Z1 H% S! b) d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 r7 i6 C* u; R2 \8 L
  14. *) _0 g; @" t9 T2 B  E% D
  15. * This program is free software; you can redistribute it and/or6 Y7 n( p* ^# J$ i; L
  16. * modify it under the terms of the GNU General Public License as8 H/ M. p" W( P  u
  17. * published by the Free Software Foundation version 2.2 G; W& Y- W& v& M4 J
  18. *
    9 _  O8 p0 G/ q7 R# ]# Y4 G9 j! t% c2 R, H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      a8 h4 c; @# {1 n# n7 z
  20. * kind, whether express or implied; without even the implied warranty
    / b: X1 N; ?2 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 m  o" V' l# R, e7 d8 X" G
  22. * GNU General Public License for more details.) \- M# L; |- \, V* y
  23. */  s" s; \9 h1 O% c. z

  24. ; h0 _! |8 \' w3 B5 E6 X
  25. #include <linux/module.h>
    1 O) Q4 g' y3 S
  26. #include <linux/init.h>
    0 t/ C+ a2 |; a# G
  27. #include <linux/errno.h>
    $ ^7 [1 \: }( A5 V% T
  28. #include <linux/types.h>" j0 s$ a) X' U# c% m: w7 |
  29. #include <linux/interrupt.h>
    * Q; @* V  c( v; w6 r  Z( M* j" |) B7 q
  30. #include <asm/io.h>
    9 d0 f2 _  X( I" _  P4 F# r  s
  31. #include <linux/moduleparam.h>
    + X- a' h  O5 {5 I( y
  32. #include <linux/sysctl.h>
    % m! V5 P) ]& ^+ K. L5 S, D& M) |
  33. #include <linux/mm.h>
    : D( O& a( {! ^2 h+ L
  34. #include <linux/dma-mapping.h>: w$ Z) c  L+ ]. q4 ]( N

  35. 8 h, R3 M$ Z5 V3 }
  36. #include <mach/memory.h>
    . p- t, T" F& `9 p) \
  37. #include <mach/hardware.h>
    0 ^2 d! r; I6 R% {2 Z
  38. #include <mach/irqs.h>9 m( \5 N5 P3 z+ ^) C
  39. #include <asm/hardware/edma.h>
    . }+ r# f7 S  U& U
  40. ! M0 c) H0 b. M9 {
  41. #undef EDMA3_DEBUG
    + S7 n6 N0 C4 G  J& Z
  42. /*#define EDMA3_DEBUG*/" i" @$ O, f' h1 K2 V
  43. 3 |  z9 U. }$ P) m9 N# x. @
  44. #ifdef EDMA3_DEBUG
      D4 ?9 u3 f/ s( X  R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 p8 N. W/ n3 V+ v8 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 s! A1 k6 @! A/ d6 B. Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" V& p$ G: y  x9 c* D. R. b& Z
  48. #else4 M; k, c' h7 a$ H! [
  49. #define DMA_PRINTK( x... )
    9 m, I+ @3 X7 n+ P4 k) A
  50. #define DMA_FN_IN
    , t& a! g& w& W7 \
  51. #define DMA_FN_OUT
    3 |3 p( g8 G. \) c. O
  52. #endif  G. z. z# ?4 [9 |

  53.   R' \+ {- U& a' K. M3 g$ f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , T/ ]; g, {0 J* Z: |; }
  55. #define STATIC_SHIFT                3
    4 C( [; B  B$ y& X! f( n4 {
  56. #define TCINTEN_SHIFT               20% i- f) z0 x$ c/ V+ g! w4 E
  57. #define ITCINTEN_SHIFT              21
    5 H+ V/ p, H6 d3 R! l2 i
  58. #define TCCHEN_SHIFT                22
    8 R0 I! x9 Y" u0 O
  59. #define ITCCHEN_SHIFT               235 V( `9 ?5 \, c2 H3 B1 g2 s
  60. / N: O7 ^0 F. C0 `5 t- |
  61. static volatile int irqraised1 = 0;
    ( l2 [3 ^6 _- f
  62. static volatile int irqraised2 = 0;
    - s! s" I4 |: K* V% G8 r  _! X
  63. : W) u5 R  x% b" p3 j( |  y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , T+ t+ @4 B; C0 N5 x! k- r6 p2 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % [4 u( s  n/ A! o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . a* e6 l0 t8 T; X$ {4 W

  67.   r8 X9 y! r2 |# \/ a
  68. dma_addr_t dmaphyssrc1 = 0;
    3 l3 ?4 g' h9 @" X" W8 b4 m) Y/ R
  69. dma_addr_t dmaphyssrc2 = 0;
    4 Y2 a, P$ P+ ^# e4 N! ]# h1 o
  70. dma_addr_t dmaphysdest1 = 0;
    # T2 N4 f  Y' G' l. |: |
  71. dma_addr_t dmaphysdest2 = 0;
    9 t' V. x: d. j2 D. W

  72. + {" t3 O6 q  r4 k9 ]* N: N
  73. char *dmabufsrc1 = NULL;9 E8 e7 e) ]# l9 |9 Y1 d: y
  74. char *dmabufsrc2 = NULL;& R# B% R) q7 G' o0 u) S
  75. char *dmabufdest1 = NULL;# \4 Z9 H( W# _; r% b
  76. char *dmabufdest2 = NULL;' j6 q* x( Z3 q: g1 B7 A! ~& w
  77. 4 Y! j. k+ b( ~( u, B, A2 T
  78. static int acnt = 512;
    2 y8 z7 y3 W0 f9 `  `, {
  79. static int bcnt = 8;1 N' D; M  ~8 f% i, i
  80. static int ccnt = 8;
    7 |, V$ u2 y/ M* s& ]
  81. 3 J5 B5 m+ ?% P% o1 L1 u
  82. module_param(acnt, int, S_IRUGO);
    5 c; c1 v2 u0 p8 g. B, e
  83. module_param(bcnt, int, S_IRUGO);
    % r4 J1 [: C( u1 P7 }, h. c1 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: v8 O) D! C  H& l
: T$ W- \7 J3 g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  l* s# G/ a6 Y6 u- _/ y3 L* N- e! l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 ~0 e. i  \9 T' f& E; f1 Z4 |2 |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) O3 Y% h5 K& k8 h+ v5 x

3 ^1 F4 r# l8 r- I: D2 L
& h  b( E$ Q; F6 x1 L8 J$ I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 23:14 , Processed in 0.038062 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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