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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- {' d) E7 ]: M8 O8 j
  1. [code]EDMA sample test application
      U( v+ T1 ^4 K( W# c
  2. /*4 l& p8 p' O2 a: Q! K; G5 b
  3. * edma_test.c
    ( w2 V2 q1 s# \* s" e9 R' U
  4. *
      ~/ ~6 O  F% D! J1 t6 J
  5. * brief  EDMA3 Test Application
    & N5 _9 d& U( I- ^
  6. *
    + I) Z, v! W% {5 x
  7. *   This file contains EDMA3 Test code.1 }) c4 r3 f0 F$ Q
  8. *
    ' T. ~* P) H9 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 D! p& h# K/ F% `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 P9 T2 ]4 S& Y1 t
  11. *         TO CHANGE.1 p  ?8 ]2 R- v6 ~6 K- F
  12. *
    5 S, F8 q  R8 X$ ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! l+ b9 h; f" x: M- _4 d
  14. *
    0 \- S& Y1 P# d
  15. * This program is free software; you can redistribute it and/or4 ~( q& N- B$ N2 w) t' z5 ^: ]
  16. * modify it under the terms of the GNU General Public License as
    . C' m6 [0 B' U  d  R
  17. * published by the Free Software Foundation version 2.
    1 b2 ?  V" l) g: U0 A
  18. *
    ( \* z& L+ @2 a4 ~. O1 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( N$ E) f$ I6 O+ L. J: m
  20. * kind, whether express or implied; without even the implied warranty
    $ ^* }" c# N( `3 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , _9 u" m, ^' m
  22. * GNU General Public License for more details.
    # e4 _! g, m& c2 J0 A
  23. */
    6 C5 Y# b/ Z+ V  u4 z3 ?! W/ ]

  24. , w% }( h" M2 N: R
  25. #include <linux/module.h>
    8 C" H6 G8 ~" M# J; \
  26. #include <linux/init.h>  X, j7 W' v  {4 G9 n+ U- v, M
  27. #include <linux/errno.h>
    - B8 L' X8 s; u( P+ o8 g4 @
  28. #include <linux/types.h>! B0 _" D8 ]9 T; f0 p3 e7 L
  29. #include <linux/interrupt.h>
    - t; Y5 ]0 n5 }' X) A* B7 K
  30. #include <asm/io.h>
    * h5 r% P) K( n1 O4 M! u
  31. #include <linux/moduleparam.h>
    - R6 S" l$ v$ ?& T6 `& W
  32. #include <linux/sysctl.h>/ m8 ^+ K! M* _" U% ]5 D; ^
  33. #include <linux/mm.h>
    9 D+ n7 ^% k8 H5 u) R) }  _
  34. #include <linux/dma-mapping.h>, I3 A4 Z* E* z1 _0 A
  35. ' d- m8 |! |7 i* K6 c* B
  36. #include <mach/memory.h>
    , G+ V. P+ U" o" Q& v
  37. #include <mach/hardware.h>7 Q( w) u$ G7 W- J' J
  38. #include <mach/irqs.h>
    ) z( v) q0 a6 i. h" q
  39. #include <asm/hardware/edma.h>0 O; u  [1 r2 {" H6 T( V% S
  40. ) A# X* J3 O" I6 \) h  Z3 T6 R' y: e
  41. #undef EDMA3_DEBUG
    3 j" e" q2 x* p$ p
  42. /*#define EDMA3_DEBUG*/8 ~0 f/ B0 L. u0 M

  43. 9 S4 @$ N* K( w. t* [( f6 X7 }( }
  44. #ifdef EDMA3_DEBUG; n" f: P: N% Y  L5 D3 \/ G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ ]8 o3 M* q1 `& y7 Q& i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 a# L  u+ i* \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 K4 P( I9 ^5 ]( U" Z
  48. #else
    9 T6 g& r6 D; `; n0 A& d* v- a
  49. #define DMA_PRINTK( x... )
    3 B0 j8 t, p# ?" \, m% b
  50. #define DMA_FN_IN
    9 J% B! f$ Y0 F& d) p( W3 ^6 Q
  51. #define DMA_FN_OUT
    , S! m  E6 ^+ j+ M+ Q  \4 H
  52. #endif0 e; }1 Y& K# q" O- @

  53. 0 j: r2 a) Q: _, [. l- R& U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; Q6 X5 N* X" l2 R9 N" u
  55. #define STATIC_SHIFT                3
    $ I" ]) Y1 k# Q" X4 }) o
  56. #define TCINTEN_SHIFT               20$ r. y: H% o  f% V, ]
  57. #define ITCINTEN_SHIFT              21
    7 v3 h: w( V0 O7 T1 {
  58. #define TCCHEN_SHIFT                22
    & Q3 O2 w( P- \: C
  59. #define ITCCHEN_SHIFT               238 e! P% y. z( r$ C
  60. , i# e- \2 I& F: S  Y* q# z
  61. static volatile int irqraised1 = 0;
    6 w& Z+ @1 E' [9 y3 e, z: p* _
  62. static volatile int irqraised2 = 0;' v. ]: @1 \& T9 x+ p
  63. $ j/ w' o7 u3 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 @' ]+ d: s% O% c! d' {0 O& v8 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , H; P$ c5 }7 z3 `$ T( T) d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & h3 e/ [7 [$ V

  67. + ^$ k; M* e& f. H6 O
  68. dma_addr_t dmaphyssrc1 = 0;
    . @- C; N' h5 ]1 ?
  69. dma_addr_t dmaphyssrc2 = 0;
    5 D. X! ]+ e; x7 @( L8 W/ l( K
  70. dma_addr_t dmaphysdest1 = 0;0 [/ W1 d: A9 k4 y
  71. dma_addr_t dmaphysdest2 = 0;! h! F* ?; K4 q; E8 G# F) o1 X

  72. * K" {! \/ z4 W; m" i& @
  73. char *dmabufsrc1 = NULL;  C2 L+ z) I. W2 v0 H1 b$ J, u
  74. char *dmabufsrc2 = NULL;
    6 O/ h# U) C. R
  75. char *dmabufdest1 = NULL;7 S$ y' q# N* c, `3 z' V
  76. char *dmabufdest2 = NULL;
    , _5 K+ W4 _3 h0 Q+ R+ Q( q
  77. - G8 \2 a3 M( J) U' b3 c: @! i: D
  78. static int acnt = 512;
    5 y& H7 R$ e* {! b; e/ Y4 w, x
  79. static int bcnt = 8;+ f. t2 [' p5 U4 Q- O. ]
  80. static int ccnt = 8;. e% O; r% p3 X/ i: L

  81. , D8 \/ {. ?' }5 c$ O# C( ^3 ~; s
  82. module_param(acnt, int, S_IRUGO);
    0 b" ?2 s1 G3 C3 n: |
  83. module_param(bcnt, int, S_IRUGO);; Z- D" u$ b4 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& L, o* P' H3 M# O
% E6 {# H  e% `0 J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 f* `2 m+ \0 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# K/ J$ @4 D* i0 A, W) G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ c) ?$ I  \. ^. x7 ?! G' }3 V8 m# b' s- h+ b+ d" @  p' C
' }9 l9 _7 h: G. a. y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 03:08 , Processed in 0.039655 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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