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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) n( f( k# R6 W' ^
  1. [code]EDMA sample test application! z0 Z) j% e, X5 T; u
  2. /** ^1 v% M3 |6 T& H
  3. * edma_test.c( |* o' @" ^1 p
  4. *
    * h2 e/ {+ s8 q9 c* c* h2 [
  5. * brief  EDMA3 Test Application
    : ~, A4 ~8 D1 W7 ~; S
  6. *; W/ L9 }* z' ~1 S  a& G) J6 O; \' r
  7. *   This file contains EDMA3 Test code.' N0 C8 k3 q' R8 C& L0 }8 l' T6 B- `
  8. *& a/ H. f5 o' B: Y- g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 J( z5 r' ^- b* Z+ A& Q  N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 `# m' f5 m' G9 _& }$ q
  11. *         TO CHANGE.- }% m! u& ^& k0 U! @
  12. *& Q/ F* J, j; T# W6 C3 m" ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; Y" p" t1 N) w5 k
  14. *
    # P& m+ s* M' k
  15. * This program is free software; you can redistribute it and/or
    / n. `& X' W8 @# ?& t9 V8 |$ U' Q
  16. * modify it under the terms of the GNU General Public License as) n: U) \- f& O# \# r
  17. * published by the Free Software Foundation version 2.9 ~" l* [: N  C/ w- }! @0 t
  18. *
    ) y8 m2 u! V3 t# J# V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 @9 K! t. e$ c) E8 I
  20. * kind, whether express or implied; without even the implied warranty
    3 E8 w* m4 U  W6 D0 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , J  D, A! D, a3 f$ v
  22. * GNU General Public License for more details.) _! r" R) d! K; @! L
  23. */
    . w7 X( a; y* _6 l/ k. O

  24. & L+ S6 ]  J3 s
  25. #include <linux/module.h>
    1 l( _/ ~/ j' M3 ?% @4 d
  26. #include <linux/init.h>; Z) ?6 `* `' B/ t: Z; h7 K
  27. #include <linux/errno.h>3 M" V! }5 \5 R3 B9 L( i
  28. #include <linux/types.h>
    1 c* T% D$ a  @
  29. #include <linux/interrupt.h>
    1 o8 `; J& i8 l1 n
  30. #include <asm/io.h>+ k4 B1 ]; V- e) h4 B7 R1 P
  31. #include <linux/moduleparam.h>
    $ G0 a# ], \/ ^, T. A, r& O
  32. #include <linux/sysctl.h>  B1 g3 u* N) k. S2 v9 y& e
  33. #include <linux/mm.h>
    * _) ]- q' R  m% P% \8 s! e; I8 U
  34. #include <linux/dma-mapping.h>8 O# d" c2 L. C! G( G' X

  35. ( O8 ]7 Z- P! b* c- s
  36. #include <mach/memory.h>0 t$ A' t8 t  i- q
  37. #include <mach/hardware.h>. Z7 ~. E2 w1 k% P* ]! O
  38. #include <mach/irqs.h>
    ) b' o; K; r8 X6 t1 y5 z
  39. #include <asm/hardware/edma.h>* w! T9 h! F  e7 X: q# z

  40. $ s# K+ S+ S$ K3 y( h2 H+ a3 ?
  41. #undef EDMA3_DEBUG( `2 E$ _: Y$ l9 P* `$ {
  42. /*#define EDMA3_DEBUG*// o" d; w% g" @3 V+ K4 Y

  43. " O2 K/ r! q& U" R4 x
  44. #ifdef EDMA3_DEBUG
    9 Z+ D/ s: U3 u0 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' B( h7 @) J9 k5 v  r% \/ A8 a( R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ Y( W8 d4 I. m, ]" G& M% I- H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 C) {- ~, l8 _& J
  48. #else
    0 o" K1 o, {+ B% ^
  49. #define DMA_PRINTK( x... )+ w- t, X. I$ [
  50. #define DMA_FN_IN. ~+ `0 q' Z& P- ]! ~. }
  51. #define DMA_FN_OUT4 x3 v9 t+ S$ S* p8 K: O& Z; m
  52. #endif
      Q6 r/ `, ^5 s" W

  53. % l+ o: z' z6 ]$ j, M' ?6 r: E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 R7 W* e' ~9 \/ J0 K# p5 D9 r8 d
  55. #define STATIC_SHIFT                3
    9 v# A, i! u) z" B4 P
  56. #define TCINTEN_SHIFT               20" q/ d# Q) `' @* }+ W4 _
  57. #define ITCINTEN_SHIFT              21
    6 Y. Z5 P4 G: b$ @. y3 N: K
  58. #define TCCHEN_SHIFT                22
    ( D7 _: o7 M* I0 x5 O* Z0 Z
  59. #define ITCCHEN_SHIFT               23
    . j# c: A; B5 h! h$ U: L

  60. / i/ |" r: i1 c
  61. static volatile int irqraised1 = 0;6 J! h& e; x% }9 [
  62. static volatile int irqraised2 = 0;2 d5 }8 y" S# C
  63. : z/ T9 x% }5 A9 ]1 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - i5 d! {7 b5 T$ a5 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % a8 A, C2 h: R: N. z2 p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 }# {' S7 z9 v( @

  67. 8 C; o( {/ l% ~/ O# a( R2 s% \
  68. dma_addr_t dmaphyssrc1 = 0;
    4 O# d( Z$ ~2 b/ B3 I! K
  69. dma_addr_t dmaphyssrc2 = 0;
    $ ]4 _& o7 i1 ?+ S/ i
  70. dma_addr_t dmaphysdest1 = 0;
    8 G8 n5 @: H) H3 H
  71. dma_addr_t dmaphysdest2 = 0;7 ]/ R; j# B/ G5 W8 B

  72. ( k# k; p# X8 {5 U, X9 ^* y: V+ O9 x! m
  73. char *dmabufsrc1 = NULL;; k+ r9 ?, H* g9 A
  74. char *dmabufsrc2 = NULL;
    , o. {/ Y; ~: \+ k2 Z
  75. char *dmabufdest1 = NULL;$ K/ Z" L! g+ L% ]
  76. char *dmabufdest2 = NULL;% q& ^8 [; N/ J) z

  77. # L7 p( G! G6 J9 c4 q
  78. static int acnt = 512;9 Q2 a* K. @! e9 ^8 R
  79. static int bcnt = 8;0 j, s( G4 v" u* @3 A' P
  80. static int ccnt = 8;! o9 f5 I. P5 u' K: w. r1 ^

  81. - Z1 U7 e- W( S7 |+ {: J( K7 q
  82. module_param(acnt, int, S_IRUGO);
    5 ~" Y8 W9 [8 W+ b1 \1 G& j, C
  83. module_param(bcnt, int, S_IRUGO);
    . M& {( a7 P7 Q( _; n+ ?/ @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. v6 B* H. O/ h* \; w. N3 q0 X/ v5 v$ K9 n  a7 Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( M* J- r( S. u3 z* s! \8 E( y. qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" x3 V# g' p+ a; _# m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* u* e& s9 ]$ @: X+ A0 }2 S6 h

9 [% N( G; w9 O/ t
3 L: S) C& n' l4 c( Q- x7 Y) h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-27 16:25 , Processed in 0.042447 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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