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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : B/ f( O1 y1 _, q& T% r$ T  c
  1. [code]EDMA sample test application' ?7 k% B% f4 W3 d" D' l
  2. /*
    7 E- r* m. B: L: F+ H
  3. * edma_test.c
    . [4 {( V9 M: Y$ L/ I
  4. *
    ; i1 W& G2 a, J4 i
  5. * brief  EDMA3 Test Application
    5 p; y: c8 x  d* z# e% d5 J) h7 ]
  6. *: r% S/ Z: b( ]
  7. *   This file contains EDMA3 Test code." W: R1 h+ {5 P! b
  8. *" d; t2 b* B( Y6 k3 Q0 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  ?8 s/ F7 ?7 h! p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* X0 [- G  o+ E: \
  11. *         TO CHANGE.  |) y; V1 g- \! K  y4 f/ P7 V
  12. *$ W; A7 q, V: n" s4 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 O. m. F. U- ?3 s* S* W2 @* h
  14. *
    9 j8 j4 f7 \/ N) C" T9 L3 _
  15. * This program is free software; you can redistribute it and/or. T5 m2 O- d3 P. w! ]$ A0 \7 ?
  16. * modify it under the terms of the GNU General Public License as' m$ R5 k1 X8 l# w! {" w
  17. * published by the Free Software Foundation version 2.' c# {6 _! ^! a! H
  18. *
    " v6 n% k5 K" u* V7 I2 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * @% ]% o) A( t" A
  20. * kind, whether express or implied; without even the implied warranty
    ' J' h# {3 a7 k# H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ u; r1 E. t1 `2 w3 m& o# S" @
  22. * GNU General Public License for more details.6 \% o4 }( B+ R! ~' M& C
  23. */( A: f1 i/ Y, }3 X8 D1 \
  24. 9 w7 _1 h. I8 f9 W: k
  25. #include <linux/module.h>
    & q1 v) ~- l: b: h7 o& g
  26. #include <linux/init.h>
    - @. g- O$ K2 i( N
  27. #include <linux/errno.h>
    7 l/ E4 v+ |  o% ?! U4 V
  28. #include <linux/types.h>, L$ D8 Z# `5 P% P7 _+ T. `
  29. #include <linux/interrupt.h>3 x) B4 ?/ o% _% S/ S- l
  30. #include <asm/io.h>
    4 C( [7 T/ P( Z; ]$ D1 }
  31. #include <linux/moduleparam.h>
    1 [3 Q3 d# l# k7 E+ z# M
  32. #include <linux/sysctl.h>6 ]$ t7 v7 o' y
  33. #include <linux/mm.h>1 g3 f; R/ L0 W; \! i0 P4 H* }
  34. #include <linux/dma-mapping.h>
    , x1 c+ i& f/ y. x* i4 D* O
  35. # w/ y1 e$ j" s1 m: C
  36. #include <mach/memory.h>
    9 R& B8 P% f; r; i
  37. #include <mach/hardware.h>
    + F5 O+ @+ p. h  }0 e6 s0 X
  38. #include <mach/irqs.h>
    7 H4 T' {- ~: y- ?5 h9 n7 |& p& F' [
  39. #include <asm/hardware/edma.h>
    7 ?/ j; [0 H& D6 @

  40. ) H. J7 q  S" P* j5 ]
  41. #undef EDMA3_DEBUG
    3 a; ]) X1 ]% y# o/ R1 K- M
  42. /*#define EDMA3_DEBUG*/0 m  X7 p, g7 {, h
  43. ) c' S% e) B+ l! }
  44. #ifdef EDMA3_DEBUG) \) q$ L6 {; K5 P8 n: ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : X) Z$ ~- Q, j# B2 `* S. O: b0 V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 _! \: j- q" _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" X  B! p; `3 X4 e
  48. #else" c* {4 c* x/ J( y
  49. #define DMA_PRINTK( x... )' V6 Z: O8 \2 L9 Y9 {$ Z% \
  50. #define DMA_FN_IN
    9 N3 Z0 v) L  o( p- p
  51. #define DMA_FN_OUT/ X; u* p4 Y8 {, Q
  52. #endif# w: ^* Y4 A0 u2 L$ M( g3 ]2 o  _

  53. ' n4 C! ^2 E' U# S1 \. F4 R- s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : R2 S" H! e5 ~7 V
  55. #define STATIC_SHIFT                3
    / ^' I/ M" i1 `8 `
  56. #define TCINTEN_SHIFT               206 @# E5 ~' R) A# k; v
  57. #define ITCINTEN_SHIFT              214 x; ?, P: K- X. q. p
  58. #define TCCHEN_SHIFT                22
    1 ^! S* k( ]: v- `& Z: h$ _
  59. #define ITCCHEN_SHIFT               23
    ' {, s! V; U0 U/ Q. m2 E0 F" o8 V
  60.   \6 h- D* _% I' @
  61. static volatile int irqraised1 = 0;; _( x+ @/ B2 ?1 }( N
  62. static volatile int irqraised2 = 0;. _6 u) f  A& O9 R

  63. ( A6 V0 J9 s1 H  c* L* K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 J- D, o" D/ ?8 t5 l+ W) U3 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! J4 K" o1 t2 u0 r5 V& a" {: n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) B6 r- H/ d% P# M5 y  |/ a! X$ N, [' m

  67. & g! d2 [( ~9 {. r; h: X/ W0 ~
  68. dma_addr_t dmaphyssrc1 = 0;6 X/ m0 y& @/ x% E2 A4 M5 M. w8 T
  69. dma_addr_t dmaphyssrc2 = 0;' {8 a! B& J9 t4 R" [5 ~
  70. dma_addr_t dmaphysdest1 = 0;
    , _9 e7 P& w, T- W. @  i
  71. dma_addr_t dmaphysdest2 = 0;, l  z5 A/ ]" u
  72. , q, S+ c2 u+ C/ T6 @7 ]" f
  73. char *dmabufsrc1 = NULL;
    + H8 a8 j  M. i' x& ^
  74. char *dmabufsrc2 = NULL;, u$ a* U6 m' X8 w3 q+ W1 L7 i! ?) n
  75. char *dmabufdest1 = NULL;; ?: R( @; R/ J5 v7 ^2 W
  76. char *dmabufdest2 = NULL;
    8 y) ]! V5 v- U& A8 @$ H
  77. 9 c, s' ~( V1 q* b" j( E
  78. static int acnt = 512;& S+ z" |, y2 p1 G& s3 I$ ?
  79. static int bcnt = 8;1 [7 n. q  C. P; r/ n8 U
  80. static int ccnt = 8;7 \- {5 ^* S, V
  81. ' ^  U6 I! k' A4 E
  82. module_param(acnt, int, S_IRUGO);) ]( `& N# s0 i3 o6 P
  83. module_param(bcnt, int, S_IRUGO);( P  _3 f, A2 o9 U; t% y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# h; R3 S% ^5 M5 `; @$ {# ^- t1 l4 w* n" \4 Z. y, s1 w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: o4 M- B  Q+ _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# V# y9 t& Y; c5 Y+ O8 d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. \+ r0 @% Q" D; y8 w& q" p2 ^# ]8 j5 v& q
) q0 G, O4 i4 f! x% J9 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 13:15 , Processed in 0.038516 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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