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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" j# H9 Z. g" [+ q
  1. [code]EDMA sample test application
    ( ^4 H0 g4 B7 V- o
  2. /*' h& l$ W6 [7 k& G! i4 a6 I: A
  3. * edma_test.c
    9 M# o# X6 N  l
  4. *
    ' _2 V$ \/ Y6 ^& {
  5. * brief  EDMA3 Test Application
    , j9 ~4 g/ t1 S: c
  6. *
    $ N5 u. w: [: D
  7. *   This file contains EDMA3 Test code.
      v, Y' z$ ?3 t8 y' e- |
  8. *
    0 l3 o% s' t$ L/ g' T6 ]$ x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 w9 T) ]5 p6 Z, q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 {" p8 M9 l  i. @8 Y$ a
  11. *         TO CHANGE.
    ( ]4 m+ A+ y' |
  12. ** c' n; }! s$ M2 w9 \. K+ T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 a& X7 L  l  c) |- m8 J7 e
  14. *+ r- V, V* T. @/ e9 y
  15. * This program is free software; you can redistribute it and/or
    + O6 |" }* I) r
  16. * modify it under the terms of the GNU General Public License as4 }7 u# y% h5 b/ z
  17. * published by the Free Software Foundation version 2.3 x( r7 |1 i# I6 X: h, b
  18. *. w5 U( a" X" C, `" v/ H) E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % H4 M) D  r9 }, G8 m3 r2 z; S
  20. * kind, whether express or implied; without even the implied warranty, I1 d) i6 [: x/ d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 z* ^( _7 U# c5 \2 `2 T3 u- ?0 _
  22. * GNU General Public License for more details.9 W( T0 e1 A. }8 J
  23. */
    / m8 H) g) J/ C  r1 @* t' z' U
  24. 3 K. B& |' w, k( {  a  [
  25. #include <linux/module.h>- ^2 h' ]; z( I4 M8 M8 g
  26. #include <linux/init.h>4 c: ?1 Y. ^( P' k8 M+ p
  27. #include <linux/errno.h>0 F9 {1 \2 C2 `9 T% U: O+ `7 o
  28. #include <linux/types.h>
    ) E: E2 G" B- O
  29. #include <linux/interrupt.h>) |" c% `) b& ^9 L
  30. #include <asm/io.h>* z' x7 L9 M) y. i/ L
  31. #include <linux/moduleparam.h>
    5 ~) D5 |# _: q; X+ d# |# r: t
  32. #include <linux/sysctl.h>. h9 m' f8 u; U' W) M1 i; ]
  33. #include <linux/mm.h>
    2 R2 k8 l6 g7 u3 L2 A
  34. #include <linux/dma-mapping.h>
    : k+ z5 D' W) e5 x
  35. + d9 C9 ]3 y1 x
  36. #include <mach/memory.h>0 c" d" M2 g+ W
  37. #include <mach/hardware.h>
    2 ^( p, y4 P* I; z. r7 u
  38. #include <mach/irqs.h>
    6 k( c2 D- g; F+ x2 J4 `( m
  39. #include <asm/hardware/edma.h>* ?9 p" |9 c' ]2 D& Y
  40. " w* }" W3 j9 e+ L( ~2 }: Q% \% Y" p
  41. #undef EDMA3_DEBUG5 V! c2 Z0 ^6 ~- S; @8 V7 L
  42. /*#define EDMA3_DEBUG*/* f1 _6 ]1 c. r( n$ |, Q
  43. % O2 M% Q# p) `
  44. #ifdef EDMA3_DEBUG; d0 W7 S' ^$ _) ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 h# w" n, L4 b0 J3 I0 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  n2 M! J7 J6 ?5 d6 Q; q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ k6 t, w4 m6 b$ m' x
  48. #else
    0 z1 T4 y7 y' s) Y* u7 \% _
  49. #define DMA_PRINTK( x... )
    ( P3 O9 E4 n; l4 @
  50. #define DMA_FN_IN# n( K( x* U) |! N
  51. #define DMA_FN_OUT+ |( s2 H' f5 K2 H9 ?% l
  52. #endif2 F5 r( w7 y! x3 V$ I2 y

  53. ( p% R8 {5 P( ?; ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 l# }7 R5 I3 i' {9 t* J
  55. #define STATIC_SHIFT                3, S6 k" H, {$ @, i0 [3 X0 A* G
  56. #define TCINTEN_SHIFT               203 E5 i4 _7 e3 P- s4 [) }0 P+ w
  57. #define ITCINTEN_SHIFT              21  ^1 @, l& P& K3 ]4 j
  58. #define TCCHEN_SHIFT                22. q9 r# @; I; b6 l: W$ r6 `
  59. #define ITCCHEN_SHIFT               23- d7 t0 c: `9 w" `# f
  60. ! P4 c; o6 |# n  X
  61. static volatile int irqraised1 = 0;
    / G, k1 F1 v2 @0 V' q9 j
  62. static volatile int irqraised2 = 0;4 v0 D2 Q8 U- c
  63. + l7 J9 ]3 u: ?& S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , `! H$ \1 A2 X9 ^- j& [1 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # m% R" w' E* t2 @/ L. g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; j  Z) [3 R/ c" H- ~
  67. ! I- z) d: e1 k( j4 r) C
  68. dma_addr_t dmaphyssrc1 = 0;
    / Q6 ?- g9 H; Q3 I
  69. dma_addr_t dmaphyssrc2 = 0;
    4 g3 p$ t  P, B0 w
  70. dma_addr_t dmaphysdest1 = 0;
    6 k% ]( G2 T1 i$ k" v
  71. dma_addr_t dmaphysdest2 = 0;7 a! @1 n" b" y4 y3 k6 w0 L  e0 h+ d: n

  72. & [+ ]. ^% H! I2 H) I0 v" T
  73. char *dmabufsrc1 = NULL;& h3 w' ^7 ]* W0 j8 r
  74. char *dmabufsrc2 = NULL;$ M) _& i/ p  p' t
  75. char *dmabufdest1 = NULL;
      U; x. Y- i& z3 V9 @4 m' T
  76. char *dmabufdest2 = NULL;
    ' ~/ k( e  C# Z

  77. 2 B2 w5 J3 C+ G! j5 O$ D4 G
  78. static int acnt = 512;
    - Q4 y& O4 X6 V! F& n  J. t! U5 \
  79. static int bcnt = 8;; {; f6 T. h$ E
  80. static int ccnt = 8;
    ) ~- C# x: M4 n. U# H: S

  81. * Y5 W# d0 _) O! U- ~: _& x4 C. Z
  82. module_param(acnt, int, S_IRUGO);) y. j! E1 M7 i' F5 A7 q
  83. module_param(bcnt, int, S_IRUGO);: R( }- S3 G9 Z5 b* _6 V, S4 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 K% A: c( x( C. C! g4 P  y0 C: b2 J
* |8 f1 p+ Q! Z" Q- M* L) e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ [. v5 O) l, [! S9 P2 R) W) O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! h$ W. V* t3 W  P$ n2 d  ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 R: t1 q, |( Y3 r4 N

1 R* |3 t$ W7 A( M6 `' `# W% b% d9 [. h, b8 W6 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 00:24 , Processed in 0.039168 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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