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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / M% t# q! t% x" u* S  r
  1. [code]EDMA sample test application
    / {2 K, G/ O- ~
  2. /*
    * ^3 q5 I% Z, Y* G9 {% z" l$ |
  3. * edma_test.c
    * |% }* C9 R& K% |  f( m* U2 y
  4. *
    , _( Q  u( e" o* a
  5. * brief  EDMA3 Test Application+ s$ t- b5 z, j0 m6 W
  6. *
    1 `# a2 r, p2 V" X
  7. *   This file contains EDMA3 Test code.
    . [2 p$ ~% Y6 ?4 y4 ~" I
  8. *
    7 A& F; i3 [$ H* a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& K) C- u: k, e4 ^2 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! q$ @! n+ G8 _" J$ \) d. N7 ~
  11. *         TO CHANGE.
    1 e' J8 K& e# p* J
  12. */ {$ \# K. T4 [6 n& h  z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) O9 J1 e% `  k/ d8 A0 c' ^/ c
  14. *: [' Y1 Y/ q/ |) h& P" r5 D: V% n
  15. * This program is free software; you can redistribute it and/or4 d0 }3 E5 H+ X2 D: K5 |  p
  16. * modify it under the terms of the GNU General Public License as
    . z& d0 n0 U9 h9 V  g) y# P
  17. * published by the Free Software Foundation version 2.  X1 a: V: [% Z& E
  18. *' M3 G1 y6 q& ^3 T: t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  _# B0 O( U% I- l6 \4 v) ]0 X
  20. * kind, whether express or implied; without even the implied warranty* w1 Q/ ?, F: z# l2 F9 W7 K* D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 E3 k+ F6 [7 c6 W! |! h
  22. * GNU General Public License for more details.
    + S- S/ D; `0 V. J4 a# g
  23. */
    8 J# S" U2 }9 k  B% x! E
  24. : k7 J8 D" b6 i# g! x3 V& ~( P7 e
  25. #include <linux/module.h># ?& U2 j% `6 i
  26. #include <linux/init.h>+ w" @& H4 N- C9 p. u
  27. #include <linux/errno.h>9 y& w) K" t$ t  m
  28. #include <linux/types.h>3 t+ |6 b7 T9 Q: s$ l. ^3 m
  29. #include <linux/interrupt.h>' d( S, C# g) r
  30. #include <asm/io.h>6 K% o1 B, G" G
  31. #include <linux/moduleparam.h>
    ' R; P" J( \5 r" T. x8 j
  32. #include <linux/sysctl.h>* o2 M1 V. d9 g' S, M1 r
  33. #include <linux/mm.h>
    , }4 p/ A6 x9 T$ M: p, H
  34. #include <linux/dma-mapping.h>
    % T: m& u* F+ k- q" T
  35. * ?; ^  x* |9 [
  36. #include <mach/memory.h>1 B0 H* J% w' D0 Y1 v; m
  37. #include <mach/hardware.h>
    % X0 Y; M. ~. o9 T" i
  38. #include <mach/irqs.h>
    $ c0 _) {! V! A* ?
  39. #include <asm/hardware/edma.h>
    $ s1 |! J7 r7 U0 h' c
  40. 1 p# `/ W  \9 a
  41. #undef EDMA3_DEBUG) s$ C6 S9 q3 X) P! ?
  42. /*#define EDMA3_DEBUG*/
    - Y- p, b; F0 b) {5 t! n/ _
  43. & R9 o4 P1 |, T, d$ z
  44. #ifdef EDMA3_DEBUG
    ! ]) o# D0 M1 `/ N0 u4 U. d: H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 E+ B+ w" r/ t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! x3 @$ s9 e6 P2 X' r) K2 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% F+ T1 s7 i* Y& f7 l8 ^* N
  48. #else
    9 O2 u3 m* d: L# h0 ]
  49. #define DMA_PRINTK( x... )
    / l3 T/ K- a2 q3 U6 \4 P# m) n/ X7 h
  50. #define DMA_FN_IN! _! t! ?2 k" Z  f( N
  51. #define DMA_FN_OUT
    & O# h/ H6 X: ?% b, a8 b! }
  52. #endif6 v; G; H* F# ~* u4 @  v
  53. " n, b1 P! Q& F( f8 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 Y8 o% J' N$ K3 _
  55. #define STATIC_SHIFT                3
    ; o/ O0 ~+ A8 W
  56. #define TCINTEN_SHIFT               20% _+ P2 ^& Z2 ?0 ?. d: u, O# ]7 G
  57. #define ITCINTEN_SHIFT              21- [) m- H' E& V6 }1 C1 G- v# T! V
  58. #define TCCHEN_SHIFT                225 b, g4 k; ]" ~5 }% `
  59. #define ITCCHEN_SHIFT               23
    * m* h0 c; g$ k' N- }

  60. 3 R  N3 E2 Y! f
  61. static volatile int irqraised1 = 0;2 r8 `1 j) K: x# Z) P6 D4 s
  62. static volatile int irqraised2 = 0;
    * D9 O" \: j% H# a
  63. ) B( p( i8 R- x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( g6 b5 a% B9 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( T3 f% w5 y, s2 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 I( I+ U& b. Z. ?! E, m

  67. ( r/ k2 @1 Q1 F; V3 c' W5 Q
  68. dma_addr_t dmaphyssrc1 = 0;( l7 P1 _7 O; A: V1 q9 ]( h
  69. dma_addr_t dmaphyssrc2 = 0;
    6 R8 [1 d6 d, R4 W, V* U8 ~9 n
  70. dma_addr_t dmaphysdest1 = 0;- \/ P$ @/ l" Y- `( d: b
  71. dma_addr_t dmaphysdest2 = 0;
    2 j& {/ a, l7 U/ e6 |+ r2 e

  72. 5 B; ?2 X6 c7 z! z
  73. char *dmabufsrc1 = NULL;
    - l! m) Y* F, l' R2 b4 t( c
  74. char *dmabufsrc2 = NULL;, d* n; Q7 u: Y8 l1 F1 T
  75. char *dmabufdest1 = NULL;4 ~7 P  Y- O9 b8 G% H
  76. char *dmabufdest2 = NULL;
    - H/ \- }) B) i7 f: Q7 u+ E

  77. $ ?- [: ~# f- I
  78. static int acnt = 512;
    9 Q/ k2 \& e  W9 Z/ S- M0 a
  79. static int bcnt = 8;0 O& X5 n% T. D! S' j9 A- `* K0 r+ E% r
  80. static int ccnt = 8;
    ) D. N8 l6 [; z

  81. 7 H& Y6 Q& j3 i0 y# u6 h4 [
  82. module_param(acnt, int, S_IRUGO);
    # V8 O! w9 J9 {5 ?- m7 F! @
  83. module_param(bcnt, int, S_IRUGO);
    0 P9 d2 e% S+ S9 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 {) S4 g+ B1 E* [

3 [# f5 K5 H0 W0 q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# l, U( l3 u. \6 O1 ^. p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' H3 e8 a6 u6 ~/ O, [& o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 h( w- ]- S2 ^+ x- c+ I# s" e) |- u7 ^- ~
, ?( z; S. h4 u+ k- f' n4 |4 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 17:42 , Processed in 0.043728 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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