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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& y2 c+ M& `3 C. q' j1 i
  1. [code]EDMA sample test application' N" w; n# y- |# }
  2. /*
    7 m' Y& u/ w7 L
  3. * edma_test.c
    " B7 w6 V) }' @4 p" x+ I+ w
  4. *) u! K: c6 X* X  M2 Z& |
  5. * brief  EDMA3 Test Application
    7 s- \( S! r8 |% ~+ p
  6. *
    ; G- ^* c. ^0 Q& u4 x' P) K2 T
  7. *   This file contains EDMA3 Test code.1 K, W# ]' ^9 U7 F
  8. *
    8 M3 K9 W+ x4 [# o0 {, c, Q0 K3 I2 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 b. @0 w+ B9 J$ w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 h/ P* Q% [2 X9 @
  11. *         TO CHANGE.: w5 n  \+ v8 s3 i6 t! Y
  12. *: h' ]  J3 d5 l; K* G3 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ x. y, j' A1 @' ?
  14. ** _1 w% {; Z- T; |0 o" V" x
  15. * This program is free software; you can redistribute it and/or
    - ^! `0 U. U* V5 g4 W0 }
  16. * modify it under the terms of the GNU General Public License as2 S+ S1 C+ L; `$ S' y: ^$ {
  17. * published by the Free Software Foundation version 2.4 E  }- X; o3 K3 e* S
  18. *4 G: {4 i8 j/ L, Z0 F1 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! J% Y3 v7 E" o
  20. * kind, whether express or implied; without even the implied warranty
    2 e: L% l6 V/ B% V$ J, k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 F6 {. M! W7 b( h5 X
  22. * GNU General Public License for more details.- G" r: B2 ]' I3 r. W  k
  23. */3 Z2 J( j* C2 J2 U- v. Q0 x. z

  24. * k% i5 v; L5 V2 r
  25. #include <linux/module.h>
    * X+ ]9 K1 O& y: M; L
  26. #include <linux/init.h>9 r: }+ E8 g4 K2 G/ `, w% F5 E0 G
  27. #include <linux/errno.h>
    - b8 d. X7 E+ @& T8 Q, k' C
  28. #include <linux/types.h>- C) {0 n* Z7 I2 u0 B$ P1 h
  29. #include <linux/interrupt.h>
    ; q, y, Z' d4 w$ e: E6 u/ i
  30. #include <asm/io.h>' ~& [$ \% P; ?. J9 M8 H9 ~
  31. #include <linux/moduleparam.h>
    ; E* w$ ?0 H# H( \% O! N9 ]& T
  32. #include <linux/sysctl.h>, n+ x0 B1 `5 p6 u$ @8 Y
  33. #include <linux/mm.h>
    / A  d/ I" O) s" T, j% |
  34. #include <linux/dma-mapping.h>
    4 `+ U8 b7 n7 Z2 f( t9 v. r/ B
  35. ) @( ?: P& ^7 V) W$ _+ o4 h
  36. #include <mach/memory.h>
    1 u3 L/ p- e1 s3 a
  37. #include <mach/hardware.h>
      {" _% \( ^2 k  l! l
  38. #include <mach/irqs.h>
    ) z; o. Z0 r  \/ j
  39. #include <asm/hardware/edma.h>1 d2 e' w6 n5 V7 |0 c# g

  40. $ u0 U/ q0 E3 U
  41. #undef EDMA3_DEBUG% |. A% _3 m; Z
  42. /*#define EDMA3_DEBUG*/
    : g5 ^- W% C. m9 m6 U

  43. 7 W6 v  C! Q% m  {2 E9 I8 o/ @1 A
  44. #ifdef EDMA3_DEBUG
    # s$ N+ V% y+ V0 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . Q; y" I4 N. E  K2 E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ g. Q" a* v) S( ?3 E' e( a; g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 @, u6 u' t* ~0 [7 X7 }4 L" l
  48. #else
    ( W' S: u4 ]8 _3 G) y8 {; ]9 g
  49. #define DMA_PRINTK( x... )
    7 M# V: r2 [3 p1 c+ O- P
  50. #define DMA_FN_IN
    / G3 M, i0 }* Y7 V
  51. #define DMA_FN_OUT/ f/ G) |/ J! g% a" S" n, i  x
  52. #endif2 v1 k1 S4 G; u+ H9 c  l7 _: X' W

  53. 2 U% X; _/ s; o* t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( w2 K) r6 o% k
  55. #define STATIC_SHIFT                3
    5 }% P4 Q8 O$ M' ?6 B* R+ f
  56. #define TCINTEN_SHIFT               20& z+ D5 C8 V/ }" f" q* t4 j; N9 d  ^# d
  57. #define ITCINTEN_SHIFT              21- p# e% E; B3 t, E& E
  58. #define TCCHEN_SHIFT                22
    * s2 v, r8 Y# d4 }: G4 ^! r
  59. #define ITCCHEN_SHIFT               23
    4 h# Y: y* J& Q

  60. & B) r+ t# i" |2 g$ e
  61. static volatile int irqraised1 = 0;* h8 W( C# w; m" i; w6 @& U# b+ o; e) }
  62. static volatile int irqraised2 = 0;2 G' l, r7 s" f1 k( W( Z. U
  63. $ A0 d. X. S9 y+ q0 `1 @# L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 K$ p1 c& M" p, Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 S6 `6 ?+ z: Y+ J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : w5 Y' B  C$ ~) e6 j& {0 }

  67. 5 P) i( a6 b0 v3 y2 p/ l) i
  68. dma_addr_t dmaphyssrc1 = 0;& e$ \- X: J& J7 q' ]5 |5 s
  69. dma_addr_t dmaphyssrc2 = 0;
    1 i0 i2 i: i# }& q
  70. dma_addr_t dmaphysdest1 = 0;0 _, J4 n: w! r/ z. b' B
  71. dma_addr_t dmaphysdest2 = 0;, O. g* y5 z3 h3 t" {0 V

  72. + f* {# V( Y$ v) a; `5 b+ a
  73. char *dmabufsrc1 = NULL;
    / c5 W+ H1 ~/ [# P6 a5 b
  74. char *dmabufsrc2 = NULL;
    - E  K( P: c0 P; q0 Q
  75. char *dmabufdest1 = NULL;9 i( }  Y6 h; H6 x( [6 e% |# k
  76. char *dmabufdest2 = NULL;
    + @9 I" E; Y' B' N$ w. K

  77. , V2 x% h& N2 G& S; s. N
  78. static int acnt = 512;, {9 F. v* X! P& i+ V
  79. static int bcnt = 8;  c7 A* t6 Q1 @$ t. S4 W
  80. static int ccnt = 8;& q7 ~3 e& I$ r& [! P4 x

  81. 0 Q* @$ _2 l' Z1 \
  82. module_param(acnt, int, S_IRUGO);
    ; Q( z$ }7 @1 M/ q7 ^
  83. module_param(bcnt, int, S_IRUGO);5 C- V7 N! C: {6 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, q. [$ k  \) U/ `2 ]0 ?  |/ H& {8 h1 p& p% C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' O; T# p5 k3 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- a! t# n' T# S6 @& ]- b' Y; a. X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# a9 S+ J$ h" y- d7 l0 L* Z( {2 V8 @7 z$ [! O

: q' Z, l) C- y; G5 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-15 01:21 , Processed in 0.044200 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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