OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# d- v( }, l, A6 R. y& \
  1. [code]EDMA sample test application
    ( ~+ J' K3 V0 M: i! g
  2. /*
    $ @9 D* A& f( U9 d1 K# ?1 v0 W
  3. * edma_test.c
    ! T0 L* w1 m/ ^1 Z; ^, q% n
  4. *
    7 _( R/ m; L/ ]' _( {
  5. * brief  EDMA3 Test Application% x9 [6 Z4 b- j; F; P  j2 f1 K3 ~
  6. *9 |, m; m  r; a* D) c# L
  7. *   This file contains EDMA3 Test code.
    ) |4 K) a& W3 u' ~$ G
  8. *: U. G  n9 l$ w7 }( B+ R- C+ Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - Y8 t  @( W: e+ ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 v5 K# T5 T. p% m8 n
  11. *         TO CHANGE.
    3 U2 [. U, b. P
  12. *6 r% t0 x* a  l7 A; d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 a; d2 V( |( s0 q: b  P4 H9 X# q
  14. *6 o- X4 s( f% M' z% R
  15. * This program is free software; you can redistribute it and/or
    7 S' p+ c, p4 S& A
  16. * modify it under the terms of the GNU General Public License as$ [1 K( Z( R, o; L+ J' K
  17. * published by the Free Software Foundation version 2.
    # Y4 O1 ~, ]9 d) Z2 }6 @( U8 t
  18. *- X/ q  E5 R6 F0 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( O) B4 P0 H  T7 z$ ~
  20. * kind, whether express or implied; without even the implied warranty
    3 c) Q+ I2 f7 d* u9 ?, |+ s- x  M" x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 Q/ Z& D7 ]  c: L
  22. * GNU General Public License for more details.
    + u* v' g+ {4 e! Q& o8 r9 p( ^0 q2 _
  23. */
    ( I: s% s6 Q: J/ r  u0 {
  24. # a  q$ g  t8 N5 T4 ~, M# F3 |
  25. #include <linux/module.h>
    # h( P) U3 T4 Y2 V2 P( {
  26. #include <linux/init.h>
    $ Z3 q: ]7 }1 b, B! _
  27. #include <linux/errno.h>
    6 i* u5 h* S5 k! X. ~' l7 X
  28. #include <linux/types.h># U. ~/ n$ i. Z/ D2 ]
  29. #include <linux/interrupt.h>  Z. J1 t8 m% L. c% x& o
  30. #include <asm/io.h>! G3 q$ k" w6 w1 L7 }
  31. #include <linux/moduleparam.h>, b' y; S3 L/ O% a# Z0 Q) p3 Y; c
  32. #include <linux/sysctl.h>
    + c5 |* `( ^5 B& M' i4 R' ?
  33. #include <linux/mm.h>1 ~' b( }, k) J& }: Y( K
  34. #include <linux/dma-mapping.h>
    * v6 \0 F7 A# f' N
  35. " \& D, u) @" `/ e3 ^, ^
  36. #include <mach/memory.h>0 U1 I% r1 l! Q- }* t1 Q
  37. #include <mach/hardware.h>4 v; o! K" M  i7 N7 s! Y
  38. #include <mach/irqs.h>
    $ R$ `8 H, W# O+ H  n
  39. #include <asm/hardware/edma.h>
    ( G8 c8 Y8 C( V! p; T  F2 s
  40. 4 `) D- h+ @4 `6 n3 ~6 V
  41. #undef EDMA3_DEBUG
    7 _( u0 j" i: H  P6 _+ Y3 T0 z  I- a
  42. /*#define EDMA3_DEBUG*/
    0 m6 X- \8 \7 Z0 p; B% k
  43. . N7 U; D6 J3 ~  Q3 w" F0 q0 s
  44. #ifdef EDMA3_DEBUG3 J7 h& i& S/ [* ?  d& s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' }  n) I. ]( s& G# |( x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - H4 k  n1 U8 T3 V& @/ Q" @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 ^. }: p6 D; A6 K, b% x2 N
  48. #else" H' C7 p2 U1 _6 ?# j& V
  49. #define DMA_PRINTK( x... )/ n9 D8 M. v% [" e
  50. #define DMA_FN_IN# @! i4 [# e) r. {: s1 D# z
  51. #define DMA_FN_OUT6 i+ Y4 o. w  @( r
  52. #endif
    4 ^: K' ~+ Y& ~0 B: \: o* ^: t4 I

  53. / K$ }  }+ K* ~: I6 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 }6 p# e* _5 U3 Z1 _0 Y* q
  55. #define STATIC_SHIFT                3
    8 O* c2 W" k" ?" X) Z
  56. #define TCINTEN_SHIFT               20
      ]0 p3 l8 X( i. p0 Q% `3 @0 C" I  \) E  a
  57. #define ITCINTEN_SHIFT              21
    - V3 q: u/ E8 D( i9 n3 g
  58. #define TCCHEN_SHIFT                224 I! M) R6 S) v0 d
  59. #define ITCCHEN_SHIFT               23
    " r# i. ?6 k) `3 n$ E4 I, P" ~

  60. 4 |! l5 z. p9 O3 F  X
  61. static volatile int irqraised1 = 0;
    8 K& x1 m) a. G+ ]
  62. static volatile int irqraised2 = 0;
    2 F: K2 Y; f* O$ C& _  B6 t
  63. : W# `5 {& l+ F  {! D7 u* [' K) s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' k4 P0 d6 G2 r) ~- E: z$ i. @  [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 w; g! S( Q. Z8 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " \) G4 s  }  p2 ], ]0 d

  67. 5 ^5 h- Q( R0 Y& o' V1 Y
  68. dma_addr_t dmaphyssrc1 = 0;2 Q, N, B! t& }) X7 w; C
  69. dma_addr_t dmaphyssrc2 = 0;
    # U- Y: a* i+ \$ K; O
  70. dma_addr_t dmaphysdest1 = 0;
    ' j( \( H& q3 H5 M7 t
  71. dma_addr_t dmaphysdest2 = 0;5 }0 b1 h1 z% r( l+ m$ T! v
  72. 0 E6 ~- ~% T6 _7 }# G2 j$ F5 s
  73. char *dmabufsrc1 = NULL;& q4 j1 c6 ~! j: [0 b7 ~  u& }7 b
  74. char *dmabufsrc2 = NULL;/ h6 z" h" z% k' e9 ^+ v
  75. char *dmabufdest1 = NULL;
    & v7 J( A+ l) u5 b: f8 I% Q' d
  76. char *dmabufdest2 = NULL;. P9 |. q$ N& O  n% f  E6 Q
  77. 0 R( f0 z* _6 q- {% e, b
  78. static int acnt = 512;1 ~" c0 [2 @; K! Q" z2 |
  79. static int bcnt = 8;
    8 S! j( s+ j" r! S
  80. static int ccnt = 8;4 F9 l+ L9 P! t& [1 B
  81. 8 g# F5 M2 U- [
  82. module_param(acnt, int, S_IRUGO);
    . I  @, I4 c0 ?, E, f" k, v- ]+ J
  83. module_param(bcnt, int, S_IRUGO);! [' `, p, K' @* X; ^) b5 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. {4 D( C8 Y; T8 Z/ _9 U8 i
* F3 E1 F( Q5 V$ @4 f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& t: D' _4 Z9 I+ p/ m* F! iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) h$ \/ h9 I  q% u7 [: l* y- S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* |. G: J) p' C& ^6 i9 ^% G5 [+ M$ C: B, d) C2 X
$ x  [, H# ?2 a7 J+ P0 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-2-28 04:57 , Processed in 0.049623 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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