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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 ]$ Y" {+ T. s! S8 t8 j! c3 I$ D- T
  1. [code]EDMA sample test application9 ?' ~# F5 J: l6 n  A1 r! K' |& i6 _2 R
  2. /*
    0 k. h3 ]: V( Y4 Y" k* h2 o
  3. * edma_test.c/ m7 U; E4 i8 W% H3 S+ f
  4. *
    8 G+ F% ^- x4 S! {5 e; y' g
  5. * brief  EDMA3 Test Application8 C3 \2 c! u. O: p- \" u. a; Y# e
  6. *
    + z  Q# Q8 A( ~( Y4 s& n: B
  7. *   This file contains EDMA3 Test code.
    - h0 T0 ~. n% h
  8. *+ m! @+ b" m6 t& Z( ]7 E0 O. y  o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . D$ ~: I: |4 z$ b- A' ]' J( l) ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & t6 I1 u9 [9 ^# _
  11. *         TO CHANGE.& h. b; a3 I+ d- O+ ]9 u9 l* F
  12. *5 S5 X! w: F) M0 g9 w$ F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ R4 ~8 R; e  I
  14. *
    $ d, b' t; r5 J1 N' |* [7 Y; V
  15. * This program is free software; you can redistribute it and/or! T' k$ Q4 d' z! O% Y$ a* z
  16. * modify it under the terms of the GNU General Public License as' o  _' [6 c% M5 w9 \3 U9 L& \
  17. * published by the Free Software Foundation version 2.
    + p# x" G) k9 Q+ B
  18. *6 J/ @% M( X( z/ C% c' u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' H* g. k; N! S. n# i
  20. * kind, whether express or implied; without even the implied warranty- r! q+ }; F7 k- H8 \8 o5 T" i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% V4 [' T3 |( Y
  22. * GNU General Public License for more details.+ [& w; f$ L" W5 m1 m3 F4 B
  23. */1 i$ h9 f+ G7 G/ E# P
  24. ( k9 O$ s$ o, F. x6 A: l
  25. #include <linux/module.h>
    ( t; i6 ?! i( y8 f* I: b; ?1 X
  26. #include <linux/init.h>
    6 h+ B+ M; A8 u5 b% O% H% L: y
  27. #include <linux/errno.h>1 _$ q4 y# [* w2 F9 c; W9 J  S8 x
  28. #include <linux/types.h>, C  M" F, g/ ?
  29. #include <linux/interrupt.h>0 n( q- A! m) i+ Y, o5 J
  30. #include <asm/io.h>
    2 G2 A1 G0 ~8 `  u0 ?! w3 e
  31. #include <linux/moduleparam.h>
    5 I- d3 N8 k' d& E
  32. #include <linux/sysctl.h>
    1 ~, k0 l* Z% D7 u' A
  33. #include <linux/mm.h>5 V7 E! _0 F' Q, h/ l; o
  34. #include <linux/dma-mapping.h>/ r8 S8 X/ G2 s: R4 Z

  35. 5 E/ P2 O, H- q/ d) b
  36. #include <mach/memory.h>& P; j" p( j, i/ }( S: @
  37. #include <mach/hardware.h>- j/ g3 l7 j% T; \1 J* W8 H; s% ?
  38. #include <mach/irqs.h>
    0 }, ?+ w3 o5 Y* m& V" I% @
  39. #include <asm/hardware/edma.h>. C, o3 N8 O; }/ |) H

  40. , l" ~8 p2 m5 |( Z
  41. #undef EDMA3_DEBUG2 I' e* ?2 C# c7 V# Q
  42. /*#define EDMA3_DEBUG*/
    0 y# d6 n6 F# [: p

  43. ; S5 r! I0 D1 q! R; k, \  T
  44. #ifdef EDMA3_DEBUG
    ) ]4 n8 H; J9 O- K1 k, K0 e6 {6 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # j8 p9 }6 G( b, l7 E% a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # n( P6 ~+ _$ E& ~8 G7 B! C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      X8 L3 j4 M8 C: K
  48. #else9 ]; j* W" G9 R
  49. #define DMA_PRINTK( x... )& o* Y8 B8 c2 X
  50. #define DMA_FN_IN
    ) C+ ]) t' {" J+ f7 l1 X* {
  51. #define DMA_FN_OUT8 [' ]5 e$ Y' m9 _9 m( k0 @5 v
  52. #endif/ G1 D) c# o! s6 T& r
  53. 6 M( T. o+ o1 J* Q, W  x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 Y9 N$ n3 }( M4 M( L
  55. #define STATIC_SHIFT                39 v$ O7 o8 u# V2 N2 q$ S
  56. #define TCINTEN_SHIFT               20/ }& R! e* u3 t9 L1 K% b/ A3 s! _
  57. #define ITCINTEN_SHIFT              21& A  R7 Z2 H) D) X9 F$ S
  58. #define TCCHEN_SHIFT                22
    . R% N4 I8 ^2 Z& [, U6 u( ~
  59. #define ITCCHEN_SHIFT               23" ?; Z2 _7 C$ K; f( |
  60. 1 a( F( O  b3 c+ ~& V
  61. static volatile int irqraised1 = 0;, q0 X3 f# h8 V/ S7 ^
  62. static volatile int irqraised2 = 0;' _) f* h+ T+ B/ |) y5 }

  63. / i; i( c6 ^+ v' E4 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! n2 @* V# W/ a* p7 E% c8 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* a! C  B( i1 J7 b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * q! ~4 ]2 e" m& i7 [

  67. * x' d; i( D, g
  68. dma_addr_t dmaphyssrc1 = 0;4 e$ {) `  _. ?. I
  69. dma_addr_t dmaphyssrc2 = 0;# q5 U) F/ E+ p2 p" X% H4 B9 [
  70. dma_addr_t dmaphysdest1 = 0;3 x9 F# _- H" b" W* c
  71. dma_addr_t dmaphysdest2 = 0;2 I9 J6 E8 W& t& d/ m( c5 Q: D
  72. 0 W5 l6 K' @; F
  73. char *dmabufsrc1 = NULL;
    6 S: E+ W: c# s6 K( D# Z
  74. char *dmabufsrc2 = NULL;# Y- ^; G" g2 [* B* u! U
  75. char *dmabufdest1 = NULL;6 T5 f- [" n% t9 a* D
  76. char *dmabufdest2 = NULL;
    6 D& N2 b- [9 h& r2 c: k

  77. % @. ^" e: P8 j" e3 M7 k" o  _
  78. static int acnt = 512;
    2 u# }0 I3 d5 w8 J
  79. static int bcnt = 8;3 O# M4 l2 ]  h+ E7 N4 ]. j$ ]1 X
  80. static int ccnt = 8;
    2 x6 @" ~4 w% R# D
  81. 0 v0 I9 U9 W8 s1 m4 k: Y8 e
  82. module_param(acnt, int, S_IRUGO);/ I% A; L# K3 `" M# }; x6 ?/ {! |
  83. module_param(bcnt, int, S_IRUGO);$ a# T1 ]% B6 X6 G; R; \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: ?6 g- F# v1 M! x" h  N1 r

6 ^7 {) a- q: ]: W* {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 ^) H. [4 t4 h; q2 Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) \) i& n1 `9 e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. {3 g! J! z+ F$ u) `! }* B3 i2 ~
# o3 c# g4 C2 m% ^% c# ^  d) G) f/ Q7 o- f8 H! r. q! v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 17:17 , Processed in 0.038475 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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