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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; j2 y+ o8 V% W  W  }
  1. [code]EDMA sample test application
    1 q4 s6 J) Q6 a/ r& Y( L
  2. /*
    , I( `' G1 M& `; _$ C
  3. * edma_test.c; m+ w$ p% ]  R1 W9 Q+ O
  4. *
    % c: a8 Y7 w9 `$ F) D* Z: \" X/ H; X
  5. * brief  EDMA3 Test Application
    3 p  z% ?' n$ @) q( y
  6. *
    , u( h2 m0 S% d4 t% c$ Y
  7. *   This file contains EDMA3 Test code.$ B) h0 U2 @. u6 A' ~0 _
  8. *
    . I2 C  C# l2 r8 ~$ }; @& h8 ~# K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" o# x- w! c1 b# ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 V4 e. H: z6 Z' ]+ X2 k+ z& ?
  11. *         TO CHANGE.' D" Z" I2 I$ `# d6 g0 e6 _
  12. *
    $ f% [7 i' H  O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// u5 [: ]' z' }  h" W1 `  d
  14. *
    * ^# r3 \0 e( }8 z% {
  15. * This program is free software; you can redistribute it and/or
    6 \/ I  _* Z: u) s% o/ L: u
  16. * modify it under the terms of the GNU General Public License as
    6 b! E* p: o4 d5 ]; X
  17. * published by the Free Software Foundation version 2.; _, o0 J% `" u( g' |
  18. *; u! }* O: {  }! J& X4 @8 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: a) h; C4 @, E; y6 h' U9 u
  20. * kind, whether express or implied; without even the implied warranty
    5 p) u* k7 F3 o, `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : T4 Y8 z8 t# c2 S
  22. * GNU General Public License for more details.
    , f0 {  t, |# \3 M
  23. */9 `& x( }8 ]$ Q7 n+ Q- t# X' N
  24. 4 Y) _7 ?. m, w: e
  25. #include <linux/module.h>
    & G2 u' T, w( J" K! n% x8 q, w
  26. #include <linux/init.h>; O+ @) B7 V. @4 i) g
  27. #include <linux/errno.h>
    5 {5 e9 o  d' q2 O
  28. #include <linux/types.h>; O/ D* ]6 Z9 ]5 ^$ c
  29. #include <linux/interrupt.h>
    0 t/ N1 w8 F" l7 r, d
  30. #include <asm/io.h>8 [+ I) B0 h5 }
  31. #include <linux/moduleparam.h>0 w& j4 X2 z/ i/ D
  32. #include <linux/sysctl.h>
    4 H, N5 y% a& |% o9 r& |
  33. #include <linux/mm.h>4 F0 I0 O# c( B; s0 ]0 s. _9 g
  34. #include <linux/dma-mapping.h>
    ! W" Z' ]/ E2 Q$ {

  35. & S' w' W# |, x$ a; G  V! n
  36. #include <mach/memory.h>
    $ I# h8 @1 h& B
  37. #include <mach/hardware.h>
    + S! \1 ~) B( v% f7 O1 U8 m
  38. #include <mach/irqs.h>, G, R5 k/ Q5 B4 R
  39. #include <asm/hardware/edma.h>, L) Z) C" G8 J, G0 ]0 K8 W! y
  40. 4 m( \: H# D! W4 B, K' a. z$ |9 ]
  41. #undef EDMA3_DEBUG
    # C4 G  t' x: n: |+ Q. P) ^
  42. /*#define EDMA3_DEBUG*/( F; n, M3 L; K( l
  43. " N; H. Y+ k% `4 d9 U' i
  44. #ifdef EDMA3_DEBUG+ _1 \# z7 T- p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( X3 K9 H6 U1 n2 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), R' E( Q+ j) u' K% b: ~. V- z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 I( D. ^5 y5 o# k  T
  48. #else( G1 Z# n+ X! w( {1 y* h: f
  49. #define DMA_PRINTK( x... )
    0 f1 F+ L- @- y
  50. #define DMA_FN_IN" u' o2 t/ Q9 h" v* r8 c
  51. #define DMA_FN_OUT2 |7 o9 T4 w4 Q
  52. #endif  }7 O# \. r6 g0 c) u: g
  53. 7 d0 S6 }1 h7 r# U5 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( {1 V1 x  F# Y( O  Z
  55. #define STATIC_SHIFT                3
    0 M: B7 P/ S5 H1 x7 x, C8 c5 I' p
  56. #define TCINTEN_SHIFT               20
    : p! f8 K1 Z/ R! C) Z3 Q) a
  57. #define ITCINTEN_SHIFT              21: S+ B( H+ G# P1 U; `( W& E4 o, u
  58. #define TCCHEN_SHIFT                22
    4 Q+ W& M. M. ?  v# g
  59. #define ITCCHEN_SHIFT               231 ]! T5 V! D  w3 D8 t/ s$ K

  60. 0 `% V1 P( f$ Z  k" C
  61. static volatile int irqraised1 = 0;& J, T2 d1 F. N. {7 h/ v! A7 @9 G# p( q4 c
  62. static volatile int irqraised2 = 0;
    + f4 L) A! x9 ?6 y, q) h& ?

  63. ) ~# D# @/ S  ~- z% X8 m4 S4 X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; N5 Y: n1 y5 _: F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 }" x2 c6 [/ z8 j. m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- R+ U8 G$ {7 Z4 y  E0 w

  67. ( c( i6 ]; w3 Z. ~6 j7 I
  68. dma_addr_t dmaphyssrc1 = 0;
    1 h* S* ?9 h* d+ M- F
  69. dma_addr_t dmaphyssrc2 = 0;6 T! J0 p. u6 O( J5 y
  70. dma_addr_t dmaphysdest1 = 0;) q' M' a' F1 @/ b7 H/ _+ _
  71. dma_addr_t dmaphysdest2 = 0;
    : P9 Y# e! o5 p
  72. 7 U! d( b3 v3 T! M/ ^
  73. char *dmabufsrc1 = NULL;5 w% W, H& n) K& P
  74. char *dmabufsrc2 = NULL;0 v2 S) n3 L/ [
  75. char *dmabufdest1 = NULL;
    & E+ p, ?4 d9 b$ Y4 L
  76. char *dmabufdest2 = NULL;# n( x, n$ y9 o
  77. " s3 w) M& d# Z/ K6 b) E
  78. static int acnt = 512;
    % m& Z" _/ X9 _$ `3 a
  79. static int bcnt = 8;
    - v8 w& {; W1 a/ |1 F% }+ `. @
  80. static int ccnt = 8;
    6 Y& Y7 E4 h+ [1 V/ d& D1 m% g

  81. ) s( Z; _: v" r
  82. module_param(acnt, int, S_IRUGO);
    7 W6 Q6 `" R: w' h
  83. module_param(bcnt, int, S_IRUGO);
    7 s9 I# y4 C/ E) W1 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 a5 D6 }2 Q, T: n/ B1 r

6 a' [- x+ i$ x- g) G$ Y3 C/ F8 B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- a$ o& Y" u, [8 K  Y
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 r; E9 M! V. p" M/ n: E4 a5 O% v2 T0 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 V+ j4 m, N$ H8 E: V- d

: L; S& m: r0 B6 w3 ?$ Q) M- a, d, R( \# \- z4 `. p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-17 11:56 , Processed in 0.039142 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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