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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 Z/ }* W8 b1 C# \
  1. [code]EDMA sample test application
    & ]3 V4 c3 e/ z5 P
  2. /*6 _& ]+ c0 s) b
  3. * edma_test.c" S& j9 }& d. ?2 F4 ]
  4. */ O% d0 p) J+ M9 S
  5. * brief  EDMA3 Test Application
    ; G1 Y6 U. D  E# I. O, j
  6. *
    9 _: Z8 t9 O; F
  7. *   This file contains EDMA3 Test code.( w* p1 A" ~3 h- E
  8. *! ?& {; K) Y! O( M' U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ K* r: I( g' u3 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- r8 C* |( X7 p; C6 l' r. a
  11. *         TO CHANGE.
    ' O; x% p; C) m, H  r% K; M: m" M
  12. *
    - \7 f  f: V7 E& H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 [9 t) q  P) E: ]) k
  14. *& |- n! R2 C0 J1 H1 i
  15. * This program is free software; you can redistribute it and/or7 E5 M" Z8 ]0 K
  16. * modify it under the terms of the GNU General Public License as3 W, f% G' `; r8 ^
  17. * published by the Free Software Foundation version 2.
    ) w( P- @' d- ~4 ^% C9 _
  18. *1 V* _# ^9 V. j9 {# ]+ j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * o( U$ o! [. ]9 i! C, F2 J
  20. * kind, whether express or implied; without even the implied warranty$ b" \2 h- P" o/ m; H3 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) j+ x" [9 e6 Q& m# M4 b
  22. * GNU General Public License for more details.3 k- a: g0 x. G* O2 L: g  V4 T( y
  23. */
    9 q1 i* n: I# k0 Z/ L
  24. / S$ m% e/ G9 @- V( _
  25. #include <linux/module.h>
    ) g4 g% A6 k+ [0 U* Y$ I( \1 x
  26. #include <linux/init.h>) l/ @6 k! ]! o
  27. #include <linux/errno.h>
    9 M' q; O- o) a# r# U6 a
  28. #include <linux/types.h>! t* @9 A+ U5 k( M4 f* Y' ]
  29. #include <linux/interrupt.h>% N5 T% H) T1 u# W+ C" w6 P
  30. #include <asm/io.h>$ E5 Q; a; }' E: s6 a
  31. #include <linux/moduleparam.h>8 c4 C9 m) p4 l, b$ t8 f, E; C5 V% p
  32. #include <linux/sysctl.h>
    4 i0 a. k& b8 c- H4 D& f0 k
  33. #include <linux/mm.h>
    6 T8 h; o" Y. Z$ n" N
  34. #include <linux/dma-mapping.h>" H! \7 o- Q* G1 g% V$ Z8 i6 J1 B

  35. ( q( x! t* m  Q% w/ O* L8 v0 R
  36. #include <mach/memory.h>
    9 \3 X5 |9 E+ A6 v
  37. #include <mach/hardware.h>
    # s2 Z- F3 y; q6 @# k
  38. #include <mach/irqs.h>
    ' P! Y. B5 y! y$ D
  39. #include <asm/hardware/edma.h>; V) l5 o( R) W

  40. 6 R, ]) C" d1 T. T: N
  41. #undef EDMA3_DEBUG
    ) X8 L  i% V  O: D8 S
  42. /*#define EDMA3_DEBUG*/, X" G- C  P1 Y7 y
  43. 4 x* m) t( z6 K. p7 z7 C
  44. #ifdef EDMA3_DEBUG
    + D8 s# V7 U' H, G/ S/ X' }  ^: [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      y. g6 O0 Q5 B& f* o. E3 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- g& k: a0 c% q& N& U" |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 K* e$ W  @: g
  48. #else
    ) {) v+ a7 i+ k" O9 ^1 C
  49. #define DMA_PRINTK( x... )3 k1 d% O2 T+ k  U- E; q& e5 S" ?* I
  50. #define DMA_FN_IN* I! p: V; O: P
  51. #define DMA_FN_OUT/ t, N  X+ ^" E. f& W" h
  52. #endif* L& a3 }% O, P' g
  53. 9 ]  y+ c% a/ J' T- |- H0 e. P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) W/ G' O! z4 x) D- Z' S
  55. #define STATIC_SHIFT                3
    9 T" F& H# y1 q
  56. #define TCINTEN_SHIFT               20, p1 o. w9 D: P% k) D
  57. #define ITCINTEN_SHIFT              21
    0 m! P3 ?9 g/ x
  58. #define TCCHEN_SHIFT                22
    5 @- B" V  F9 C& R
  59. #define ITCCHEN_SHIFT               23. R8 I1 R" D( W6 s% o+ u
  60. 5 e& T- K# e+ F! F2 e: V8 A1 G: I
  61. static volatile int irqraised1 = 0;! |& ^4 x% O1 n' ~7 q0 g8 `8 C1 s1 n  M
  62. static volatile int irqraised2 = 0;
    ' l' ?. z7 x) K4 P# {$ T' n
  63. 7 O" _7 H2 `& b$ e2 m4 J! i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : ~' ?: M+ t6 N3 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% d* K0 v4 s5 R# m1 {( h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! x0 D1 W5 o* S* P" J

  67. 3 K1 a6 |. M/ C& f: i: j1 P$ G1 s% G
  68. dma_addr_t dmaphyssrc1 = 0;: H& R' N& ?; H: P
  69. dma_addr_t dmaphyssrc2 = 0;
    $ d" N) j& \# W2 }
  70. dma_addr_t dmaphysdest1 = 0;- [! m5 _; c( s7 I. C8 g
  71. dma_addr_t dmaphysdest2 = 0;
      t. `9 D0 P* y. C

  72. ( O  j1 a+ V& \/ X) O
  73. char *dmabufsrc1 = NULL;
    6 t5 c: z+ c5 p$ S
  74. char *dmabufsrc2 = NULL;5 ?/ m$ i1 W8 x! g. _0 X' p
  75. char *dmabufdest1 = NULL;
      ?& K$ Z/ E2 U  J2 i: O
  76. char *dmabufdest2 = NULL;
    1 }/ H7 a2 {) [6 o1 h: X: W
  77. 9 ?- B2 v' X& W8 G" S* R
  78. static int acnt = 512;
    * ]8 G5 k# j. W# _1 Y; x
  79. static int bcnt = 8;
    # b* k! V2 w7 B6 m0 D6 `
  80. static int ccnt = 8;& H& ^$ A! A" c8 q* t! p

  81. " R+ n( k7 {2 R0 T
  82. module_param(acnt, int, S_IRUGO);4 ^+ U. ]1 r& {) L- k
  83. module_param(bcnt, int, S_IRUGO);( y, y) h; Z) r7 u0 [* M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 Y, Q$ Q3 i. \: l

# Y2 q9 i. g% [/ I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 N9 `6 p; Z4 R: Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. n# @- ~, u1 m0 ~* ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 T- u$ P/ X& w# p) D( ~  }; C2 [! S5 c4 L8 S/ h7 e
4 u$ e6 v2 T' b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 14:28 , Processed in 0.040060 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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