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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! Q* B, R4 L" O$ |( K% H  k
  1. [code]EDMA sample test application
    , X; [' G& Q( {: }8 S( E3 B: e
  2. /*
    ( N. ~$ t+ K# [, X# o
  3. * edma_test.c/ G: \! D. [6 E) _
  4. */ }: d- F: P' A4 S% d
  5. * brief  EDMA3 Test Application% e5 d$ _: x: V" P, D! N
  6. *
    % b6 A0 L# W! B- o& R
  7. *   This file contains EDMA3 Test code.
    9 G0 r2 t% t6 b6 Q0 S0 ]# z4 \: x
  8. *
    ; L9 Q) B3 m. g! y* t2 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 m7 S/ f/ }, q, b0 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! M; u$ o3 s7 _
  11. *         TO CHANGE.
    9 s- M9 u* |" y: _7 A! u
  12. *
    0 L; \1 `6 H6 P' J" O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , ?0 E( y* h) A
  14. *
    3 t* `5 |4 O$ C. ~, a7 R8 T8 y5 u
  15. * This program is free software; you can redistribute it and/or
    # c) X5 ?- @% n% ]
  16. * modify it under the terms of the GNU General Public License as
    ( f; g8 F8 G" `4 x; v/ K
  17. * published by the Free Software Foundation version 2.& ~3 D8 E1 Q" i$ N
  18. *
    ' \4 n& P- a5 y0 j+ }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 {% ^0 |1 F) N/ g: R% m$ c* e! h
  20. * kind, whether express or implied; without even the implied warranty% R! T* Z9 o) _4 {! y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 b! e( a4 w+ t( {0 T
  22. * GNU General Public License for more details.
    ) i% i  v' D* n) u5 x) a
  23. */9 Y" h* d$ ^- Y
  24. / e3 g0 C' z6 C2 `3 H# Q- o
  25. #include <linux/module.h>  t7 c' k2 B" s0 z( B' v
  26. #include <linux/init.h>
    & n) u2 n4 W" y, N1 ~' a8 q. j& R
  27. #include <linux/errno.h>
    9 }5 P5 P% j8 {7 K$ H! v- r/ h% Y
  28. #include <linux/types.h>: x5 B7 U/ n( R& n6 K: L7 t" n
  29. #include <linux/interrupt.h># O# {- Y3 a, n! ?9 J. @/ S
  30. #include <asm/io.h>
    2 r+ U1 W1 A  c3 O
  31. #include <linux/moduleparam.h>  [8 c; X! [- D1 N
  32. #include <linux/sysctl.h>
    4 ^" j. P% v& o; b7 B/ D
  33. #include <linux/mm.h>
    9 R* D, e6 [) `# N
  34. #include <linux/dma-mapping.h>/ h8 _$ O% j2 e2 B7 r& h
  35. ' v1 J* P, `1 i" c% t" ]  }& i
  36. #include <mach/memory.h>
    ! e, C( J. \+ T9 `& R* V) _$ B) E
  37. #include <mach/hardware.h>* ~) m# O1 c9 [5 V4 I
  38. #include <mach/irqs.h>
    1 y+ a1 x/ x* q# m" S, B# ?, j
  39. #include <asm/hardware/edma.h>
    8 [( }( l- Z3 o8 _- m

  40. 9 D) V: ~9 ]; M# |- {
  41. #undef EDMA3_DEBUG
    % B" p4 S7 E$ @/ c2 h) E
  42. /*#define EDMA3_DEBUG*/
    6 Q+ D& H# {6 Y( _
  43. # j6 `  z0 F; J& z% ?( B
  44. #ifdef EDMA3_DEBUG
      y- O1 ]9 Q8 p3 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! Z. q3 I0 n1 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 n# T! A- q2 [+ S, M5 O' X6 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 |* s: p8 S) w6 e
  48. #else0 D/ k0 E& |* H2 U
  49. #define DMA_PRINTK( x... )
    1 j  d1 \. E' h0 r$ J
  50. #define DMA_FN_IN0 z3 v$ g% h" i$ o
  51. #define DMA_FN_OUT" G3 L6 w! M3 [3 ?7 C6 Z7 E0 ?( [
  52. #endif
    ( m/ T" _- l9 ~: a- I, [0 C

  53. + k  X/ e0 s% q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + M4 O% x: o$ \  T
  55. #define STATIC_SHIFT                32 l3 o- j4 R* K* r) g
  56. #define TCINTEN_SHIFT               20! F) D, z3 \, B' [9 Y; a6 M( a
  57. #define ITCINTEN_SHIFT              217 U4 Z- g" H* X; D
  58. #define TCCHEN_SHIFT                22
    : \& x& K' O1 v$ ^
  59. #define ITCCHEN_SHIFT               23
    . ?, ?4 S9 g. N

  60. 0 G/ h/ \% j1 R+ w
  61. static volatile int irqraised1 = 0;
    * i# g1 M7 l$ ]( H, N  L
  62. static volatile int irqraised2 = 0;) m2 y) Q2 B" S

  63. - K* s- K0 ^$ P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" V- _% A) r$ A* ]" E: ?/ ^5 }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! x' N' F9 g) K9 ?2 J$ J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % |8 R7 g9 h4 X+ k1 o) \- @% a  S
  67. ; ~% V' P( J( O; M& U0 S
  68. dma_addr_t dmaphyssrc1 = 0;
    / f, u3 x' T, J( b
  69. dma_addr_t dmaphyssrc2 = 0;
    : }9 R1 X& O1 v0 S8 y) P
  70. dma_addr_t dmaphysdest1 = 0;4 L1 ], r3 P/ b2 f
  71. dma_addr_t dmaphysdest2 = 0;
    ( A% g9 l2 j: x0 x% @6 c2 j4 W
  72. ; M6 f' h6 @0 D  p9 F
  73. char *dmabufsrc1 = NULL;9 z5 [) D; I, G: ]
  74. char *dmabufsrc2 = NULL;2 l5 v" C# K4 p: r% c% @
  75. char *dmabufdest1 = NULL;
    . R, i( R) b' n) S0 ]
  76. char *dmabufdest2 = NULL;# e3 r1 m0 s. K) w# Z
  77. : S' g9 `4 u( s3 r. m) \
  78. static int acnt = 512;
    # |% P7 Z7 G# H, r% F. M& E
  79. static int bcnt = 8;3 G. e$ R( V% L
  80. static int ccnt = 8;4 ]3 y2 f" Y/ U& I5 ~" {5 `6 o- E) D

  81. . Q8 m0 F/ l4 Y  |
  82. module_param(acnt, int, S_IRUGO);
    1 p6 ~" S4 d! M0 `. x. g; y
  83. module_param(bcnt, int, S_IRUGO);' j" @; Q( Q6 `& d! N4 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! T( r, M7 K7 x7 e, V: n- Q- F2 N

. C/ ^. Q5 h+ m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! f& t( C0 @0 t- o5 F* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 V  o. f2 i9 O0 L6 Z2 D0 L- i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- q5 O: u, x6 a4 b" R, ?
  k) {1 U. h) o. a

' S4 |& _% h9 r7 L, U* G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 02:04 , Processed in 0.067687 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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