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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 C' A. R. h3 _6 z3 Z0 V
  1. [code]EDMA sample test application
    ; ~( b" d3 Q9 f& u  N
  2. /*4 C; r0 Z8 q# ^1 _
  3. * edma_test.c
    5 f' _; X5 l$ J$ A
  4. *$ C' b& Q$ K0 M5 p
  5. * brief  EDMA3 Test Application) p0 R0 V6 F: e& R) @  T0 a' U
  6. *
    3 ~5 A7 i1 b) u& L: G/ T; k) y/ O
  7. *   This file contains EDMA3 Test code.# ]' A3 ~+ P& K" a% \! h$ H
  8. *$ T3 A5 d+ O0 g* ?: v4 d" M/ X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ L& O; t4 D! T5 P- u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# p0 q- |' k0 T" T0 n
  11. *         TO CHANGE.& Y: T% J! e, m
  12. *
    5 _: r2 @( j2 H0 D& V* i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 p) D, ~$ u/ e1 S
  14. *3 Z# T( X' T5 E$ o* A, b
  15. * This program is free software; you can redistribute it and/or" i; w! j2 q( m" ^
  16. * modify it under the terms of the GNU General Public License as3 M; K  c# I+ s$ B& l! ?+ U4 S* F: z
  17. * published by the Free Software Foundation version 2.+ ~5 F- |& l" E$ ~9 K! Z% P8 K, Z$ G
  18. *
    - J: {, ]- i6 R( r. w3 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! Z  P1 s& C, J; Z
  20. * kind, whether express or implied; without even the implied warranty
    . T% H7 ?% H( x2 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 V, e; Y- y/ G) j
  22. * GNU General Public License for more details.
    5 Q0 n* m1 j; L; g+ `1 H) J8 \
  23. */
    6 h# h& C. ^2 t, q3 W0 c5 f$ z
  24. 1 |  n3 c7 ^+ W* O2 S; ^
  25. #include <linux/module.h>
    1 q  j$ ]7 H& n, z( \8 y, |
  26. #include <linux/init.h>0 H& r7 o4 X! N8 a
  27. #include <linux/errno.h>
    % a# m/ w4 S7 l& V+ @6 E
  28. #include <linux/types.h>' i/ t4 g2 P) O  n- Y) C
  29. #include <linux/interrupt.h>
    / Q9 g, q+ V6 Z6 t2 H
  30. #include <asm/io.h>
    ) N7 ]* S. B: {% ~
  31. #include <linux/moduleparam.h>
    0 q' G. E9 ?8 g; ]& ^" E
  32. #include <linux/sysctl.h>
    ! c3 {& P' D# O9 z! f* \
  33. #include <linux/mm.h>
    # c( x0 Y- l  F2 X  W, M" k
  34. #include <linux/dma-mapping.h>
      b) {, u1 p2 F& a) ~9 C. ?0 m4 c& A
  35. ; `! Q0 ^' j. A  _
  36. #include <mach/memory.h>1 C: ]6 N. P" P: A$ W
  37. #include <mach/hardware.h>
      j) z: s# A7 j2 U' y: O0 f
  38. #include <mach/irqs.h>( C: a$ p$ Z" L; H
  39. #include <asm/hardware/edma.h>
    + F3 r% A7 A5 X3 r0 I* ]
  40. . E8 F) @, r  E* y
  41. #undef EDMA3_DEBUG  X& _6 M( h& p2 _" |1 x
  42. /*#define EDMA3_DEBUG*/; ]0 F, `6 o! f* y+ p! S
  43. , T2 l7 y( @! P, d" R+ G, y# L
  44. #ifdef EDMA3_DEBUG( n& Z" E$ V+ M: e- |: ~6 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 P) u: {7 H' ^1 v  f/ E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 Y. V% E" w+ t- h/ |; V* Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ t) L6 t/ t7 J0 v
  48. #else2 G# ]3 p, d. y8 J
  49. #define DMA_PRINTK( x... )
    4 \2 Q" E/ U' g- c* i% a/ G
  50. #define DMA_FN_IN
    3 q9 I: `; k! v2 ~
  51. #define DMA_FN_OUT! K( X! F4 j4 C, J, K. @! y
  52. #endif/ r1 P' j, U' j4 p1 q

  53. 7 c* d1 [3 W/ R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ f0 d3 i5 \& |: M: s8 I
  55. #define STATIC_SHIFT                3
    ! G$ r. |2 y, Y$ [2 b" m
  56. #define TCINTEN_SHIFT               209 Z, ]: O' \& K' \
  57. #define ITCINTEN_SHIFT              21
    - @  E- M  u0 @2 b% h% Z& b
  58. #define TCCHEN_SHIFT                22" e* l- v* `  l3 w9 n! k) H: y
  59. #define ITCCHEN_SHIFT               23
    5 k+ \. q. L* D0 ~7 t7 r

  60. ! v1 i+ x9 H$ f' l+ T. a$ z" H
  61. static volatile int irqraised1 = 0;
    / d  u( S: r2 M+ @1 r7 B
  62. static volatile int irqraised2 = 0;
    & Q4 v# y, n  ~/ k

  63. 9 p4 L  L+ N7 E9 X) I! s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " S! N+ E+ D- B& }  q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* D& s0 ], t/ ]  H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * J( I0 x( y5 X% o

  67. 4 n1 x" s' j! m, b% A
  68. dma_addr_t dmaphyssrc1 = 0;
    " F$ h! R" I  K
  69. dma_addr_t dmaphyssrc2 = 0;' W0 n5 U2 F* D3 i- q3 C; Q9 D0 \% S
  70. dma_addr_t dmaphysdest1 = 0;+ y* `" X7 |- r% s1 y) R8 g
  71. dma_addr_t dmaphysdest2 = 0;: n% r. @  Z% w$ u, N
  72. ' x4 a9 Y4 c4 |
  73. char *dmabufsrc1 = NULL;
    7 T& {* Q& W: m# q& _7 X/ g
  74. char *dmabufsrc2 = NULL;/ c9 q9 }5 p. J, b: f8 |4 f; o
  75. char *dmabufdest1 = NULL;4 m! B3 s5 D1 Q6 }  H; ]
  76. char *dmabufdest2 = NULL;. w' v7 ]; |5 p8 O: g

  77. 5 D$ P) a4 ?: b8 q2 `, s
  78. static int acnt = 512;
    8 s% M6 X1 p' E: k
  79. static int bcnt = 8;
    ! O- E, k5 v8 R& \+ h& l1 v
  80. static int ccnt = 8;
    - D% _% X$ ~6 e7 N) \+ S
  81. 4 V" `* \! o- O2 _6 y- [
  82. module_param(acnt, int, S_IRUGO);
    ; l. [6 W2 j3 O  n
  83. module_param(bcnt, int, S_IRUGO);
    ) J" m7 c* w8 K& c9 E& y# ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ Q3 n( q9 c  @( z2 r
$ l+ {& ~/ S+ o6 U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ a% w* b: D( T. J; J% b5 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 g/ O3 V2 B  r. H0 W4 {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; z7 ?' p4 r: F+ G+ f: ~% ]" m0 W, \# z% Y
) ]" Y6 C' D, p3 f1 B# _. ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 16:18 , Processed in 0.040527 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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