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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : P. L7 i5 `& b- G& w
  1. [code]EDMA sample test application
    * [* \+ Y4 q0 ~; i. w% i
  2. /*" v6 n# M$ p8 j, H% H
  3. * edma_test.c
    / Z  N; `1 c: o: h# X3 `5 l. Z
  4. *8 J( Q2 G+ P* ~: S) I& ?
  5. * brief  EDMA3 Test Application: h0 I7 O- \5 c0 n1 I( I- @
  6. *
    0 D: V1 I* i' ]7 Y9 o$ D* w7 ?
  7. *   This file contains EDMA3 Test code.
      ]; f$ R$ z3 t. V$ d$ a% q# T! g
  8. *
    3 B* n9 Q& M& H, q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  |8 ]. {1 f) x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& l8 T  F9 g3 \0 X5 S$ G* F
  11. *         TO CHANGE.
    + g# \( T& ^' h  ~9 v3 {! h
  12. *6 E+ `) K% ~* O! y$ V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; W, s. a1 T. }0 t& `
  14. *
    8 q4 f3 z0 R) q# m: m+ r
  15. * This program is free software; you can redistribute it and/or
    + w0 h# y# ^( R! L, m
  16. * modify it under the terms of the GNU General Public License as7 L9 S. C1 u. l2 C
  17. * published by the Free Software Foundation version 2.
    ! q  p" i7 t1 P% e! O8 y3 I" O
  18. *
    * e1 p& f, s! y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - m- {. g! r! c6 \4 q
  20. * kind, whether express or implied; without even the implied warranty
    . l" R- F# V$ h. l1 z- u0 g; y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! t2 z3 H+ l! s. R
  22. * GNU General Public License for more details.
    . O9 w" a* \; v
  23. */. C. S4 ~( \, g0 m  O7 Q8 `
  24. 4 K7 Z* |- ]+ s/ m8 ^5 ^2 C: k; R
  25. #include <linux/module.h>
    . ~' m" L# A% t
  26. #include <linux/init.h>' N! u* t' b! G1 P9 S
  27. #include <linux/errno.h>
      [. ^5 L% S  ^$ A1 s
  28. #include <linux/types.h>9 _6 j' b0 f' v8 s+ B
  29. #include <linux/interrupt.h>& |: r0 C* C) u
  30. #include <asm/io.h>3 G4 W" g: L  ]8 R
  31. #include <linux/moduleparam.h>
    ( U( R4 P. V% Y2 W
  32. #include <linux/sysctl.h>
    1 F9 X/ P3 P. e! N4 H9 u! r
  33. #include <linux/mm.h>
    ; y/ Y6 ~- v5 R3 Z2 `7 Y8 P
  34. #include <linux/dma-mapping.h>5 F7 I" T: @+ s2 B9 I

  35. , t5 @* e; i4 J0 L) a. s
  36. #include <mach/memory.h>
    * b' p8 d; l* C, w! V( Z2 S' c
  37. #include <mach/hardware.h>
    ) ], n/ j8 a4 V- q5 ?" Q/ W1 e- c
  38. #include <mach/irqs.h>6 i; P3 s  Q- s, G. h7 ?
  39. #include <asm/hardware/edma.h>/ Q6 Q9 e4 G( p! W0 {' l

  40. / i% X* `6 j, ]% I
  41. #undef EDMA3_DEBUG, I# e+ g7 X  V- x9 y( B
  42. /*#define EDMA3_DEBUG*/' D0 H6 Y' L( H9 `) g  G

  43. ' U( c4 e' w" Q
  44. #ifdef EDMA3_DEBUG! J7 e" D1 J9 i. H+ Q( B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; F& r# c3 Q7 z+ M. T+ ]; W& M" [( W  o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ l, }5 E+ ^* o) p0 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 A( i. O$ E4 `" M+ _
  48. #else
    . S) m" W+ v5 \3 W
  49. #define DMA_PRINTK( x... )! N/ Z! f6 I0 c/ W) s
  50. #define DMA_FN_IN) K/ F) W& K" A; d( J
  51. #define DMA_FN_OUT
    5 U' a/ r. w* b2 L5 G3 e
  52. #endif7 Y" |: @$ K' E/ X: d& W

  53. : G/ c3 M0 q9 p, b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( {4 t0 E8 R. ~, D& l- w
  55. #define STATIC_SHIFT                31 @1 Q# {4 ]  |8 i/ A; K
  56. #define TCINTEN_SHIFT               20% X% V/ _  ^, G3 L& o+ I
  57. #define ITCINTEN_SHIFT              21
      J$ m5 u# ^* k8 U& z7 G4 d
  58. #define TCCHEN_SHIFT                22
    & C: e4 [5 q( o
  59. #define ITCCHEN_SHIFT               233 |2 K3 J- z% c+ _

  60. * `- s! Y7 y7 R$ j' b
  61. static volatile int irqraised1 = 0;# i1 c. b: P- h/ ^  f
  62. static volatile int irqraised2 = 0;, j* s( J9 f+ ^( M  a& ~& R

  63. 4 ~% R7 d& n, g7 L" v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 R: D7 P, ]6 a" r+ r0 B3 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% S( L" U5 v% ^, e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : A7 o4 d9 Z( e! f1 R4 F' n# y* x

  67. ) U) c% P) j' d0 c" @
  68. dma_addr_t dmaphyssrc1 = 0;& F5 d3 S; r# Z+ t
  69. dma_addr_t dmaphyssrc2 = 0;& }# f% W$ F! K& L0 W1 T# ?( K; P
  70. dma_addr_t dmaphysdest1 = 0;
    ! c) X( C# k; s3 {6 ^
  71. dma_addr_t dmaphysdest2 = 0;9 H1 g$ A' C+ c' G, F
  72. + Q7 N( |( \6 n# _
  73. char *dmabufsrc1 = NULL;
    & S( f" q' X  M& Y; t
  74. char *dmabufsrc2 = NULL;
    0 w% D3 \! `4 M2 O6 \% N) r
  75. char *dmabufdest1 = NULL;
    / ]) `; Z. x5 |6 x2 U' K1 l* K1 B
  76. char *dmabufdest2 = NULL;
    ; u  h; E/ k5 V

  77. - v$ W# A! h$ E" H  p1 O1 }0 u  n
  78. static int acnt = 512;5 F, I3 X5 i: Q0 V8 @% o
  79. static int bcnt = 8;
    5 |5 [2 g9 }6 \0 Y& ^$ T
  80. static int ccnt = 8;
    : S6 _0 y5 {, w/ V2 @7 z, \6 v
  81. 4 e3 @! E$ l, B* @2 n
  82. module_param(acnt, int, S_IRUGO);' s  J& K5 N# j/ v+ p' f: a
  83. module_param(bcnt, int, S_IRUGO);/ I* ~4 t( A# K6 F( n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& k3 N0 k0 d* G, R
0 Q3 y% o+ ^% z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ I: `) t" r+ `0 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 Q  T- \# [: B( W3 [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 }; z/ P3 \' z
9 [6 ]4 {4 k' x" _- U- g
$ C: S' Z0 n2 v; Q  b' P' o% n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 09:56 , Processed in 0.044181 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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