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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 u3 _  X/ N* G. C4 b8 L. G
  1. [code]EDMA sample test application
    5 U2 l/ N* P2 N1 s9 |& U' B9 i
  2. /*( @1 @! z- c1 Z9 M" D
  3. * edma_test.c
    ) X+ Z4 y) \; @. p2 c
  4. *
    7 Z) ^% G& N8 ^4 V+ m0 Q
  5. * brief  EDMA3 Test Application0 a) u0 U4 u. p/ H+ K
  6. *
    ' I& d$ c% O  h% X" y; i
  7. *   This file contains EDMA3 Test code.
    ! C' `7 u. Y8 ^% {
  8. *3 [4 ^" ]$ F" K$ H5 }" L* R0 v4 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , |, l6 n8 k7 m6 u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& ~$ e' h7 @- W0 n
  11. *         TO CHANGE.
    3 p) A( U0 b( y- n; Y
  12. *  }( D# S6 ~( y$ x. d! a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- N2 T+ j6 q' @
  14. *' H) X9 B! \& H2 b4 w+ L% I
  15. * This program is free software; you can redistribute it and/or9 ], B! C; t# U6 `5 X3 c9 ]
  16. * modify it under the terms of the GNU General Public License as
    % B: z& M+ @. k) ^5 m
  17. * published by the Free Software Foundation version 2.& h& D3 h" H! v, _' X. V5 j
  18. *
    9 C4 |0 X9 z! P. @% E$ c% K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( m& W" Z/ _7 E9 O: ?
  20. * kind, whether express or implied; without even the implied warranty
    * L) z; |# G- t, w- G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 x$ U- W; N" x& X3 N% ?
  22. * GNU General Public License for more details.
    6 d! U3 t7 H5 k2 b- Z  A
  23. */7 a5 f! G9 r! v  r) g

  24. 4 f8 R9 A7 L; n: U- p3 o. Q
  25. #include <linux/module.h>
    2 ~* x& ?$ C# d/ d! _
  26. #include <linux/init.h>5 M) m6 H$ Y9 [9 w" z' Z# v& {+ _
  27. #include <linux/errno.h>
    $ }7 L$ k' S- j* l. n$ C/ y
  28. #include <linux/types.h>
    + S7 c! K, W2 q' q+ b* ^9 g
  29. #include <linux/interrupt.h>- u" K! K. h! y: E4 r0 k
  30. #include <asm/io.h>' z) Q0 n, r/ u9 L) \5 G+ c
  31. #include <linux/moduleparam.h>
    1 i* C, Z& R& _( b$ W$ _
  32. #include <linux/sysctl.h>
    - G7 Q) H4 n5 _1 K
  33. #include <linux/mm.h>
    5 }9 X! _6 a/ W. v3 z! ]" g
  34. #include <linux/dma-mapping.h>
    9 J" Z8 q- P2 b& ]  B8 p3 q

  35. 8 [3 S; v/ q0 q/ ]; I
  36. #include <mach/memory.h>
    0 o. r$ ]$ V- Z2 C9 t
  37. #include <mach/hardware.h>
    * m8 Z# v* C! [; o$ l  N
  38. #include <mach/irqs.h>. }8 w9 T# k0 z$ s1 f
  39. #include <asm/hardware/edma.h>$ F# n1 X* M) ^% U" ]5 J
  40. 9 T2 ?  q" w1 G) {- T9 Q
  41. #undef EDMA3_DEBUG6 F( w. U# }0 a+ C# b* y
  42. /*#define EDMA3_DEBUG*/
    ( |/ U2 A- s6 T' P  G
  43. 7 s7 G. {! T6 r- |
  44. #ifdef EDMA3_DEBUG
    ; _  @; B0 d9 U, B9 I4 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : _: M! }4 q% v% S8 ]6 p. q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & f/ c! X& @- W8 A( ~, J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) D/ a$ Q1 c8 e& A/ A
  48. #else
    ( i, i  n! L# I
  49. #define DMA_PRINTK( x... )/ B( E# f, i% v7 _7 d
  50. #define DMA_FN_IN
    0 C: G, q% E1 m% ?9 v( v, U1 d
  51. #define DMA_FN_OUT
    8 }/ X# G7 S6 \! h4 Q' k% H( k- F
  52. #endif* L( y& ~. T/ Y3 G/ F8 s# f8 t
  53. . B6 D, Q9 y: `) L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); J4 o0 F: s- t3 n
  55. #define STATIC_SHIFT                3# u  `/ T1 ?0 @  K) g% j$ |# z
  56. #define TCINTEN_SHIFT               20
    9 T( B0 I" O, u. R
  57. #define ITCINTEN_SHIFT              21) v9 _- c* H& w- ^  n0 X4 [4 B
  58. #define TCCHEN_SHIFT                22
    ; @9 b5 Q6 a7 P4 F+ \
  59. #define ITCCHEN_SHIFT               23
    - z) Z  [/ U9 V8 u

  60. 2 F1 h& X7 d% c  T4 r! m0 f
  61. static volatile int irqraised1 = 0;2 H: X$ S) {& C# D' p
  62. static volatile int irqraised2 = 0;% k( \& P" z8 m& F$ c+ q# m1 h

  63. 4 I4 j  _$ ?+ o3 p/ h& [% V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* c- s6 s, R& H; x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 d1 t  y% q, K+ F% ^& B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' X- j  Z/ X+ K- ?

  67. 2 S) W  V* R1 f
  68. dma_addr_t dmaphyssrc1 = 0;  h8 g6 {$ l+ ]- e
  69. dma_addr_t dmaphyssrc2 = 0;
    9 D( ?0 [5 {2 s. ~
  70. dma_addr_t dmaphysdest1 = 0;
    2 V, m* }% A. d4 }% t5 F
  71. dma_addr_t dmaphysdest2 = 0;4 X3 N0 r, ], D

  72. * y3 Z4 M2 X1 S
  73. char *dmabufsrc1 = NULL;
    $ a( v2 \  f% ]; t: G  g
  74. char *dmabufsrc2 = NULL;5 h1 ^( V5 Y5 S0 L4 u1 ~
  75. char *dmabufdest1 = NULL;
    # X( I, t# e5 E7 b
  76. char *dmabufdest2 = NULL;
    + e# R0 l) i8 }* x4 U  v

  77. 3 w4 ]$ T: K/ t1 E) |
  78. static int acnt = 512;
    9 a9 F' L7 Z( p7 T
  79. static int bcnt = 8;! {! N3 R' [6 |, K% ]: u9 y: z" E
  80. static int ccnt = 8;6 s2 V# x# J( o0 i
  81.   |' O3 [+ @8 C% d
  82. module_param(acnt, int, S_IRUGO);
    + q9 [7 R4 P; o0 ~8 o. }! l* f
  83. module_param(bcnt, int, S_IRUGO);
    2 u/ \5 M( j. h) W0 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 T7 x1 N8 I' s, ?4 k& o
" [  l9 b7 r) {6 R# n( `8 r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 g- ^7 e+ x/ E( V8 q6 T$ m) S8 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 p9 J" u" c' g2 w7 V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  E+ o1 T# v: e5 c3 ]: K/ H( h/ y
" G# i* k' U: h1 \# ]6 J
2 O0 g. |  `$ U3 O! S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-22 20:52 , Processed in 0.034710 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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