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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , t( s3 p( y9 m* q; Z
  1. [code]EDMA sample test application
    ! t7 v+ F: u/ g4 `
  2. /*, K- _# g0 w/ [, S* x3 _, F' n9 ^
  3. * edma_test.c
    3 P$ h' B% ]1 O) ?9 f) S: ]- K
  4. *" G) W4 @/ @* j6 y- W2 }
  5. * brief  EDMA3 Test Application  q- L: r& l# C1 E; m7 Y" Y* I
  6. *
    * W7 s3 b- {( R- b) P4 |
  7. *   This file contains EDMA3 Test code.
    ; o1 V* d9 m7 x+ W/ r
  8. *
    / c% y, }! w, G. Y  q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  n& v% i9 M9 E+ c9 l5 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# ^( t& V; X# L" Q
  11. *         TO CHANGE.
    / w# D) W- m  S1 u7 L# G7 E% v
  12. *
    ; F0 C  O9 c. }. T( M1 {) [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 N% F1 c/ g' P% ^6 u) K! q
  14. *
    ) n% h% r/ r4 F3 C% {3 U6 U
  15. * This program is free software; you can redistribute it and/or
    7 f5 m0 o7 V3 p& H! v/ h
  16. * modify it under the terms of the GNU General Public License as/ W% u" l0 s( P' K& L% }4 H" C
  17. * published by the Free Software Foundation version 2.* Z- Y% r2 b! A8 M# P: ^
  18. *
    " i4 \% f6 L8 W# O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # Y0 K* N- b4 Q: M& j
  20. * kind, whether express or implied; without even the implied warranty
    $ ?2 I) E1 k8 L/ S- R! G) p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * q6 V* y; I* j' U  G+ W
  22. * GNU General Public License for more details.$ [: z6 g, [* j2 [1 c  k
  23. */
    & A1 Y0 o+ q4 V4 n
  24. 4 j8 r: G" a0 e& r8 R2 l
  25. #include <linux/module.h>8 H$ e4 B4 d- ?/ S
  26. #include <linux/init.h>8 x2 P" r& ?" t6 u& r/ K, Y
  27. #include <linux/errno.h>
    - }5 J$ R# Y0 q( k: ]
  28. #include <linux/types.h>
    * `7 Y- j. S$ x3 g, T" k
  29. #include <linux/interrupt.h>5 Z: h* T! h' d. y" N
  30. #include <asm/io.h># G9 H6 I- r" e' X* R5 c; q7 R; |7 N! P
  31. #include <linux/moduleparam.h>2 \; j3 d: d" K" X/ u6 K% Z9 i+ d
  32. #include <linux/sysctl.h>
    ! o: C- G6 R2 W, ^8 [# X& y& n4 p
  33. #include <linux/mm.h>& o- z; n% y- y* A0 j/ _  f8 `% C  T: ?
  34. #include <linux/dma-mapping.h>
    ' K; X7 }- B$ P7 c( y; e
  35. # d; U0 {$ o" ?
  36. #include <mach/memory.h>+ h# q7 D5 \8 @- c/ P2 p* q
  37. #include <mach/hardware.h>" F- X/ J) X' n1 o
  38. #include <mach/irqs.h>/ {( H! I+ ~2 x( Z
  39. #include <asm/hardware/edma.h>9 @) m# Y6 H$ r- }& m
  40. " C/ G, k/ w# g2 R6 }- t# c8 W
  41. #undef EDMA3_DEBUG
    : W; G$ X3 F) y! \' g9 E
  42. /*#define EDMA3_DEBUG*/
    * _- ?) E8 m# S* T% H$ d; x

  43. 6 j+ i4 F) Y0 L6 i+ F* \5 d7 |& q
  44. #ifdef EDMA3_DEBUG
    9 I1 p4 u$ A* R+ e) H6 I9 i" [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# }" U$ \3 f2 U! o9 ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 D- J2 j7 Z2 Q% G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* r6 [! P5 U" M) I+ q4 F5 G" A6 |& k
  48. #else
    + c  v2 ?: \  U0 }) l
  49. #define DMA_PRINTK( x... )
    ( T4 X* h  I$ c' t' R. j
  50. #define DMA_FN_IN$ E/ m$ ]& ?" w2 W. V% B+ p
  51. #define DMA_FN_OUT
    $ C6 D% P. w% n6 G. f
  52. #endif
    $ \& m9 @6 f  @8 ]- `$ ]
  53. 7 A3 }' v8 x8 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      W" ~% B- a: v) U  @
  55. #define STATIC_SHIFT                32 ?  x# w/ M7 d- P4 b' F4 z+ @$ Q0 I% |
  56. #define TCINTEN_SHIFT               20( x5 m4 U# t$ L0 v# s
  57. #define ITCINTEN_SHIFT              21; S- C4 X) b+ }1 k2 a9 G4 Z& T1 S- T
  58. #define TCCHEN_SHIFT                22
    ( J  E5 [. U  X# X% U
  59. #define ITCCHEN_SHIFT               23
    $ u# o, p) i- n6 U( V/ M

  60. 4 z6 ]* C9 B" u$ ^* ^
  61. static volatile int irqraised1 = 0;
    ) e% C. K7 ~9 c- E& y
  62. static volatile int irqraised2 = 0;
    $ m! D4 e7 X; f9 m' h

  63. + M& H9 q5 E& I( K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 O' \' V, M* @/ x7 S4 ?3 i. a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , y0 G4 I' U1 c. b( {+ @* h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 f9 y1 q/ q0 G7 x" r8 V5 w
  67. . l. q* L. v' t$ M
  68. dma_addr_t dmaphyssrc1 = 0;3 C8 Z7 C) O+ v
  69. dma_addr_t dmaphyssrc2 = 0;
    5 L- a) C% G% r& b: i( @1 D
  70. dma_addr_t dmaphysdest1 = 0;
    $ g5 X& m* s( c  `5 |
  71. dma_addr_t dmaphysdest2 = 0;: A7 ?: Q6 z6 `  x

  72. ( c1 f4 h% k# d) \) x, n
  73. char *dmabufsrc1 = NULL;
    / n' K, }$ i9 n# q
  74. char *dmabufsrc2 = NULL;
    # F2 M9 C* E- o7 n( m# d
  75. char *dmabufdest1 = NULL;; G% k$ D! {" U+ p
  76. char *dmabufdest2 = NULL;% W$ l) r  S6 \- n( S- A/ y8 `

  77. . v/ Y; z& J6 ^
  78. static int acnt = 512;
      b0 z1 R5 u1 [, E) z
  79. static int bcnt = 8;+ {: n3 j; h  j8 C* w
  80. static int ccnt = 8;
    " h! X% x2 c# ^/ K8 D% Y6 G

  81. ) N3 z/ |; G5 J
  82. module_param(acnt, int, S_IRUGO);( |3 [" T" Y5 I
  83. module_param(bcnt, int, S_IRUGO);( {2 z) h/ v& Z& [% m3 \7 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 K2 y7 H  g" Q0 K+ \5 m; }1 J, s4 T- Z1 N9 x7 G* A, J( o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. m" M5 Y& x( c9 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; |5 c8 ]- @$ y* \4 m5 e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" u# Y8 B. u7 H1 ?( t
. i* n, r# ]& z7 v( e

3 g2 h0 v$ T$ c: O4 j# o. r7 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 21:48 , Processed in 0.040722 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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