OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . B" F7 X: H: c; m; R6 o& t
  1. [code]EDMA sample test application9 t6 L# d$ i* G& q
  2. /*
    , L: P* e6 i& V, q9 Y
  3. * edma_test.c% U8 k1 D: ?4 n
  4. *
    $ n: X  B( e: j3 Z7 o$ m& O- H
  5. * brief  EDMA3 Test Application; Z9 u3 f" }8 Y( y7 j* `. n0 H
  6. *
      _0 J3 N) p8 e5 O
  7. *   This file contains EDMA3 Test code.
    1 M: C: {  P- k% u1 C6 X  h
  8. *5 D6 x  \* C. e  o+ ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 M. \/ ]) u0 R) Q' g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ A2 K. z4 G6 h( V" _
  11. *         TO CHANGE.
    9 W1 Y5 P9 z5 G, ^
  12. *1 h8 ]7 Q' }" l% |6 i7 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! X$ {0 }- [, w9 p! }3 ~% o
  14. *: i2 \  g& _! z  j; g
  15. * This program is free software; you can redistribute it and/or6 `5 O# ^: I, r  |
  16. * modify it under the terms of the GNU General Public License as9 [; t: }! [7 i; p; {5 ^( y
  17. * published by the Free Software Foundation version 2.
    : ]2 U% a8 q& _/ V7 n2 k" }
  18. *4 l# [5 z9 w5 }* {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. O8 m" F2 _+ l, p/ ~
  20. * kind, whether express or implied; without even the implied warranty. v( u) t, p8 H; d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 L$ G9 g% ]! m! w8 }, i: |
  22. * GNU General Public License for more details.7 K& O  l. F2 q5 y1 _
  23. */+ S2 Z& d: D! r5 V
  24. 6 Y7 d) W6 w/ J6 a
  25. #include <linux/module.h>
    9 f$ u' D) q: d. g0 k
  26. #include <linux/init.h>  [2 k* Q4 @5 R+ g
  27. #include <linux/errno.h>( p( u: P7 L% P5 V; x  f" W' y6 t! q
  28. #include <linux/types.h>! `8 _$ e# |# v
  29. #include <linux/interrupt.h>, D& E9 o. W1 t8 U% d2 x
  30. #include <asm/io.h>
      [( U/ f6 h1 k; g$ ?9 I
  31. #include <linux/moduleparam.h>: e, i& S0 F4 D! W
  32. #include <linux/sysctl.h>
    + W+ S0 K# I* A% k5 X, h9 h
  33. #include <linux/mm.h>
    * t: Q! G6 e1 l( t* i* y4 {" d: Y
  34. #include <linux/dma-mapping.h>3 x9 _; a3 n: m, O* O

  35. 1 h* b2 O) b/ V5 W0 v7 ]
  36. #include <mach/memory.h>
    : _% h$ X) }# G- {0 g4 t8 w% _
  37. #include <mach/hardware.h>' h5 Z8 M0 a& Y1 b6 w* ]
  38. #include <mach/irqs.h>) D  b. C# V* j6 L3 q8 N0 V/ W% {
  39. #include <asm/hardware/edma.h>
    ( l7 w" \7 o) H* ~* e- [" l

  40. + \9 A/ u5 ^& N8 ?  y2 B
  41. #undef EDMA3_DEBUG
    / _& W6 l. Q! }/ B8 l
  42. /*#define EDMA3_DEBUG*/
    ' x& Q7 O$ Q- F( [7 S+ d. m% f
  43. - U, ^* p' V; z: ]7 H4 ]7 B
  44. #ifdef EDMA3_DEBUG
    7 }+ {: R* N9 y  p% ^% F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ l1 p# y8 v1 Z8 g  D9 E3 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 u0 K+ x- e7 I$ a7 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) ~/ g* C9 j$ Y7 Q) h
  48. #else! v! L4 f2 a5 |4 d
  49. #define DMA_PRINTK( x... )
    ) t" [) k, \6 o1 P3 h" _
  50. #define DMA_FN_IN! c" U! c* }4 A8 i4 \
  51. #define DMA_FN_OUT# I! V; p- |1 c. @3 D- o) ]
  52. #endif
    3 N/ X; a& }0 n6 \5 Z: D

  53. . v. G$ i, k& m1 q- x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 u' w1 K7 o# r7 c
  55. #define STATIC_SHIFT                31 s* T1 g5 L- i
  56. #define TCINTEN_SHIFT               20
    # I) d0 P9 U  p0 V8 B, _
  57. #define ITCINTEN_SHIFT              21, o& B& |6 _( E& l. u' ?
  58. #define TCCHEN_SHIFT                22
    - ~# t7 u, z5 Q( n: W
  59. #define ITCCHEN_SHIFT               23* x$ C7 C$ U/ k, O9 s6 X0 e) ?
  60. . S8 \  L( c6 Y) o# E
  61. static volatile int irqraised1 = 0;
    7 Q1 U2 Q! h: K) _
  62. static volatile int irqraised2 = 0;
    # \: P5 U+ z2 d2 r' R+ x4 }
  63. 8 i  i  _$ m- E( _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& I& i  S- K; {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( J9 y  P' ~2 N& v% B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" T: r: ]# g* T2 E# g
  67. 6 B0 L# @4 J; w4 {! _
  68. dma_addr_t dmaphyssrc1 = 0;! Q+ m+ r1 B4 C/ P% H$ J8 q0 X, z
  69. dma_addr_t dmaphyssrc2 = 0;7 u$ G/ o# R/ J, C' m% k3 E7 w) B
  70. dma_addr_t dmaphysdest1 = 0;
    ) G0 K( Q& B( ^
  71. dma_addr_t dmaphysdest2 = 0;
    , B* S% ^2 @2 T

  72. 3 T( h2 k$ k7 i# }
  73. char *dmabufsrc1 = NULL;! p% i+ t2 g3 b! Q1 f0 Q
  74. char *dmabufsrc2 = NULL;
    7 v5 K8 M' Q+ ?) j1 F0 ~, R
  75. char *dmabufdest1 = NULL;
    ; j3 ^+ n# R+ I3 b) N8 Z
  76. char *dmabufdest2 = NULL;. ^2 b% |, y9 i2 H' t" e# Z5 P
  77. 2 W6 I- ]6 S% p1 H& |
  78. static int acnt = 512;- {3 N( S* I, z, k( l0 }6 Y( S
  79. static int bcnt = 8;1 C7 R. P3 `+ w, C( W- U
  80. static int ccnt = 8;2 _  I6 N8 x0 P; J8 S3 c* v4 l& l# r

  81. ' m% G/ H( i1 J* K! G1 Z# a" u" D" l
  82. module_param(acnt, int, S_IRUGO);& U1 r: n8 g5 `- w& C. a+ `
  83. module_param(bcnt, int, S_IRUGO);% S% u/ G  H: T+ [. O! F' @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 F7 ?1 ]8 a( f. O/ x7 y0 h1 ^$ o* ~1 k  e2 K9 y" C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 V! S- Q- S5 N; E9 ^( \, j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ W1 ?9 F" m& c# D3 f$ H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; Q9 S, Y( @! A. t5 T
9 L  J- L6 ?& a  \; X

4 r+ @0 \3 ^- }- ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-3-13 13:14 , Processed in 0.048068 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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