OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 Y) N$ P% j! N7 {8 ~! R
  1. [code]EDMA sample test application
    % ^! n8 w) W/ o) K8 E
  2. /*  T- q/ Y$ T# W2 f
  3. * edma_test.c; k  k! h9 R% o& ~$ ?% x
  4. *
    * [% P( @, c- z# p  x& S
  5. * brief  EDMA3 Test Application+ l8 B, s# I- X
  6. *; t6 P3 \! X) C( k
  7. *   This file contains EDMA3 Test code.
    ! \; R- e: r8 c5 B
  8. *
    + Z" D5 C7 G/ U% f/ M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 G. [* `! c. V& k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      X5 f6 h7 z1 s9 f. B3 c
  11. *         TO CHANGE.
    & F6 R. R; {- s  m
  12. */ B0 O' n% ]; j' P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& f* Z$ h8 o5 y5 s" S& t2 Z
  14. *
    : U. N% K1 k+ L5 t6 S+ {; ^8 t
  15. * This program is free software; you can redistribute it and/or4 ^! c% _7 K& \; h
  16. * modify it under the terms of the GNU General Public License as& ]% c# _& }& B' S' B
  17. * published by the Free Software Foundation version 2.
    1 f% V# r7 f1 ]; e! K+ X
  18. *
    2 H/ Y! z0 l6 [0 U/ o0 R) Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! @. x( R6 V. `1 l3 Z! L" ]0 v
  20. * kind, whether express or implied; without even the implied warranty
    7 |, d" ^/ p+ z  ~* G7 ~% r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % }, ]( [- e& v8 {
  22. * GNU General Public License for more details.
    " f0 k1 S' t, s( a' |# l6 y
  23. */
    ( p+ {$ O6 d' o5 Z4 R# a8 K# Q" \* j
  24. 9 G( a1 {0 n, a8 Y
  25. #include <linux/module.h>
    4 g; s3 ^/ T" Q
  26. #include <linux/init.h>
    ( _, i* z& K; x/ v9 w6 P3 O
  27. #include <linux/errno.h>9 K  e, b# K+ U" r. F
  28. #include <linux/types.h>
    * P' J/ o! ?$ f/ W6 G* H* O0 g  H" ~
  29. #include <linux/interrupt.h>/ Y7 ^$ k- H8 R
  30. #include <asm/io.h>
    1 H* g/ n: V  |1 [% n) H$ @. H: D3 @
  31. #include <linux/moduleparam.h>( w! h% A1 y7 a  S/ O0 L$ |8 T
  32. #include <linux/sysctl.h>
    ; j5 ~* O5 x: @$ y8 ]  N* I
  33. #include <linux/mm.h>: s; r0 |! J( o
  34. #include <linux/dma-mapping.h>
      ~: S* x8 }; `: n

  35. ( {% s1 [1 Y- k5 p. u2 A! c0 P
  36. #include <mach/memory.h>9 q: J. x7 Z; d2 Y
  37. #include <mach/hardware.h>
    1 K9 M3 _9 ^  M; h8 Y$ \
  38. #include <mach/irqs.h>7 ]  D  E* B  u9 D- A" x0 E
  39. #include <asm/hardware/edma.h>
    ' R& q) p6 e: i" u
  40. 8 L% W! D$ d2 G  Y" h+ V* m
  41. #undef EDMA3_DEBUG- @' R/ F& g8 A# x
  42. /*#define EDMA3_DEBUG*/; G( Z' `+ E! s& B- B* B" R
  43. ( g) _2 V$ S* i2 L' V
  44. #ifdef EDMA3_DEBUG2 B! a. G' i9 c( o! o+ X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 J; v% k. R! D. u' @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" n  u% Q/ l9 r, y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( `2 `% ]9 @& o$ U$ Q) l
  48. #else- o" Z# @' @) g* ]' m# V
  49. #define DMA_PRINTK( x... )' e3 h+ O. M7 C' B4 K5 u
  50. #define DMA_FN_IN: e; ^+ A! F! F" d# ^, C" \' O& `
  51. #define DMA_FN_OUT
    $ @5 @1 I1 Q7 \9 s* q
  52. #endif
    ) t/ r  V: d  _2 a. d

  53. $ r: s" B4 i. C/ |6 }- V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' q1 U8 g& l8 [# L6 V
  55. #define STATIC_SHIFT                36 |9 z) f3 p3 A% V: ?
  56. #define TCINTEN_SHIFT               20
    9 g  d9 [. r, a7 ~
  57. #define ITCINTEN_SHIFT              21; s+ P* A$ a4 P) k# [* g
  58. #define TCCHEN_SHIFT                22
    2 H& E# r. G6 X; X& S
  59. #define ITCCHEN_SHIFT               23. [0 u7 x1 Z: r' [: ]# k# @
  60. - y: t) ^/ R4 W8 U0 W) Y
  61. static volatile int irqraised1 = 0;
    2 _. i" D; g& E3 O; n' |3 [; V8 o
  62. static volatile int irqraised2 = 0;
    * a: Y5 C& j# x  _: s

  63. - f+ V- d$ }. {+ z$ }! }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ W% _! Q. b0 b$ x# u) X! f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  o! R5 j0 b& s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( |! B0 \! {2 M1 W, d% L4 e

  67. 6 |$ h$ u) J/ P
  68. dma_addr_t dmaphyssrc1 = 0;0 k5 N0 G7 ?  W3 g* D
  69. dma_addr_t dmaphyssrc2 = 0;9 P3 C# \' I+ k1 ?  V
  70. dma_addr_t dmaphysdest1 = 0;9 U( |& t) z' e
  71. dma_addr_t dmaphysdest2 = 0;
    & k& f: Q1 s) |! J8 Y7 U
  72. / V) B* Q2 o$ ?- k& P5 M. V
  73. char *dmabufsrc1 = NULL;. C+ j+ b" \/ _
  74. char *dmabufsrc2 = NULL;
    - _8 ?  E3 W6 {! N) M/ g  S
  75. char *dmabufdest1 = NULL;" W! c* {4 d" I6 U, S8 ^
  76. char *dmabufdest2 = NULL;/ F% P5 P; \/ N' O! Q/ \

  77.   S. D  r) e( J* i6 v
  78. static int acnt = 512;) l* i1 S' s. V! {
  79. static int bcnt = 8;
    ; ?  U' b" V; `1 L
  80. static int ccnt = 8;3 {: A, \9 R$ n+ n# a* E

  81. * @- O8 l, n0 S/ z; Z
  82. module_param(acnt, int, S_IRUGO);
    , b7 Q0 T' W' g. B
  83. module_param(bcnt, int, S_IRUGO);
    ( D  v9 F* W" a3 k% y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; T' f8 s9 d0 Y$ L" H$ Y$ k
5 ~# c! P7 ~- b9 H$ c3 ^+ b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 G* B7 [& H& S7 P% C* M* Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) X4 a1 \# d, u2 ]3 e3 R5 i! w4 g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) H0 m1 H. Y6 U: l
  `4 N% ]2 I5 ?/ b( {
: m) h2 s2 e# C. _* E5 N, Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 11:53 , Processed in 0.038742 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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