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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 p  M1 N4 ?' e) z4 q3 Q3 M. Y: v! ~
  1. [code]EDMA sample test application1 W" H4 O3 t! O% n- ?( L/ ]$ r
  2. /*: s" D5 z; [8 w4 z  l8 U3 N% b# H
  3. * edma_test.c
    ) d0 F! z9 Q3 q6 L7 X" _% p$ y1 m
  4. *4 U5 J8 A, L4 [: ], d2 Y0 |. L
  5. * brief  EDMA3 Test Application7 D3 M( `$ v$ ?
  6. *) E# n: l! e1 i7 u  K6 O2 o: q
  7. *   This file contains EDMA3 Test code.
    % `; ^) F" J) l- Z" [& m
  8. *. ?+ Q5 h# o" D& n8 O0 P2 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; c" e' \7 I$ V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % m3 q' m7 y/ \4 {* \0 J. E
  11. *         TO CHANGE.
    - o- o4 U6 T$ r; Z; X( J1 z
  12. *
    , `3 z9 }3 R# Q' p. D$ X& R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 L# }3 T6 E9 ]7 f# i$ }
  14. *' ]# e9 N; [/ g+ e
  15. * This program is free software; you can redistribute it and/or
    / {$ V: J; q0 o: F$ k8 e9 D' }
  16. * modify it under the terms of the GNU General Public License as
    ; S+ x( ^2 c2 U- v
  17. * published by the Free Software Foundation version 2.
      @8 ?- X5 s6 W" b) v% a0 @
  18. *) v" I7 q4 V: M/ h. d4 x1 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / Q) W% \: T) _# c/ F6 S
  20. * kind, whether express or implied; without even the implied warranty
    - w8 N4 W) @% H: |, Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " f8 A: r. N4 ~
  22. * GNU General Public License for more details.
    * v# j* p( Z8 Z* D3 t& u$ f  A
  23. */! e4 n0 J+ y5 Q3 u
  24. / K1 W3 d& Q. n
  25. #include <linux/module.h>% }. ], ~% p# p
  26. #include <linux/init.h>( t9 V* O5 x- r
  27. #include <linux/errno.h>
    3 B9 p+ W5 ]1 k& p1 X! G' m; B: c
  28. #include <linux/types.h>5 w# \: V5 e+ ~% E2 l' }
  29. #include <linux/interrupt.h>: n) N3 B. _  |' k  G
  30. #include <asm/io.h>* N" b+ {3 L% \6 A6 r1 X2 T
  31. #include <linux/moduleparam.h>
    * V2 j/ x' y, C( Q
  32. #include <linux/sysctl.h>
    ) e5 J6 ~& A6 [1 Y  w. H; S! N
  33. #include <linux/mm.h>7 B7 J+ @8 t: a5 Z: ?3 M
  34. #include <linux/dma-mapping.h>% {+ C; m1 f/ Y) i' l; I( S% G

  35. 8 c: a; v3 q; M1 ^
  36. #include <mach/memory.h>
    9 |$ ]! t( v$ S; f
  37. #include <mach/hardware.h>
    9 A' O9 b5 c* U" r9 y" W5 V
  38. #include <mach/irqs.h>9 W, r9 v5 X, D$ ^$ y
  39. #include <asm/hardware/edma.h>
    : @: V5 a: ]3 L1 t) T7 L

  40. 4 }7 @2 P- {6 C" l& A8 ?9 N
  41. #undef EDMA3_DEBUG
    ) u+ r; `& g5 f  f4 f% b1 \
  42. /*#define EDMA3_DEBUG*/9 e, J1 M% ?9 \
  43. / \+ [3 t  }3 h4 W- j
  44. #ifdef EDMA3_DEBUG
    3 q8 D# Y( ^* X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ I" z- w/ I' y( f# j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * ^: \% i, F0 b# D/ J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' B& H5 r  `* T5 l
  48. #else
    % A6 z& V& P* @" m# m1 Z( C/ ?$ G
  49. #define DMA_PRINTK( x... )
    , Q, m- T# m- J' I9 \- w& D
  50. #define DMA_FN_IN5 K' e5 r5 E. k, \# e& T! `, |0 [
  51. #define DMA_FN_OUT1 @. \7 c  }4 X' m
  52. #endif
    9 D$ j1 B" c& c3 m
  53. . L( d- V/ c, {9 R' t8 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( v; C$ k5 X9 L
  55. #define STATIC_SHIFT                3
    6 P( s, \. R; W% _( X
  56. #define TCINTEN_SHIFT               20% c, [2 z9 }% q2 \% F
  57. #define ITCINTEN_SHIFT              21
      L' E+ `( H! E3 w/ P" ?& W  Z/ W
  58. #define TCCHEN_SHIFT                22
    ) o, b1 a( f8 g4 F
  59. #define ITCCHEN_SHIFT               23) |; J9 t# A3 O( T, q* w+ f$ ]

  60. 0 e. o+ c$ W+ F' s- U. k
  61. static volatile int irqraised1 = 0;! Y7 R1 G$ V  u. g7 ~7 [
  62. static volatile int irqraised2 = 0;
    6 W+ A" V% `" w' i  h3 ~% \: \+ P

  63. 2 [$ ?7 K4 D& I& k' a5 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ y7 Z. G& M  S# Q( K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : ?% e" k. y  x, K  P' r' b8 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + T* Q* \9 t1 r% b  J# O" s

  67. - u  L* I: G* q5 s6 s* \2 v
  68. dma_addr_t dmaphyssrc1 = 0;
    2 W- n! b! j* {2 L/ B& ^
  69. dma_addr_t dmaphyssrc2 = 0;
    6 K, F0 x1 X. f$ ~& P5 n: [/ K3 o
  70. dma_addr_t dmaphysdest1 = 0;; v4 `" P& q5 @8 s# Q; ?
  71. dma_addr_t dmaphysdest2 = 0;  i% K+ F. w8 b# F4 b" r' W7 b& L
  72. 6 P9 q- y. P1 z
  73. char *dmabufsrc1 = NULL;
    & Z5 |1 f, w/ l4 x- R. C9 Q4 W& |
  74. char *dmabufsrc2 = NULL;+ e0 B% `; I+ h( [: `
  75. char *dmabufdest1 = NULL;$ K1 Y; M& G2 e* u  |0 W
  76. char *dmabufdest2 = NULL;; Q* y/ i8 B! B2 f( I$ f: f1 y( D0 |
  77. 0 g" ^+ q% w. e
  78. static int acnt = 512;
    - {! |- x7 ]9 m  c
  79. static int bcnt = 8;( j) M5 _% |- ~6 s5 M2 \  P" @5 ^
  80. static int ccnt = 8;
    7 G0 d7 s7 N) P7 i5 W0 J  K( m* `
  81. 1 d! j, y: l9 P% X1 I
  82. module_param(acnt, int, S_IRUGO);
    7 n) C; ^! T& R- s- g+ f
  83. module_param(bcnt, int, S_IRUGO);
    9 Z( U! d7 p+ b$ x5 L* k( D: E3 v; v7 V/ }
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. V- }" H9 `! ~- F) A% m  H
) F' Z0 @- q+ s9 S" ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: w/ q1 A6 _$ F& j% ~8 Z3 s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 i7 G7 z4 m5 H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ \5 |8 F9 E# J* t. ^) t* p

$ M. \, g  w9 m, m2 ]# Y0 g+ u3 @1 S' k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 15:34 , Processed in 0.042595 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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