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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) l( @  j1 m" C. B: H
  1. [code]EDMA sample test application& V* C8 b" [- a: C# l5 C' P
  2. /*) \" G1 {4 F5 f
  3. * edma_test.c2 n: s. G7 U+ c3 E2 I# j' J
  4. *. X5 Z# u- ~* h7 b
  5. * brief  EDMA3 Test Application
    1 d' }) x8 _& u3 b
  6. *
    * ]) Z5 z8 Y& q1 m9 a
  7. *   This file contains EDMA3 Test code.7 L, O+ T3 d. `7 @* o
  8. *5 P& Z+ O6 ^  ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) Y, c! h3 [1 y  \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 h  l( D, [/ i  y4 l; y
  11. *         TO CHANGE.
    4 [. F, V4 }! B4 @) M. W* g: a  q
  12. *
    / ~: D4 m6 b' r/ W- ^: ^/ J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , f# `+ @6 T" J
  14. *# M6 M, ~" q! `
  15. * This program is free software; you can redistribute it and/or: Y  Z& K' }7 ]5 t8 V
  16. * modify it under the terms of the GNU General Public License as
    ; C( i/ U! _: I0 s* [: M* v) L
  17. * published by the Free Software Foundation version 2.7 _0 A& D8 Q( o' X
  18. *
    7 i1 ?( c. X% {" _, s; ~5 y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 J& [4 O3 X8 h# W$ Y! C
  20. * kind, whether express or implied; without even the implied warranty, H3 [. c6 _" j9 C* L( {' o6 T; `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . C. z: P: G7 q. ?0 H
  22. * GNU General Public License for more details.
    ' u/ M/ k6 i) Y- Z8 F( B5 o0 m
  23. */
    # I* N( v" w; I* M. c6 d
  24. + @8 ]: J2 j+ o+ u
  25. #include <linux/module.h>
    . |7 Y' x& o3 ^6 t# G
  26. #include <linux/init.h>
    4 ~. R8 s/ `, f: b5 f
  27. #include <linux/errno.h>
    & {/ }' C5 _  ^' P  v
  28. #include <linux/types.h>9 _6 Y8 @! u4 O' W
  29. #include <linux/interrupt.h>
    % H( o' ^/ F( c/ H  x
  30. #include <asm/io.h>7 t- }/ r- i- ^) ~3 L
  31. #include <linux/moduleparam.h>
    3 [2 l( j* |: @4 P; m/ g4 }
  32. #include <linux/sysctl.h>: L& F3 z' F+ ~, @6 L7 R2 R9 z
  33. #include <linux/mm.h>, ~1 L  M  h6 q4 s1 W/ r, s
  34. #include <linux/dma-mapping.h>
      \( N4 w) e8 E: u
  35. 8 _- {8 W7 L9 r+ g$ M, c1 C/ O7 Q
  36. #include <mach/memory.h>
    : t. g8 \0 E* F# h- b8 Z5 y$ D
  37. #include <mach/hardware.h>3 I6 s$ e, S; Z5 G' J3 e* x; ]
  38. #include <mach/irqs.h>! P8 t2 r( Y- ?& T' L: I8 G
  39. #include <asm/hardware/edma.h>8 }3 a. ^. N9 L) T( f2 u

  40. ' t0 x2 q" C  _, B
  41. #undef EDMA3_DEBUG
    & h3 U) R4 G9 I; E+ N3 L9 b6 b: B
  42. /*#define EDMA3_DEBUG*/. o- B1 L5 S* k! \. B

  43. % V5 w' M- j7 l# D
  44. #ifdef EDMA3_DEBUG- `$ r" b* \# g" L+ F0 A# q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ r: @; A8 m, k4 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . q1 t# }# J/ Z+ L9 l, @; x9 k( m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- N# r7 i+ b1 I. b" M- ?2 w
  48. #else$ b; ?2 L4 k. |* U
  49. #define DMA_PRINTK( x... )3 b) S) o8 H& s8 g+ T2 G# o4 D6 a
  50. #define DMA_FN_IN8 a! C4 Y+ ?0 }1 _) Z/ S1 M
  51. #define DMA_FN_OUT
    ( ]0 V# `1 D4 k  Q% P% f! T
  52. #endif
    " H# @& F$ Z& j4 k  I8 x1 V
  53. . N- {* G+ T; \" @: r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 t! q) h0 j& c* U1 v' @: _
  55. #define STATIC_SHIFT                3
    6 [! @( m: r2 }8 m; K
  56. #define TCINTEN_SHIFT               204 f* e& J. Z  U5 D+ Q) Y; O
  57. #define ITCINTEN_SHIFT              21
    4 C9 _* E! e6 W  ?- J* J- }
  58. #define TCCHEN_SHIFT                22
    & T* ^( C  E1 P# L
  59. #define ITCCHEN_SHIFT               23( X% w8 }7 X$ x" t

  60. 2 ?/ z" F, I" v0 b7 ~" f* c
  61. static volatile int irqraised1 = 0;& A; p7 f3 y9 |/ ?" \: x5 D* X( I
  62. static volatile int irqraised2 = 0;
    * C. V9 x' a$ n' S# Q
  63. " |5 d9 ^+ N. q6 Q1 F8 p" S7 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 y5 A8 H; I1 R! i& T: s9 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* {  J  K. }* q4 V" |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 D3 `& J  e" q$ O8 o3 ]; q

  67. 6 a" z9 A2 ]. s3 b
  68. dma_addr_t dmaphyssrc1 = 0;
    + {0 [" F, D) l+ \! h, f( H3 T" G& a
  69. dma_addr_t dmaphyssrc2 = 0;
    # e5 u5 `6 r5 O. U
  70. dma_addr_t dmaphysdest1 = 0;, t0 L. Z+ {' I/ p0 [1 u* U
  71. dma_addr_t dmaphysdest2 = 0;1 l8 H( a8 @7 n' B% B
  72. 9 v) r* c& F% y& w8 M
  73. char *dmabufsrc1 = NULL;
    , K( ^) g- d! p# L9 G+ j0 X
  74. char *dmabufsrc2 = NULL;
    : P  M3 x1 Z, ]5 c
  75. char *dmabufdest1 = NULL;, ?0 S1 t2 p* P+ K* S$ l- d
  76. char *dmabufdest2 = NULL;1 j( |3 ~0 K) S" r* {
  77. , G8 Y9 z$ S9 W. R. ~
  78. static int acnt = 512;
    ! Q- |& l( `0 T1 R, P, Q: N
  79. static int bcnt = 8;
    6 j! h' B4 R0 y# Q* c5 f
  80. static int ccnt = 8;  @/ |1 H+ [( D$ a  w( [/ f

  81. - D9 v3 a1 l" c6 t$ U
  82. module_param(acnt, int, S_IRUGO);* ]) v4 J! ?0 o3 a6 |7 t
  83. module_param(bcnt, int, S_IRUGO);0 N) I0 @3 X5 L5 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) O& F; i! X# i8 s% K2 ?
. K3 R: }) n, X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) f, W3 x8 F9 h' y2 s! @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: [' @- ?7 t, i" Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 n2 D. _# V; O- W! g) v/ c' _

, n5 j/ h( n7 H% s! x$ ?0 C  q1 m" f7 z0 g' a4 O$ v, Z& _% V, c0 h% K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 11:32 , Processed in 0.040079 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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