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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 G3 Y; \, S8 B, z, \8 k) O4 ]
  1. [code]EDMA sample test application
    # o. r/ I6 t# z9 k, i& p. c
  2. /*- c* @) v8 s9 ?" z5 ~
  3. * edma_test.c
    3 f0 E) ^* H8 B+ ?8 {2 W% P
  4. *+ V2 u2 Z  t+ Q; N! K4 |0 G
  5. * brief  EDMA3 Test Application$ h, s3 n4 @" K1 d, G! F
  6. *
    6 a3 r* ]( t4 E3 j. Z4 ]- g
  7. *   This file contains EDMA3 Test code.
    - J* n7 F4 }& V2 y
  8. *0 l% v4 u- K" P: j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' ~3 ~9 M& V8 r( [2 C& q$ q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 R  D+ L- n9 o) ]9 L( \
  11. *         TO CHANGE.
    / t% d/ w0 ?4 F
  12. *2 S/ @: x' J  N) y8 c* z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( L6 ~# d% \. j. ?& _4 C0 b  |: h8 ?( @
  14. *
    3 Y5 w' U, x+ h% S. N1 u5 X3 `# k
  15. * This program is free software; you can redistribute it and/or
    $ N4 n+ T+ t, l& G- o! l
  16. * modify it under the terms of the GNU General Public License as
    & s: ?+ h- I) S2 P6 A% V) W) i" U
  17. * published by the Free Software Foundation version 2./ m' z) ?' U. d# g1 r. u
  18. *
    8 L" q# @1 A- l1 P4 Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 E3 n) z' H" W" p2 H  W
  20. * kind, whether express or implied; without even the implied warranty3 F1 v" \. `! t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / g3 ~: Z4 o  r+ T: i3 @
  22. * GNU General Public License for more details.+ p* J  T2 S4 S3 ]2 q
  23. */& H$ j; c& \5 [3 x9 `* |; c2 ]

  24. ' N0 {# |! ]9 v
  25. #include <linux/module.h>
      B7 R4 O& n5 y; {
  26. #include <linux/init.h>
    9 E& P  s. m& H" \/ \
  27. #include <linux/errno.h>
    * o+ O4 ~# E& e% v
  28. #include <linux/types.h>
      {* q. |2 p6 W* L0 g) M; E3 b* C: f- V
  29. #include <linux/interrupt.h>3 n# Z: ]; ]/ {1 ]6 }
  30. #include <asm/io.h>9 h- d  P1 b% T
  31. #include <linux/moduleparam.h>" R$ W3 N: \1 i( b( p3 v
  32. #include <linux/sysctl.h>* `; A' z9 G  {0 k" J# I
  33. #include <linux/mm.h>6 D$ `5 _9 l+ N1 X
  34. #include <linux/dma-mapping.h>& ?, g, ?1 w, l

  35. * ^( g, U1 `: B3 _2 F
  36. #include <mach/memory.h>
    ) R- K1 F4 o! Z* @5 |3 O
  37. #include <mach/hardware.h>+ h/ P4 I* H" l$ p! d
  38. #include <mach/irqs.h>7 }# q6 ~3 a1 H6 [2 ]4 Z8 N5 X
  39. #include <asm/hardware/edma.h>" A" ^2 C& S% V. G$ ]- H

  40. 7 `, F  a3 p* w) D0 G: ^
  41. #undef EDMA3_DEBUG2 g2 T. @' C, p
  42. /*#define EDMA3_DEBUG*/
    9 m3 P8 y7 V, ^" u/ D+ }
  43.   }7 R! ^) c0 h# ?* t
  44. #ifdef EDMA3_DEBUG
    7 [; C, }2 `2 ?7 B- w' g" L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' J& V2 G! S$ ?" d" B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 N+ B$ D7 p; J7 p! t$ |( F0 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 i3 Y1 W+ Z. h: W0 e
  48. #else$ y& O" j$ K$ Z0 ~' p6 L
  49. #define DMA_PRINTK( x... )
    6 o0 U* {* T& S3 u: _, S; f
  50. #define DMA_FN_IN
    3 L& B- Q* C- j
  51. #define DMA_FN_OUT
    1 p1 A4 `$ X, P- f- b
  52. #endif
    8 y* m+ I' ~  H; H
  53. % Q& ?, C) n" l. V+ V0 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % k% ]& J; G- \
  55. #define STATIC_SHIFT                34 ~# ^& \. x- R' v7 k; E$ a
  56. #define TCINTEN_SHIFT               20
    : t, c' r% @: [- ]
  57. #define ITCINTEN_SHIFT              21
    9 u+ a  T2 y0 V2 B& [4 U6 ^1 P- |/ h
  58. #define TCCHEN_SHIFT                223 q" i+ O9 F& ^. Y# R$ C
  59. #define ITCCHEN_SHIFT               23
    % @* [1 M( g2 |

  60. 5 p+ I& ^1 `5 k" }/ e9 B& A* H$ D
  61. static volatile int irqraised1 = 0;* k' v2 g3 M. C! ?& m1 G! _9 d
  62. static volatile int irqraised2 = 0;
    7 b2 i7 ]: ~* _
  63. ; t, N% y! b+ M! U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " J" [0 ]7 R2 f# P% B0 w) t- i0 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 `1 y! G; X9 Z/ Z% x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 n. Z# [9 W2 K; Y& Q5 U
  67. / A% u7 M9 I4 o9 N
  68. dma_addr_t dmaphyssrc1 = 0;
    - A0 M8 C( d, V+ a: v% ?
  69. dma_addr_t dmaphyssrc2 = 0;
    6 o8 r2 d4 A9 g: `1 y$ I3 g
  70. dma_addr_t dmaphysdest1 = 0;
    & U+ Q0 b9 c0 d9 }
  71. dma_addr_t dmaphysdest2 = 0;4 r8 P- ]4 t) Z  r' K6 `8 J

  72. + u2 A1 q( R- }' g- K& M
  73. char *dmabufsrc1 = NULL;( y! M/ [1 P, x2 L7 F" B/ i5 H
  74. char *dmabufsrc2 = NULL;/ U: {' ]# Q) w1 p
  75. char *dmabufdest1 = NULL;% v0 s) _6 ^5 k+ C0 X+ d2 ~2 t
  76. char *dmabufdest2 = NULL;
    / E% U% p- c, w, C( R2 C/ G/ ~
  77. 8 Q$ |8 |3 Z" c7 L" F) J
  78. static int acnt = 512;9 w. M  Y3 M4 _' D0 t$ V
  79. static int bcnt = 8;, v5 u9 h3 D# g* i# [, S' A( m$ n
  80. static int ccnt = 8;
    2 q5 Q1 l  |4 L5 |5 T
  81. ! Y1 S8 [+ ?% i
  82. module_param(acnt, int, S_IRUGO);6 ^2 L; o' ]6 n- G. x1 _" v2 ~
  83. module_param(bcnt, int, S_IRUGO);
    8 u7 C6 x2 A& ^4 C9 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" E  S9 D5 y4 b" S
5 V, B) E2 {& i# @, O) U8 ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; }. W) M1 n8 L7 @3 {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 G3 {; }; m" [5 N) g( O: X) @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ z3 {2 i0 h4 X; M* @1 h( Q) m

& \0 I4 g, k+ U/ l# }, {& D
& A* a- \9 F$ E) q! L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-29 21:05 , Processed in 0.038121 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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