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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 o2 F* N, K7 W0 i" `3 g. x+ `
  1. [code]EDMA sample test application. O* v1 v8 J# J+ |# S) P/ x
  2. /*
    / ^+ r- i5 p6 b$ b0 B
  3. * edma_test.c& t+ A4 t8 j2 `8 e7 z2 P' ~
  4. *# {" k& D3 w7 n
  5. * brief  EDMA3 Test Application
    & m( c5 J! V, G, k- ]3 a2 N- i( {
  6. *
    / ]3 v( B& R+ W/ b0 r
  7. *   This file contains EDMA3 Test code.( ^) R: ~( d* ^
  8. *
    - g& G' t' n6 z1 ~6 f' g9 x  A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! }4 m7 n# O( y% u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 b2 N% b# M9 f+ ?9 J$ N5 \: Y" C
  11. *         TO CHANGE.
    9 b" X7 }' q0 b( J
  12. *
    ; W2 q4 i5 l- A: q: v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 A4 G4 P+ K; y* ]
  14. *3 Z; c& o  t. {, V
  15. * This program is free software; you can redistribute it and/or
    " C: u( I. A0 ]8 E. o8 T9 w$ I+ L, z. P
  16. * modify it under the terms of the GNU General Public License as
    $ E) q# f0 @9 n! t4 U) t
  17. * published by the Free Software Foundation version 2.6 @  F) |8 P) G1 [
  18. *
    ) W/ \, y# z) z% A8 t5 A# P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 a) Y+ s/ @4 _& S: Z9 v
  20. * kind, whether express or implied; without even the implied warranty5 u$ j+ m" e! Z  p8 m; Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 }5 n% n" p5 [3 U1 `
  22. * GNU General Public License for more details., Y7 o" l/ }# j2 |2 Z
  23. */- T& ^3 z0 [5 ?# M- |) G

  24.   [0 u( m: M) s/ K7 V
  25. #include <linux/module.h>
    * m; y) I8 o: ?% X) y' Y
  26. #include <linux/init.h>
    * @+ [# h# b( [! U! }
  27. #include <linux/errno.h>
    ' l2 V( W- q- z! W
  28. #include <linux/types.h>2 ^5 c9 n/ O' O1 c7 E" H, E
  29. #include <linux/interrupt.h>
    9 K: {" A% |! K
  30. #include <asm/io.h>  R4 U; W, V) Y2 d- N7 h
  31. #include <linux/moduleparam.h>6 I1 ?7 i6 }6 G; W
  32. #include <linux/sysctl.h>
    % s) m3 |" s$ p1 J# {
  33. #include <linux/mm.h>
    7 b& ?* a) C7 w
  34. #include <linux/dma-mapping.h>' g" L* ^# m0 e' u

  35. + A1 p/ l) n$ k2 x
  36. #include <mach/memory.h>
    : P6 U# |/ q2 N( `2 M
  37. #include <mach/hardware.h>6 E) y0 w9 _  n  q1 V5 J
  38. #include <mach/irqs.h>
    ! @7 c# n. P2 E7 ~7 {
  39. #include <asm/hardware/edma.h>
    4 d4 {& X6 B+ j4 w/ A+ `! f0 F' g" O

  40. ; F5 Z  D! Z6 B: m/ L& }+ H" n
  41. #undef EDMA3_DEBUG9 x: f5 T  U# h9 [2 ?7 o
  42. /*#define EDMA3_DEBUG*/; h" z6 r+ \! B

  43. ! c: [! T+ `& B+ z5 [% r
  44. #ifdef EDMA3_DEBUG
    & P. Z$ Y2 f/ k: s9 J- Y4 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 C9 A) a$ R2 o$ K, t" y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 U$ Z- p" C3 H8 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - b: J/ i' {+ x5 c! F
  48. #else9 J3 a- w" d6 U3 I, m. n
  49. #define DMA_PRINTK( x... )1 Q- b% b* V7 |6 U5 u# e2 f: z
  50. #define DMA_FN_IN
    & z0 @0 k) N; j& J- c
  51. #define DMA_FN_OUT1 E- i& n& P8 w1 g- _/ X4 v
  52. #endif
    0 R  F* v, }$ F
  53. 3 P, q& n7 Y3 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' Q! R- i0 G0 S$ X
  55. #define STATIC_SHIFT                3
    ' ]7 B; H: x8 m: z
  56. #define TCINTEN_SHIFT               20
    6 F2 b0 `# o( X! D7 q
  57. #define ITCINTEN_SHIFT              21
    ) q  T1 x" M/ T% U0 E
  58. #define TCCHEN_SHIFT                22
    0 |0 v0 {% P9 U( b% b( h
  59. #define ITCCHEN_SHIFT               23
    6 [2 r4 m  ?8 Z1 G6 [/ Y+ T% ]8 y

  60. + N2 s: Q$ N8 B5 S
  61. static volatile int irqraised1 = 0;
    " {; w7 F9 x6 I; f; x: M9 y
  62. static volatile int irqraised2 = 0;2 Y5 l( S' p6 c1 Z5 J/ c! e
  63. , C0 U/ m: i  a0 X, P& ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, A( @% _1 i; A' {% ^4 D* ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ R$ n* o6 s0 w6 w* h! k; F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 u, d! }* s* m# j

  67. : F" V* Y  \  I6 _
  68. dma_addr_t dmaphyssrc1 = 0;$ S" i/ f: o! J3 j; b( z& f
  69. dma_addr_t dmaphyssrc2 = 0;
    * R: B: T6 I: ]% ~  \! |; d+ y
  70. dma_addr_t dmaphysdest1 = 0;/ L3 Y6 q# ^2 U/ \4 _+ y& T3 ~
  71. dma_addr_t dmaphysdest2 = 0;
    7 x/ _/ \9 u: g7 _! }
  72. 1 Z3 n6 @2 O5 h
  73. char *dmabufsrc1 = NULL;
    9 e, \" ]* X- |% @9 c0 y
  74. char *dmabufsrc2 = NULL;
    - [& D% a& B0 o4 c
  75. char *dmabufdest1 = NULL;. U& ^5 Q" V  P8 f
  76. char *dmabufdest2 = NULL;/ P$ K8 U- X' K3 ]+ w4 q

  77. ) K/ l3 Q( `: \2 d
  78. static int acnt = 512;
    9 R4 N& {2 k5 d
  79. static int bcnt = 8;: L5 b7 M6 ^* A" @# A2 A. P% l
  80. static int ccnt = 8;
    2 ]7 p: k8 O/ Q( a8 q1 z

  81. ' w5 E. ^. ]' D  K; y0 ]6 ^
  82. module_param(acnt, int, S_IRUGO);
    3 V; _: G- f' q$ t7 p! |# G
  83. module_param(bcnt, int, S_IRUGO);
    ; b- d! O1 L# P8 h8 X! x8 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- @: ~: u% b) K* V
: S4 C5 ]& r7 I& A- O% V& k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 w# M6 b3 |+ T. g  Q- \5 ^2 z) F% D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' i0 n# e0 d3 T: w; w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' |: S9 |3 U% w( Q+ q, E( ^

( w) S! U/ H5 D" `. }# _( J, s2 d% }0 E. X5 Y' Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-15 21:56 , Processed in 0.036590 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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