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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ F0 N1 [4 C3 @' I" R- I) {7 ~& w
  1. [code]EDMA sample test application
      k+ N, t1 K+ w
  2. /*
    8 i6 Z# y4 d. c+ s
  3. * edma_test.c
    ' r& H  h" K8 U4 t+ O- G
  4. *# j5 E8 o6 m2 b3 S7 V6 f
  5. * brief  EDMA3 Test Application* b% ]4 ^% T/ B6 J4 |+ |- Z7 S
  6. *
    ( P* I. l. u  X" @9 [
  7. *   This file contains EDMA3 Test code.
    2 z$ {' f) t+ K$ h7 i
  8. *
    2 S' b. R; Z' V  l+ n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) R4 Z0 X; R7 s% h; Q0 k6 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 v( t& K* Q, w2 o' a) s
  11. *         TO CHANGE.
    ( C; c  Z/ b3 P8 I9 j" C& O1 c8 }
  12. *
    8 N9 ?: ^( K2 K* X: f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 J/ l' d8 ^* S# C
  14. *
    ) H; i/ Z2 h! L, A
  15. * This program is free software; you can redistribute it and/or5 r( ~# I: G4 m
  16. * modify it under the terms of the GNU General Public License as8 [) k" t2 j0 `+ H' s
  17. * published by the Free Software Foundation version 2.
    1 o8 J/ F+ P) ~0 v' N
  18. *
    / V- b( F0 n9 Y+ Z- U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . e2 Z. F, z* Z$ O" d( e% R
  20. * kind, whether express or implied; without even the implied warranty
    7 o' I7 ~7 F6 s9 F' b" @  X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' V8 k7 O) P, j1 _! {
  22. * GNU General Public License for more details.( I% E% k8 a' I; z/ A6 O$ y( x
  23. */
    . g) a7 A5 N! y$ d
  24. 5 \/ R  l3 q* H% N
  25. #include <linux/module.h>+ [9 Y  p5 ~" c) q" k$ I9 F& J
  26. #include <linux/init.h>3 O5 o( L! ^/ x. a
  27. #include <linux/errno.h>
    8 X, Q: `4 n  J' @$ i* V
  28. #include <linux/types.h>% U; D2 p" b3 i) n. B- t) x
  29. #include <linux/interrupt.h>
    / f6 s# ?/ j0 C; [
  30. #include <asm/io.h>
      W0 v9 @+ t. @# \
  31. #include <linux/moduleparam.h>
    # h5 z) v; E0 u
  32. #include <linux/sysctl.h>
    7 i" L6 z( u3 @
  33. #include <linux/mm.h>
    1 j: K( _4 d3 f8 V2 R4 b
  34. #include <linux/dma-mapping.h>
    0 A: o0 ~; K: [( y( D

  35. ! J4 v5 ^! w7 ^
  36. #include <mach/memory.h>0 n' m- u& r- O4 _" r' r/ n
  37. #include <mach/hardware.h>
    1 N" @! @/ o+ e% O6 w# |( M
  38. #include <mach/irqs.h>
    3 Q+ y/ q4 Q) C8 S& k: j
  39. #include <asm/hardware/edma.h>
    % g! D3 f3 Y/ l1 Z; m1 f6 p$ S

  40. 4 Y: @) n/ A& g" a5 n# W
  41. #undef EDMA3_DEBUG6 w  Z4 x5 A7 N3 n
  42. /*#define EDMA3_DEBUG*/
    3 W4 g7 q0 ~  b, v( h; J

  43. ' v$ ^, I! ]0 x- A( r
  44. #ifdef EDMA3_DEBUG5 Q( j  l( o3 }! S* d* o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 |- W) P9 x/ H* [) q" i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * n% t/ x4 U2 a6 V' w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , }( G1 Y, C) S! }. Y' q( u
  48. #else' m" t4 i6 S2 r0 ~
  49. #define DMA_PRINTK( x... )
    3 y9 l% ?# Y- l7 S. m
  50. #define DMA_FN_IN/ U+ H- g( E- D+ K% S' Q. b
  51. #define DMA_FN_OUT) Q5 _2 T# I, L0 Q
  52. #endif
    & d- Y5 m5 T, y  I  o$ ~1 W
  53. 6 w% d* |0 G* ?& v% k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( a8 Z4 ]0 g2 U1 d* Y8 ?0 N
  55. #define STATIC_SHIFT                3
    + ?. O5 R) \8 F. z0 y
  56. #define TCINTEN_SHIFT               20: z- R5 Z* H4 n* A
  57. #define ITCINTEN_SHIFT              21* O. _4 B+ L9 z% G2 M' A
  58. #define TCCHEN_SHIFT                22
    2 n- P6 m' p2 m% Y+ ]
  59. #define ITCCHEN_SHIFT               23' i7 E- V7 X& _. e+ s- k' b1 ?
  60. ( |, r% e& Z, |) A- S8 s
  61. static volatile int irqraised1 = 0;
    ! I# n( C- A& \2 Z0 d* M9 W
  62. static volatile int irqraised2 = 0;
    % e1 }3 J2 h1 s+ {+ X
  63. * G2 F5 H+ M& l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 `3 K' h; j: r& k; J$ t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! U! \" _  e. S4 @) _4 w- L; E+ ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Y% i+ D8 P: Y2 y8 Q1 }4 j
  67. - b! K" b) L! d* m
  68. dma_addr_t dmaphyssrc1 = 0;4 P+ n- O# \5 ^* o8 U
  69. dma_addr_t dmaphyssrc2 = 0;
    7 |. d$ R0 I: _1 w0 p3 N
  70. dma_addr_t dmaphysdest1 = 0;
    7 r- F, z8 D7 J" q! Z' Y9 Q( e7 F
  71. dma_addr_t dmaphysdest2 = 0;4 c9 e1 }6 L& H; F/ m4 g+ C# w

  72. # A- A& _5 |7 J5 G
  73. char *dmabufsrc1 = NULL;
    " l6 X0 r! m* `4 l; Y# j
  74. char *dmabufsrc2 = NULL;
      j; {4 f" h+ _& H( ^/ g; a- Y
  75. char *dmabufdest1 = NULL;
    3 p3 N* u& q$ m% \4 ]5 Q
  76. char *dmabufdest2 = NULL;
    0 m: r6 Z; \" H( s3 D! u
  77. - g8 L4 t* ^1 L' K) V& q
  78. static int acnt = 512;
    5 q9 j1 W' T3 ?3 O& O
  79. static int bcnt = 8;8 ~1 Y8 s/ S1 S) N1 s) p  Y
  80. static int ccnt = 8;1 j2 [5 Q( W/ E0 d+ n* W- A

  81. 1 i) r6 x& P4 S$ R# V4 l
  82. module_param(acnt, int, S_IRUGO);
    9 L9 l' Y# D& J8 k+ _9 {
  83. module_param(bcnt, int, S_IRUGO);; h  ]9 ^8 f; T2 q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, M6 E/ @% t; e0 u/ q1 C

% p  D# e5 r: E  @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! a: q- i6 B  ]% \9 c+ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: @; S" @% L; B4 W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 ]) p0 m3 w. A  m2 q- j
& z; E. f4 K" @/ j! `, V/ z2 X
" a3 s* O+ X/ V; H; I$ z% W' p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-9 02:38 , Processed in 0.042207 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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