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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! X+ w1 Y. f) u9 Y6 N% W) H
  1. [code]EDMA sample test application) f5 h$ R+ j! c0 X, Z# ?
  2. /*4 ~& [1 p& f* f* x9 O
  3. * edma_test.c" F5 B( y" k# \6 p
  4. *, d/ t, O. d$ p$ u7 T3 L4 F$ J
  5. * brief  EDMA3 Test Application
      j: @9 ~7 J2 X- ]0 C
  6. *  V) q4 k! l; F3 {0 i8 P
  7. *   This file contains EDMA3 Test code.
    , q6 T8 e1 e( L) I! y' O0 Z
  8. *
    ! ~, `  T; n( }) s* S4 x  o) W0 ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; ]1 @: X. @! C2 r- j' u2 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; z* l& y( U0 ?: a, L8 |8 z
  11. *         TO CHANGE.9 {2 H! ?9 z: X& }! g4 L. P
  12. *
    " e0 }1 a; S" r/ V7 u  x9 }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 T0 D* A4 D' f2 |9 }" X
  14. *
    ! P( P5 R/ a+ `8 d
  15. * This program is free software; you can redistribute it and/or
    1 v0 ]: f/ c5 s. z
  16. * modify it under the terms of the GNU General Public License as2 Z# E9 t5 s: K9 w
  17. * published by the Free Software Foundation version 2.
      u" X, Z% e* G# Q7 \
  18. *
    * o" |. ?( D0 y. |8 t+ e) \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; L5 S- h+ X  g
  20. * kind, whether express or implied; without even the implied warranty
    9 |8 a* w4 \$ `9 y+ \% j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: ?. O. k/ K" S4 Y1 l
  22. * GNU General Public License for more details.8 O$ p$ n6 w, B+ S4 v4 F
  23. */" D) x8 j# b0 F7 H
  24. ( ?' j( T, ]  R, p5 R8 t
  25. #include <linux/module.h>
    % o  Z% q9 D: ~7 e
  26. #include <linux/init.h>
    5 B0 U( ]/ l, t4 w/ n) @( @
  27. #include <linux/errno.h>$ K( x# X1 J" ^6 P7 m6 s8 Z
  28. #include <linux/types.h>( X- i; ^5 r/ P! J; K$ u/ E9 m
  29. #include <linux/interrupt.h>
    6 T% P  C; a# Z- m7 N8 W2 r
  30. #include <asm/io.h>; Y: a) m5 q: N6 |% O1 ~. _
  31. #include <linux/moduleparam.h>. t5 g) l/ F' I: r/ J
  32. #include <linux/sysctl.h># \6 R* V6 X8 q" r( i' v% |
  33. #include <linux/mm.h>: z/ ?( \4 R  A8 P; Z/ B6 `6 l) K
  34. #include <linux/dma-mapping.h>6 F' V8 [1 W8 W  a- f4 @
  35. # T0 e1 D$ ]8 j: p% w: c0 s& k9 c, L
  36. #include <mach/memory.h>
    5 T, Z, i1 D8 t" d
  37. #include <mach/hardware.h>! i6 g, Q3 M) a$ a# B* a* P4 U
  38. #include <mach/irqs.h>/ C" X/ Z4 }% T2 _% q' W
  39. #include <asm/hardware/edma.h>% @* z, p, o5 o* ~6 d; H

  40. 3 B# j/ p) f& ?7 J+ j- q; y$ \
  41. #undef EDMA3_DEBUG- {+ \4 x- I1 F) P
  42. /*#define EDMA3_DEBUG*/
    4 s5 X8 H3 d/ R# j5 [# _
  43. 0 R. X( x9 s2 V3 `- o) m
  44. #ifdef EDMA3_DEBUG( t$ f- r7 v5 n  o/ \* A7 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - s) H, r9 n2 C; G" L5 X& s& G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 Q9 d3 p( R/ z8 w% H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ o5 I1 t* V- {" F" t% N2 y
  48. #else
    5 i9 [7 a, I  z7 H4 t0 R2 K
  49. #define DMA_PRINTK( x... )' i; Y: c4 T. T6 q3 |
  50. #define DMA_FN_IN0 T. r! I) ?5 M. K; @; j9 m
  51. #define DMA_FN_OUT  e6 s5 N" I9 _0 c$ {- s% H
  52. #endif4 G& t% i0 M7 l) H

  53. 3 |) C; z' N" z4 Z! g% e. ^( D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% U% c# h( q+ z" X% b, N, h
  55. #define STATIC_SHIFT                3. E' E, Y5 d$ v( q  u& n7 a' U
  56. #define TCINTEN_SHIFT               200 G* Q: f. |7 P9 I
  57. #define ITCINTEN_SHIFT              21. c4 j) y) i. l2 `) _/ [/ n1 g
  58. #define TCCHEN_SHIFT                22
    . j5 F5 L- R" A6 \: {+ b
  59. #define ITCCHEN_SHIFT               23
    7 Q# l: k, g( C7 i0 d0 I  M
  60. 1 l& Q0 P9 G3 ^1 x# f$ x" B
  61. static volatile int irqraised1 = 0;
    8 e; F- V$ l7 q/ [, `2 Z
  62. static volatile int irqraised2 = 0;
    . c2 a$ W/ z. h- @/ g
  63. # F/ P1 Q" R% J2 ]- i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; c4 N/ I* x) w, n# {$ P6 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % L8 [4 }, l0 R0 t2 a; d) Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 h' F3 U" g, k3 D! y8 ^$ l
  67. ! N" y0 j9 `8 y5 C. n0 O  r) O
  68. dma_addr_t dmaphyssrc1 = 0;
    : ^3 S4 H9 q4 u) f( @- P' ?+ ~- y
  69. dma_addr_t dmaphyssrc2 = 0;
    8 k3 `8 w! P: s, W: i* D/ z
  70. dma_addr_t dmaphysdest1 = 0;7 M, v/ F2 Z1 @* }  L  {  H9 T  s
  71. dma_addr_t dmaphysdest2 = 0;
    - G3 c# D$ h( b7 k

  72. ' y. m6 ^& c3 _1 x2 Z3 c- x
  73. char *dmabufsrc1 = NULL;
    1 b3 F. _8 n& ?7 V
  74. char *dmabufsrc2 = NULL;9 x+ A' ^. V# _
  75. char *dmabufdest1 = NULL;7 k/ t5 X% j% F8 C. Y. ~
  76. char *dmabufdest2 = NULL;
    2 c& [* K" P; R- _/ Q' ]' c2 g
  77. ! o3 {$ T$ D; c7 V- k7 q" Z
  78. static int acnt = 512;" G0 L& J' h: F5 K
  79. static int bcnt = 8;
    6 |- W5 P- O3 [* X. |! w; A
  80. static int ccnt = 8;  r. E; |/ x6 N5 F$ a
  81. 5 A3 P8 \4 p) F3 M1 i
  82. module_param(acnt, int, S_IRUGO);  A: |- c6 o9 T  _: W
  83. module_param(bcnt, int, S_IRUGO);
    5 q4 s( J8 e* G' Z6 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( K9 R% x6 X, A8 w' O. Q, ]! x: U* V* [( j4 F  `; b6 _( L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, Q/ j% l7 O. ^3 W5 \; U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 |9 N9 a/ B! u+ t- l, h0 H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% s" r7 d/ h- f0 n+ w7 }7 p

* E* [' h: z$ ?8 \4 ]: I% d( ~
! C1 M" S7 C2 u; p$ C6 F* L. u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 04:53 , Processed in 0.040782 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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