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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 r. K; y" @# [2 c
  1. [code]EDMA sample test application! V% {8 p8 w( `* H( I1 ]  I4 i
  2. /*" S5 M; R" F' T: D! T8 n# N) g3 k' v
  3. * edma_test.c
    " y& j1 D3 u5 N& L% H
  4. *; Q, [, G* T2 B3 j6 U7 A5 e
  5. * brief  EDMA3 Test Application
    - G. J$ Y+ W6 a- ?4 X
  6. *4 d, q: |6 q4 E9 B
  7. *   This file contains EDMA3 Test code.( C/ I, c' D( Y4 t6 n
  8. *
    4 g; {6 ]# k/ j3 Z, b3 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ o( s$ h* T6 P' M% v( Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 i; H+ k, ?. j0 N; p1 J
  11. *         TO CHANGE.) E2 h& x  l1 b' {% G2 g/ H8 l" W
  12. *6 G2 B+ z7 G& X8 v& q2 C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. K  g4 ]6 F/ P& p% Q5 a
  14. *; z3 R/ C% X0 w. J
  15. * This program is free software; you can redistribute it and/or9 M/ L; j: E3 }+ C: v. Z8 e( G) k
  16. * modify it under the terms of the GNU General Public License as9 ]9 U) z% K- z* i% K
  17. * published by the Free Software Foundation version 2.
    + T9 \3 }/ X% {0 h
  18. *7 P+ l2 H" e9 d* a5 L3 A2 t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * c: B8 [# g. ^" @5 J
  20. * kind, whether express or implied; without even the implied warranty
    ' f. i( j3 J  r: y6 {7 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# e1 }8 ]# g3 R1 i  t# \7 Z
  22. * GNU General Public License for more details.# r" _/ c6 e5 ~0 B4 {# B) q( C
  23. */1 n% u0 q6 o3 V$ [

  24. + l; Y- o! F0 l' O- q& K
  25. #include <linux/module.h>; W) e4 ?7 ~3 i* A
  26. #include <linux/init.h>
    # `6 h5 E+ R4 x5 Q8 E
  27. #include <linux/errno.h>
    + |: i4 v; U3 _/ i2 w6 T
  28. #include <linux/types.h>
    8 h7 W- o$ Q- {( \
  29. #include <linux/interrupt.h>
    " x) P9 U' K$ {! S
  30. #include <asm/io.h>
    : k2 A- n! I" J0 @7 n+ A
  31. #include <linux/moduleparam.h>
    ) e& G0 C% L( H* [/ C; `) F/ t
  32. #include <linux/sysctl.h>
    / `# N' U  m4 z5 t3 v
  33. #include <linux/mm.h>
      o: f6 P% G) J) K, a! J5 _
  34. #include <linux/dma-mapping.h>5 L* }$ G+ Q- b9 l8 D" o7 f, N

  35. / k9 R$ A0 z8 U" A; @
  36. #include <mach/memory.h>
    ; ]3 r1 _& h3 Q
  37. #include <mach/hardware.h>
    $ f$ ^8 O. y( N: c
  38. #include <mach/irqs.h>
      ]3 }! a8 e' y$ u  ?1 a' _
  39. #include <asm/hardware/edma.h>' |" L$ H4 N8 ^  X2 G( \1 h
  40. - S7 [5 `0 W3 S" u$ C1 Y5 P
  41. #undef EDMA3_DEBUG+ H* Q2 B% A, ^* ]  p: a
  42. /*#define EDMA3_DEBUG*/2 z% |  ~" S( d- d

  43. 1 b7 l6 f7 d9 F$ q# k5 x
  44. #ifdef EDMA3_DEBUG: D' n; i) Y' m- U% s! Q$ w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) Q7 \4 a1 D9 ^; U0 i) h: R3 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) L/ c  ]; ^8 Z& Z4 k9 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 h+ ?( z' _+ T7 |: A: C$ t1 Y
  48. #else
    & `! J. B! l. M) }/ t
  49. #define DMA_PRINTK( x... )
    7 A  p( M6 [' e# ]  `* C
  50. #define DMA_FN_IN! @( Q; m  N- I" i
  51. #define DMA_FN_OUT
    : n) V% G0 A2 D4 ~4 X- C3 j0 n$ E
  52. #endif
    + q: h; l; z- a1 H; ?

  53. 0 f2 Q, r% K1 F, k' k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 H. Q- T# h" N
  55. #define STATIC_SHIFT                3
    # w# X) N- k$ F. f% _9 `
  56. #define TCINTEN_SHIFT               20) [3 d, |) i" J" }: z0 c/ e
  57. #define ITCINTEN_SHIFT              21% f% ]# k: S& M' g, B6 C7 N1 W! y
  58. #define TCCHEN_SHIFT                22
    * C2 y2 I# x1 Z5 Q9 K, |& w
  59. #define ITCCHEN_SHIFT               23" e/ j" ?5 E6 ~, g$ L' p* p: c

  60. 4 W9 s: a, d$ J% B2 D  o
  61. static volatile int irqraised1 = 0;
    6 x, R) C. ?. M
  62. static volatile int irqraised2 = 0;
    5 j4 j9 p$ u" q7 [- R& |
  63. ! Y: V2 K8 F, {. {& `' i: ?- u& ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  k( w- F8 J6 g: [* i2 ], M- a" i+ p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! z! L7 M: B! H3 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- e! s4 a1 K5 x
  67. ( O  t3 S6 N! Q# l- U* w
  68. dma_addr_t dmaphyssrc1 = 0;
    ; L7 r3 F4 H: v# ~% M% r- p
  69. dma_addr_t dmaphyssrc2 = 0;- R5 k9 ^4 }5 X( h3 Z4 f9 n
  70. dma_addr_t dmaphysdest1 = 0;1 G: l" i5 s& \$ d. ^7 @6 s
  71. dma_addr_t dmaphysdest2 = 0;" A/ n( n- G* u; K1 H4 `  t

  72. 7 {: D6 U: `( Q
  73. char *dmabufsrc1 = NULL;) Q& L/ G5 D/ Q* P4 }
  74. char *dmabufsrc2 = NULL;
    ; a; U" v& Q! ^! @" p: n+ j& E
  75. char *dmabufdest1 = NULL;+ F$ Y  S. r" B, n
  76. char *dmabufdest2 = NULL;" W1 w5 I+ j1 @, W. x
  77. # t) U& z3 I% E/ j- A
  78. static int acnt = 512;
    1 n. \2 y7 i: G; H/ S5 n/ N
  79. static int bcnt = 8;
    9 D, Q4 X) f% ~5 _% W
  80. static int ccnt = 8;
    2 N. p/ D5 M( f- a$ s" [
  81. / n. ~/ F6 {7 D3 i+ a
  82. module_param(acnt, int, S_IRUGO);
    + F+ O7 j  Z! b3 z; x+ P7 W2 m$ F' a4 g
  83. module_param(bcnt, int, S_IRUGO);
    ) J& v9 t8 J. F% Z0 @* o7 `" m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& `4 @  _8 c/ y& M) n% v/ N3 ]
# H2 a$ z9 ]% p1 [0 @1 N" Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; C1 Q: [" F, B1 D' E' Y- w/ q# T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% s3 h+ i8 W0 y! Q% D0 d2 W8 f2 w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: b1 l& M* f" d5 l6 S( M2 \

- t! M3 t; m, O% e3 X! j! U
, ~6 Q3 a. e& f8 F$ L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 15:21 , Processed in 0.037271 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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