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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 _; E- Z" M# ^! a6 u" i( P
  1. [code]EDMA sample test application
    ' o- A/ d- J1 k9 e0 i$ Z( o3 u5 N
  2. /*/ _* y* d! I6 a# r
  3. * edma_test.c
    5 H9 {' D% ?) Z3 ^# c6 M7 T1 A
  4. *" S: N1 B) ^9 p; Y7 B- F
  5. * brief  EDMA3 Test Application5 t. M* g6 R( F' H/ e
  6. */ d8 |- s5 D; L, A* W
  7. *   This file contains EDMA3 Test code.) U1 A. |; z1 u, {4 P; d# h) M
  8. *
    9 x5 k" }# Z. [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 B8 x) i* I/ r* U6 S3 W$ m# L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& k& E, f& ~/ ?" _6 i
  11. *         TO CHANGE.# b* V$ e1 `" l# l9 l/ f; {
  12. *$ }& }6 B3 m& n, U; I- S* b! g# f. U. U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, h% D  ?/ z, {& d1 K' J, T' A" Y
  14. *& W8 e5 o! C& e2 v$ n! Y
  15. * This program is free software; you can redistribute it and/or6 @; A1 Z3 a, C* P' P
  16. * modify it under the terms of the GNU General Public License as1 ?) k+ D# j( ~+ [2 w( c1 b* I
  17. * published by the Free Software Foundation version 2.
    * S7 V" B- L5 C
  18. *: ^, a5 C  }  `) G- ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  j5 k0 i7 v4 K! H* x! e3 }
  20. * kind, whether express or implied; without even the implied warranty
    ( K6 X- g' D: W5 C% K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, h7 [& [9 y+ I' T
  22. * GNU General Public License for more details.6 s9 o. D: a( B/ q$ f6 a: ]5 I
  23. */
    - M: ~. \* M% q
  24. 4 B& e7 X6 K  T3 l1 ]4 c) r0 V, G1 [
  25. #include <linux/module.h>* R( q; G8 r5 i& |$ U
  26. #include <linux/init.h>
    1 o9 {+ _3 q) u% |# q( b& Z
  27. #include <linux/errno.h>
    2 `- M" H! u: B: j
  28. #include <linux/types.h>
    ! q: {# @% a2 O/ U
  29. #include <linux/interrupt.h>
    ; t' P0 n3 g! |9 E! B
  30. #include <asm/io.h>
    # A9 @) D( q4 v5 i5 |2 c
  31. #include <linux/moduleparam.h>
    ; [# p  A! y3 R& Z& L% _
  32. #include <linux/sysctl.h>
    / c9 X3 Z7 p2 H+ W5 v
  33. #include <linux/mm.h>6 w+ c' m; A% l% D+ P
  34. #include <linux/dma-mapping.h>3 p4 N8 Y+ H( k7 J% X, }
  35. 5 \* \3 \4 |! V7 Y9 B% [
  36. #include <mach/memory.h>
    3 r" C3 v9 s8 I
  37. #include <mach/hardware.h>
    / ?* i. y- P+ ~/ [! R# A7 A
  38. #include <mach/irqs.h>
    * x: O0 d; l' D! Q# I
  39. #include <asm/hardware/edma.h>
    7 v+ y8 D' M! Q( c: b

  40. - N+ g/ J' z/ ?  ?5 D' y
  41. #undef EDMA3_DEBUG
    ; [/ z% h$ ~; t7 z$ J" _
  42. /*#define EDMA3_DEBUG*/# _" Y- \/ b2 A- h7 z
  43. 8 X: U$ Z8 K: V* T4 e+ l; G9 A' J
  44. #ifdef EDMA3_DEBUG3 Y6 [2 ~. [/ Q9 u* ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 j0 W5 `" n+ \% ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! ?4 f2 `0 X6 x/ U8 V/ y  s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ [/ X3 e$ D7 D
  48. #else
    * F* Q3 p- e$ v" c$ g) h
  49. #define DMA_PRINTK( x... )" _( u: g; v/ }, l/ P
  50. #define DMA_FN_IN
    7 E2 e! n+ j! [& L$ y, ^
  51. #define DMA_FN_OUT, P% ]. V* l, y
  52. #endif
    2 D4 a- i; M4 l& h: ?' ^
  53. 5 d5 U  v' b* |, o- K/ h- Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! }. a2 B* _6 J/ p6 C8 ^
  55. #define STATIC_SHIFT                3
    ( O  I! O. m, U* K
  56. #define TCINTEN_SHIFT               20
    7 G( @% L& h, Z* Z
  57. #define ITCINTEN_SHIFT              21! Z# f/ A% G7 ~2 t
  58. #define TCCHEN_SHIFT                22' M# u" R, H) Q. g
  59. #define ITCCHEN_SHIFT               23
    ! s7 Y( s7 [+ S1 o* ]# q6 R8 J
  60. ( i/ f5 Z" ^% t; o& S
  61. static volatile int irqraised1 = 0;! t8 A, B5 T2 d/ G1 t% I* c& ^
  62. static volatile int irqraised2 = 0;
    ' y1 W7 J9 X+ k6 z7 o3 Q. v. h7 H3 Y
  63. 5 x5 t5 a* I$ g7 o5 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% f% E" v9 `% i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " _- s. s1 L& ^! f! `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" c8 W8 R/ j# L1 J0 h
  67. & h' z, {: K- }8 @" _2 @+ B
  68. dma_addr_t dmaphyssrc1 = 0;, C3 G! I0 d) P$ A2 A
  69. dma_addr_t dmaphyssrc2 = 0;
    % ~+ w$ e6 |! m- N- \! j
  70. dma_addr_t dmaphysdest1 = 0;
    3 Q! Q' d. [& L$ s0 a6 R/ n
  71. dma_addr_t dmaphysdest2 = 0;
    4 G" I  g1 H8 u% |

  72. # P- s* n8 V0 ?7 ]' W
  73. char *dmabufsrc1 = NULL;+ _7 C0 G/ A. l4 w" |
  74. char *dmabufsrc2 = NULL;# s- G' p: ~& ]! ^
  75. char *dmabufdest1 = NULL;
    1 C/ `1 E4 U/ O
  76. char *dmabufdest2 = NULL;% x! L  {" `: k  x' k! \9 m

  77. * j; m+ _" T! v7 O6 ^% Z/ ?9 f" A: D
  78. static int acnt = 512;
    / u0 J' n1 N/ C
  79. static int bcnt = 8;+ W( J& ^' t( r/ b8 {
  80. static int ccnt = 8;9 [" {! B& q* Y8 O5 o

  81. . K- m: y, I8 j
  82. module_param(acnt, int, S_IRUGO);* l# x3 _: [" @* u% q) R$ D
  83. module_param(bcnt, int, S_IRUGO);
    8 U1 O7 g  y, B! X( f: Y2 s' y* {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! V' K& T9 N. m/ I- ^1 r1 d6 K, G; e# o" o( ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 Z( h# u7 w. w) Z. y2 {! h0 m# P' oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; p1 a- K9 @" ?" U! B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& T+ e: N5 B+ @- ?+ J' K6 A9 p0 A% W4 v: I& E6 `. u  q

" F5 l0 l8 O- Q  ~$ ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 15:28 , Processed in 0.044639 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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