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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + L, ?: y6 k8 Z+ Z1 }$ m  y
  1. [code]EDMA sample test application
    # M7 `# o- ~; I3 \5 L* ^: M
  2. /*$ E* O  x% ~( Y- @, C2 u0 T
  3. * edma_test.c
    5 D  ^. G; Y3 P! P; T
  4. *
    $ w' P0 k' c$ W' P$ q! K) k
  5. * brief  EDMA3 Test Application6 I7 O! ~* r: N( e: E
  6. *
    / B& l- z1 R' l( J& |- m$ ^* {
  7. *   This file contains EDMA3 Test code.3 m$ H" T9 _8 v& g( ^
  8. *6 H0 t9 m3 ^6 e$ m8 p, g8 Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  {" k7 Z7 M' i& ]" q3 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% e& b+ B0 X: _0 I" r
  11. *         TO CHANGE./ L. z; ~; r  n5 k0 {4 b6 m, j/ ?
  12. *8 x& l4 c+ v, N4 }6 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      T. G$ [9 B" l2 o0 B9 o
  14. *7 D% r5 h( [, n' P  O$ ~
  15. * This program is free software; you can redistribute it and/or
    9 i6 |1 Y$ F$ L
  16. * modify it under the terms of the GNU General Public License as
    ; a" T2 y' i  K$ s6 h1 S; L
  17. * published by the Free Software Foundation version 2.
    9 u; g9 ?* p# W" D& W4 t6 X
  18. *7 L; W- [7 i( K$ o4 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' o' K) S! H+ S+ V6 w3 j, n
  20. * kind, whether express or implied; without even the implied warranty7 O' _: G" N0 U) f! x  u# F( W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* x% P6 s5 h# Y5 @% E0 o! C2 R
  22. * GNU General Public License for more details.
    & L8 Z6 W) Y3 }6 I# L
  23. */
    6 S# M) [! j6 Q% X- W* ~1 b" F2 h

  24. + Y2 P' H! j. K$ M" H2 m" ?* W
  25. #include <linux/module.h>
    % t' C0 G, x  v3 j) n; q" R
  26. #include <linux/init.h>
    3 N, p# H2 G0 q" y$ {
  27. #include <linux/errno.h>, }& `+ @8 X' w! w+ B5 y9 ]; }
  28. #include <linux/types.h>
    % H3 V& y6 k9 }" Z
  29. #include <linux/interrupt.h>  a" D. x! @% E$ l
  30. #include <asm/io.h>
    2 I* A, P5 K7 _- I. R% Q" J
  31. #include <linux/moduleparam.h>
    0 y, r) O& y+ K- I) ~
  32. #include <linux/sysctl.h>
    ' U6 u: p, \# S# Z4 q& B
  33. #include <linux/mm.h>, m/ |" {3 G- Y2 |" v' G
  34. #include <linux/dma-mapping.h>* x$ `6 u: g, q% [
  35.   g8 d* U7 f" K7 s& P8 @
  36. #include <mach/memory.h>
    # f0 B7 O* q) U3 w+ f. i
  37. #include <mach/hardware.h>! H! B6 S& z2 o  w, Y- q* I. H* i2 k
  38. #include <mach/irqs.h>* `4 f. ]  @7 E( c$ t( K3 @
  39. #include <asm/hardware/edma.h>
    $ }' I3 x6 i8 n" d- Y- r8 T

  40. $ b' N  ?8 R  a- Z8 l7 t7 D# ^
  41. #undef EDMA3_DEBUG
    & F! r  S% X. j$ t
  42. /*#define EDMA3_DEBUG*/
    5 s5 u5 J1 u/ x: |, b' c6 C4 z

  43. ) t. m  N1 D. Y+ U8 [1 J- c9 O
  44. #ifdef EDMA3_DEBUG
    9 S& _" c/ \: O" ~( k0 v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # s* n( t: F' C; p$ V" @1 x+ x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' e2 q7 C$ ?  t6 L! @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( I- Q! I9 Q( W1 b3 p6 t
  48. #else) _: |# l( N7 O4 D2 K# X! y& P
  49. #define DMA_PRINTK( x... )2 ^0 F: N9 @& m& m+ S3 H! @
  50. #define DMA_FN_IN; t6 r/ Z; c# f. ^
  51. #define DMA_FN_OUT; q0 p# \% {  S9 k% T
  52. #endif- a8 [5 F) o& [

  53. ! u4 T; V2 }6 G1 l8 {, }0 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 X) P  b0 A# t! `: u: O
  55. #define STATIC_SHIFT                3
      A+ p, F  ]1 U, D
  56. #define TCINTEN_SHIFT               20
    9 L* `- `, E; v; P; s  `2 o
  57. #define ITCINTEN_SHIFT              21" Y8 G+ ~* b  u! z
  58. #define TCCHEN_SHIFT                22& H# K4 r" g) V+ I% n8 Y
  59. #define ITCCHEN_SHIFT               23& c" Y! s( J+ Z7 ]5 J. R& i- W

  60. ! O8 o% j) B' t3 _$ g9 b+ h6 l
  61. static volatile int irqraised1 = 0;
    * L% D2 \$ n$ _7 z* b, D* m
  62. static volatile int irqraised2 = 0;
    % e0 L- J, k6 r- K. }  |

  63. % J( ~  \* w& q9 E# n3 l; G( b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / [( F$ t! e1 Q$ @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- E* b# ?0 g2 y0 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. k1 n9 R$ |4 W, |# Y  A

  67. 2 a7 W  }! ?1 W5 D7 O
  68. dma_addr_t dmaphyssrc1 = 0;
    % b. L  g; D+ {; J9 e( a. e7 J
  69. dma_addr_t dmaphyssrc2 = 0;0 z- v1 i& C* ?6 p: M3 p1 F$ Z) t
  70. dma_addr_t dmaphysdest1 = 0;# a9 s" B' k+ ~" [2 r
  71. dma_addr_t dmaphysdest2 = 0;$ c$ [. l/ S" P# p* o$ C$ c! p% _

  72. ) [7 b2 r- f& p% S  s" f( }
  73. char *dmabufsrc1 = NULL;6 t9 i1 `% K' v  c( l1 F' J0 p
  74. char *dmabufsrc2 = NULL;
    - C% Q3 C+ T: N( j6 q* M
  75. char *dmabufdest1 = NULL;
    , D, y& r% `# E  ~( I
  76. char *dmabufdest2 = NULL;* \8 J; f6 T3 W( C  L
  77. + I- ~5 K& {* J
  78. static int acnt = 512;3 _2 X7 N' L, V; W
  79. static int bcnt = 8;
    ' w+ {6 @; }7 H5 c
  80. static int ccnt = 8;
    1 X, N" j1 b. F0 ^4 c' ?7 h$ T- M

  81. - u$ z3 [$ j7 T
  82. module_param(acnt, int, S_IRUGO);& Q3 u, [# j5 c- i6 X3 B
  83. module_param(bcnt, int, S_IRUGO);5 o$ t. w5 R/ S3 }2 ?+ i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 k- E8 R- [  r% I: _$ H
2 w) ?5 b6 L6 F7 G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; N7 I) x7 D, \7 S: o% o, o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* H5 e# z7 f; l- f. V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 w; D$ m; D9 m$ h3 M  F5 t8 l
6 Y" X* V: P' V) E: [2 @9 a9 E* [, B9 I/ }! T$ C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 12:56 , Processed in 0.043370 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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