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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. S9 L6 \' f: X) V& h2 M
  1. [code]EDMA sample test application2 u$ @$ J0 M0 A! r1 o  i/ P  }
  2. /*
    9 w% L( s( t0 `( z
  3. * edma_test.c" c  k' _$ u/ K: ~
  4. *& u! i" E  V" f5 u
  5. * brief  EDMA3 Test Application
    * S% z; g" o# {9 _% y0 w! ^
  6. */ O2 m7 b" X0 e+ R
  7. *   This file contains EDMA3 Test code.0 j3 `% b+ k" C% u0 K
  8. *
    $ C. X1 }7 f5 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ v  ^7 H: r) ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# t: ~# B" ?8 y: a) m6 n# L+ N9 [
  11. *         TO CHANGE.
    9 k0 l" c# N* ~5 V9 e
  12. *
    ' V+ o4 N( L* f' p7 _. [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 }1 d/ ~5 Y+ N0 @6 O
  14. *
    & l' C% N, E; q) ]
  15. * This program is free software; you can redistribute it and/or. D) f# B" E* n  R$ \6 U& U. ~
  16. * modify it under the terms of the GNU General Public License as
    4 }4 H+ N  [- U6 F' m: E: a9 p; {
  17. * published by the Free Software Foundation version 2./ Y- M2 B) u: o
  18. *5 G) @/ U) c9 o/ [! u; [0 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 z0 Z- j1 F7 l! W
  20. * kind, whether express or implied; without even the implied warranty
    / Q" w( k% N( h1 \- `: b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # H; {6 n) o0 O( t" |: @3 t
  22. * GNU General Public License for more details." h% x$ X/ e) ]. T
  23. */) c- D, M$ |1 ?0 D( M( x" T
  24. " f& e* }" ~1 B, H4 }
  25. #include <linux/module.h>+ P6 F- e) r* g% a
  26. #include <linux/init.h>' G, j* `( z4 w. W7 z
  27. #include <linux/errno.h>7 D4 O/ ^0 m% ?; P4 y
  28. #include <linux/types.h>+ A- I/ h3 H0 o* }8 Q* T6 q7 x
  29. #include <linux/interrupt.h>  L9 S( `4 S* s5 @
  30. #include <asm/io.h>: @1 V: t/ {& U: n$ w7 L! x5 A
  31. #include <linux/moduleparam.h>
      v7 a: b0 ^/ ~1 v1 o) i, N. k$ z
  32. #include <linux/sysctl.h>- T* v# N. H  t
  33. #include <linux/mm.h>
    ' D+ H) D9 @3 }/ @
  34. #include <linux/dma-mapping.h>
    9 P. S1 J" y: a, |' |. f* Y- N* n* Y' m7 E
  35. 8 v7 l4 ], X- N# W# \) D
  36. #include <mach/memory.h>
    7 ~: G7 [' i! c
  37. #include <mach/hardware.h>" M7 J0 Y, W$ Z; p1 M7 F3 C
  38. #include <mach/irqs.h>5 f- W( B/ f1 l8 C" v
  39. #include <asm/hardware/edma.h>/ {0 j5 Q6 v2 J+ i6 y5 |5 c
  40. , [% P2 x3 M" |) s6 x2 ^9 c" k- i& ?
  41. #undef EDMA3_DEBUG7 r8 p/ ?) O$ }
  42. /*#define EDMA3_DEBUG*/6 Q( q4 K  l* r% R. B) s
  43. 8 g( N: O4 o5 O; V4 W8 ~
  44. #ifdef EDMA3_DEBUG6 f7 }5 w2 t, V1 j3 ]) A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # W- ^0 C( w5 ]& |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . f3 L& I- d! }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& E8 z. d. J3 t' u& C1 r$ |% }
  48. #else
    & s" t0 w$ o' `
  49. #define DMA_PRINTK( x... )
    9 R3 l5 M. P' S$ i& e: t, @
  50. #define DMA_FN_IN8 j6 Z+ E1 C% b9 e% _
  51. #define DMA_FN_OUT+ z1 P% m. O; g9 z( a8 W. K
  52. #endif
      d8 L) K0 i1 {- Q$ e2 }

  53. 6 x( ], \! }; y  n! ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- q, `9 O. U) b  Y) i1 a
  55. #define STATIC_SHIFT                3
    - \# R( j- A- V
  56. #define TCINTEN_SHIFT               20
    + R9 M  o2 a- ^' m: s+ H4 y, ~, v& X
  57. #define ITCINTEN_SHIFT              21
    ) P. {0 r7 h3 U: ]
  58. #define TCCHEN_SHIFT                22
    / V' R6 L4 g; l& y5 e) f0 w& w( f& D
  59. #define ITCCHEN_SHIFT               23$ R6 S/ A4 F0 T. ]# ^7 l8 \, `
  60. : w1 y# n2 W; C
  61. static volatile int irqraised1 = 0;  w0 c. r7 s5 q, |8 [% ^: m( A
  62. static volatile int irqraised2 = 0;5 L2 a' |' n( q* _
  63. + \$ L7 D" a2 b2 w# }' |$ S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 }3 m: L$ H3 U4 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 C6 e! `0 o4 J5 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 }# @# t# J" ?3 V  W: q
  67. / {5 W/ C7 X% m- V
  68. dma_addr_t dmaphyssrc1 = 0;5 o1 |) [/ c  k$ I+ t
  69. dma_addr_t dmaphyssrc2 = 0;: c7 u; @: N/ y: q" W
  70. dma_addr_t dmaphysdest1 = 0;
    7 C+ {3 f$ `9 M& c' n$ M
  71. dma_addr_t dmaphysdest2 = 0;+ K0 ^1 I( P0 k' v9 H

  72. + F' d" R. C$ c
  73. char *dmabufsrc1 = NULL;
    7 A" S0 b( O5 c. H
  74. char *dmabufsrc2 = NULL;2 T$ [- `  ~( _/ g
  75. char *dmabufdest1 = NULL;+ U; T* {6 v) e. a4 w1 y+ o
  76. char *dmabufdest2 = NULL;
    2 C( R/ Q) Z0 b  x, P9 ?+ t0 [- p
  77. : d% m+ D* R; p+ f: e& ]
  78. static int acnt = 512;1 {5 [2 Y4 @5 U
  79. static int bcnt = 8;
    ; M, y" r+ u" H. y6 u5 f
  80. static int ccnt = 8;
    / y) [2 w* |7 T/ e& X
  81. ; P0 s) k9 v7 W8 Y& y7 x) O4 p/ W
  82. module_param(acnt, int, S_IRUGO);
    : k! O* e! Q8 d6 D+ G! c& \
  83. module_param(bcnt, int, S_IRUGO);% U" q1 [! z4 Z6 [( e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 Q6 r: ~7 t0 S9 N+ k9 o! k. _2 l
" g4 r; X' x5 J7 R4 }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 q# ^8 d# i& `& ?+ o7 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ {) m" Q1 X& k, d3 o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ ~& ]7 a9 V1 o3 b( T4 C2 T7 y9 r0 B7 Z0 c, ?
, y0 K# s: K" `( d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-29 04:43 , Processed in 0.039088 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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