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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. p( b# I0 b( R5 n7 L: p' L
  1. [code]EDMA sample test application
    + O' u0 x; V4 t4 H  s" D
  2. /*1 C, Y0 \% K. r8 h- X' ?* ^
  3. * edma_test.c
    " t7 y/ B& C% P5 D1 I" r$ A
  4. *
    ; R5 p  P9 u6 K( w8 b
  5. * brief  EDMA3 Test Application
    1 m% G$ V: v+ d
  6. *! E, Q- a. Z0 A- M& D9 T* \- {
  7. *   This file contains EDMA3 Test code.
    2 K! r, o" u2 m* w" u, M( W
  8. *
    ) j. g, \/ Y7 j& I# i7 s$ `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. P& |6 I* F" Z+ O( L# o  e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( A# s: R5 R/ s- t! J% N# a
  11. *         TO CHANGE.) d2 R$ Z- i7 L) R' N
  12. *) L6 J; v) J0 _! v9 I  x! u' i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% h& I6 k8 R# t& `5 S6 J. A
  14. *
    0 Z, q1 i, c8 P
  15. * This program is free software; you can redistribute it and/or
    - G5 P7 K1 o$ H+ w
  16. * modify it under the terms of the GNU General Public License as
    7 R1 W3 h1 m. O/ K
  17. * published by the Free Software Foundation version 2.
    # f7 L! e7 F( }
  18. *5 w3 W$ v8 @+ F" v; w! k0 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 f* |# J: w8 w& ?* w2 q2 F: e/ N
  20. * kind, whether express or implied; without even the implied warranty' j. z6 w( H' b7 s7 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - l+ e$ L) g; i* I
  22. * GNU General Public License for more details.
    ( P  u3 l( b7 h% W2 n
  23. */2 N8 H1 H, U3 {- }& }8 \
  24. : `# l( Y/ S( U" C# t, h
  25. #include <linux/module.h>
    9 J2 t, x$ `6 S" s! K
  26. #include <linux/init.h>: S# m3 j4 V- D% a
  27. #include <linux/errno.h>
    7 d1 Q) l! z- h( F
  28. #include <linux/types.h>
    ! X( O: ^& y5 @% B' V9 `
  29. #include <linux/interrupt.h>
    3 @! ?2 W/ G, F  n# ]0 V
  30. #include <asm/io.h>
    % q2 G2 j' j, j+ g/ L
  31. #include <linux/moduleparam.h>6 j- U- a! s' f4 R8 L! d$ R
  32. #include <linux/sysctl.h>
    6 E% s  M7 O$ s
  33. #include <linux/mm.h>
    # U# x% v* f$ v! i2 k& C
  34. #include <linux/dma-mapping.h>
    4 l  C; \  u) E$ N1 q  V6 s

  35. ; T" l/ J7 C7 {. Q; H
  36. #include <mach/memory.h>5 d1 q3 i+ m! {( x6 P- a
  37. #include <mach/hardware.h>
    ( Z" X  X0 n, }/ L" H! o2 g% x
  38. #include <mach/irqs.h>
    % m) N# \- t6 `# D
  39. #include <asm/hardware/edma.h>
    . c7 |$ @) C% F( Y/ o0 E; G2 M
  40. ' m6 w5 e0 l: B8 y! u
  41. #undef EDMA3_DEBUG
    / o- {8 Z3 K8 W3 ]5 E
  42. /*#define EDMA3_DEBUG*/% V5 J- g3 I: Q, ^6 m8 w  W* f

  43. ' l9 H1 o6 D% b' U
  44. #ifdef EDMA3_DEBUG
    ; n$ J# K  f8 J& U1 T7 d9 j% S/ d9 ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 h! _3 ^8 u. G  L, s. f4 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! J& k7 p$ `9 W# Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! ~' N- @" y1 a% L8 a
  48. #else' W7 F- ?' a5 k9 y
  49. #define DMA_PRINTK( x... ); R- S! f4 E. t0 z
  50. #define DMA_FN_IN
    2 @5 t- _" J7 Y7 H4 a
  51. #define DMA_FN_OUT
    / N. H) L! K. R  S8 M
  52. #endif
    8 j6 x: V6 e$ @" u3 X( h8 d
  53. & b9 T# J/ f4 e' v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 r! s/ n8 q6 T6 ]( x
  55. #define STATIC_SHIFT                3
    9 J% D$ ^( t4 h9 T( H3 ?- X3 L
  56. #define TCINTEN_SHIFT               20
    + Q( o$ q# M! r0 [( h
  57. #define ITCINTEN_SHIFT              21  t: ^4 ]  F9 {, j* g* ^% _- G
  58. #define TCCHEN_SHIFT                22  [' h- j3 i0 X4 c# G& ]+ t
  59. #define ITCCHEN_SHIFT               23
    8 ~4 B# a2 G  N# N2 Q9 i! n
  60. . N. e# l; j  h6 V4 T. b" @: c: ~
  61. static volatile int irqraised1 = 0;6 h5 ]( w0 b  z) h0 k! V# A, [
  62. static volatile int irqraised2 = 0;1 O$ f# ]* G' H1 G5 y+ Y

  63. ( r0 N$ o) b: z* M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) X. _$ [2 [  D8 I$ G1 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 N+ \2 R: g) E% d% P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * l5 c  O$ D! E$ E% O: u

  67. 3 o: l0 ~5 |8 b* ?; w
  68. dma_addr_t dmaphyssrc1 = 0;; V$ R7 V* O# a! \
  69. dma_addr_t dmaphyssrc2 = 0;* ]  o. [% e+ \( X6 i2 M
  70. dma_addr_t dmaphysdest1 = 0;% g1 J, k, }0 f
  71. dma_addr_t dmaphysdest2 = 0;' q4 W  h% b0 p3 A

  72. ( P, X2 R$ k, E" Q
  73. char *dmabufsrc1 = NULL;
    0 S" x2 q! R3 n3 D
  74. char *dmabufsrc2 = NULL;
    7 M2 l) m: K0 X3 V& ]( @
  75. char *dmabufdest1 = NULL;
    & \; a. o+ T6 k0 u" |3 Y
  76. char *dmabufdest2 = NULL;
    3 i7 n* Z: A( Z$ y* w

  77. 5 I0 T: {* L! t, w  [) M
  78. static int acnt = 512;4 O$ Z0 S; U: _# t( h
  79. static int bcnt = 8;
    7 X' r0 [# l0 r8 A' L- i
  80. static int ccnt = 8;  V" J1 R/ ~  f! ^  h
  81. - P! {+ Q- e/ ~, Q7 f
  82. module_param(acnt, int, S_IRUGO);
    , L5 F$ K* h7 D8 w
  83. module_param(bcnt, int, S_IRUGO);
    9 g+ p8 c. m& r4 O; o5 Y$ J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: f7 V. N2 r  @5 B
5 s8 Q5 U" W" U& O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 @8 F8 I2 o7 J! e7 R. @' oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 B, b* n( D. h* M. t( Q7 H; ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: J: h5 A" o, _2 J
3 v) {& H7 k2 D+ o

' \: N) I6 C9 h% @+ m2 i3 G+ y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 15:25 , Processed in 0.032792 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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