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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; u" i' o8 E( R/ u5 W
  1. [code]EDMA sample test application
    & s( X, `' C  A8 z% ^6 X
  2. /*
    - @2 D4 Q1 s& _. l0 o% R9 M: J
  3. * edma_test.c
    6 D/ Y/ ~+ @( W
  4. *
    ' S- U# |1 {0 c2 q5 T
  5. * brief  EDMA3 Test Application
    $ M; G( P/ ~/ Q1 ~/ G, d1 @4 s( p5 S
  6. *
    " A' ^8 d2 ~4 P8 y5 t
  7. *   This file contains EDMA3 Test code.
    6 q& n& |8 x5 V& Y) _
  8. *2 }# q2 ]. E& D. K/ M6 }+ b$ |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      M0 B$ A& w: m/ h( x# ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 w9 G' p' u7 c. A$ h
  11. *         TO CHANGE.- m2 r! X" v8 A. P4 {" q
  12. *
    7 K) a. {" _! B" u- z% o/ A9 i  W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' t" v' w4 ~& n4 C
  14. *2 A/ `, N2 d' ~- _
  15. * This program is free software; you can redistribute it and/or% G9 X8 Q8 F# f+ A, g$ k& U
  16. * modify it under the terms of the GNU General Public License as' x, n6 J! V4 ?+ k/ t
  17. * published by the Free Software Foundation version 2.
    $ t7 C, b9 H' Q, q: r* h
  18. *
    - S" w4 l( ^: Z0 D9 t( J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 `0 P6 l* o& e$ I7 H
  20. * kind, whether express or implied; without even the implied warranty4 \+ |  @% ?' J9 b9 l# F0 y4 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , u2 m$ z( F7 R* O: Q
  22. * GNU General Public License for more details.
    . k# r# \7 t7 H0 G! \( q
  23. */
    : T9 a5 r& j* l5 x2 W

  24. 0 N; e6 m& x$ {, Q7 X+ ~' y+ v
  25. #include <linux/module.h>6 @9 u! X9 Z3 s
  26. #include <linux/init.h>
    4 D% k. c4 m% v! v7 B6 m, K0 m
  27. #include <linux/errno.h>
    . l" B6 k+ j$ @8 S
  28. #include <linux/types.h>7 X4 s" [/ Z$ m" I
  29. #include <linux/interrupt.h>
    % w/ g" o- W/ e' k' `" N9 d6 ^
  30. #include <asm/io.h>0 q0 V1 a: ^" U- ?+ z. p
  31. #include <linux/moduleparam.h>$ x' q; C0 h- g: w; Q4 h+ C! n
  32. #include <linux/sysctl.h>
    3 A3 R* L  ^8 V6 r& L- m" W1 O
  33. #include <linux/mm.h>: ~( ]$ \2 y$ k) Q1 b( ?! v
  34. #include <linux/dma-mapping.h>
    " F1 k0 u, t7 H  L/ J

  35. $ G) b& w( H9 R( [
  36. #include <mach/memory.h>
    . P' }. a+ K3 o" k/ Y5 L- L2 n
  37. #include <mach/hardware.h>
    ; M- N) o/ A4 G% W
  38. #include <mach/irqs.h>
    1 k1 z2 Q" x3 a3 b0 p; d/ p- G! F
  39. #include <asm/hardware/edma.h>6 R' h& `* ^; j# m
  40. ( m& d6 Z# l! M$ L
  41. #undef EDMA3_DEBUG
    $ f! v1 ]8 {9 G9 N6 Q
  42. /*#define EDMA3_DEBUG*/
    " t; h$ `" @7 \! _5 u+ n
  43. % X- U' g/ x& x: M
  44. #ifdef EDMA3_DEBUG
    8 e& ]! }( m) |9 u* ^9 w6 K+ p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 c+ t; y2 @+ o: j1 p7 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 v3 a  s+ U$ h- J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 P+ v4 H) d% _  \9 @
  48. #else
    7 S% |8 H. f. m& t$ A; l3 H
  49. #define DMA_PRINTK( x... )
    , B% @( k0 Z# i
  50. #define DMA_FN_IN) h4 X5 |# g+ \# ^- q, y7 W
  51. #define DMA_FN_OUT, _3 a* |3 Q. ?; Q* f
  52. #endif" h1 c; w% L* A, z' n
  53. & S& |( R- Z! n! d: j0 `- w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( Q! ^* P4 l% O/ \& {0 J
  55. #define STATIC_SHIFT                3# S# }  @7 D$ z+ A
  56. #define TCINTEN_SHIFT               20  s9 S8 R9 E: L
  57. #define ITCINTEN_SHIFT              21* |, q/ C. @! ]  j
  58. #define TCCHEN_SHIFT                22! w. N1 e$ ^' }% e1 T" Y' A+ T
  59. #define ITCCHEN_SHIFT               23
    6 i# C5 |2 l9 p2 m* R

  60. 8 F2 h( G3 O4 X5 Z
  61. static volatile int irqraised1 = 0;
    3 T' Y# o, C: B& v# \: x: x) I
  62. static volatile int irqraised2 = 0;0 v4 E; J6 S4 G5 m
  63. # ~! k3 U) ^# }3 C& c1 E! K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, A7 D' w9 b' u( H6 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' e, b! Q/ b6 u6 y4 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 s: H2 q8 P) p% T0 `
  67. ' G5 |" b3 \2 d
  68. dma_addr_t dmaphyssrc1 = 0;
      w: n# p6 I+ N' c  g: E4 j
  69. dma_addr_t dmaphyssrc2 = 0;
    # k. w, |' I; s/ r* Z
  70. dma_addr_t dmaphysdest1 = 0;
    ) F9 O( k$ W0 @2 W
  71. dma_addr_t dmaphysdest2 = 0;2 j: H9 P5 A. p3 ^3 u( t9 i8 R

  72. 3 x* d+ \- J1 ^6 }' o  x
  73. char *dmabufsrc1 = NULL;/ m6 n' X+ F1 R9 f* T
  74. char *dmabufsrc2 = NULL;" C7 K3 C' M2 c
  75. char *dmabufdest1 = NULL;  c, e: H+ O; |: U. s* P1 E; {
  76. char *dmabufdest2 = NULL;4 O) ]* B# A* i# I1 Y" i, |! l- q* p
  77. 3 y# ^5 e* X" \( p
  78. static int acnt = 512;9 A9 L! g% u- p9 B4 J: ~! [
  79. static int bcnt = 8;
    0 _( o6 y# e& t1 m3 g* o5 x
  80. static int ccnt = 8;
    4 G' N- g. }3 ~0 L0 j' D% w
  81. * y& u( w( \% _6 O- k6 ^- ~
  82. module_param(acnt, int, S_IRUGO);
    $ j* ?& d! p) O" ?& O! n9 }
  83. module_param(bcnt, int, S_IRUGO);
    - y0 ?2 ~4 K+ a! L9 c( b2 G+ I* \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 Y% F! I# P. K4 s2 P) a) g3 K# w
5 J) \# d0 X! H  X6 `. U. A/ |! ]) o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 Z# X! _4 G7 y( U4 |  V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% O9 E4 _, z7 K& L5 u1 H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# d" S3 z9 B" J. G- N

' Y( m- G3 H! H# C- f' H/ d  k1 Y# m- h, Z2 [8 ^6 O( D+ t5 }6 M6 h( y& d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-22 14:40 , Processed in 0.041239 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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