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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 S& p: r9 e" D0 ^  b
  1. [code]EDMA sample test application& \! a2 z9 L; ~" g! i3 ^) }& Z# f& C
  2. /*
    1 V8 K1 c$ a. s' g: m
  3. * edma_test.c
    4 ~* r; _; l+ I3 B; U$ ?& z7 O  v
  4. *
    - m  w$ u8 e) `, s
  5. * brief  EDMA3 Test Application1 a, w# A1 x# A; O
  6. *
    $ d% O, ^1 _" @3 A  c
  7. *   This file contains EDMA3 Test code.
    " l8 M5 ]6 ~$ B( I  ~- U! w+ _
  8. *
    / |0 h2 B) b' R- D. K2 z" D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : |% d5 P+ e5 N" B( v* Q9 l/ _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , L, e( ~* L' Y2 F  [
  11. *         TO CHANGE./ |0 _  N/ t4 Z6 _
  12. *# Y; F3 ^4 @3 T" N* N0 M1 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 z. ]6 v& [2 S4 R* K& ^7 i
  14. *
    & |' e+ J4 K3 \7 E* W+ f
  15. * This program is free software; you can redistribute it and/or
    2 P: n: O! O) m, {  P" Z' X3 a
  16. * modify it under the terms of the GNU General Public License as! k" f  I- [2 s" o; [$ q! ]
  17. * published by the Free Software Foundation version 2.
    0 I: l9 s/ x: O* i: n! K- t
  18. *2 r9 U  U8 Q; C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ T; s) ^! v! W
  20. * kind, whether express or implied; without even the implied warranty0 Y1 W- O$ Y1 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' ]! P5 M* \1 F7 z/ g, d+ F
  22. * GNU General Public License for more details.. w# y/ A4 j) X/ L3 n
  23. */! X; p& \, r' g1 S  l9 z4 Q1 r

  24. ! L( l9 {# }$ M2 y
  25. #include <linux/module.h>
    : S4 r/ K6 R% j$ Q0 v
  26. #include <linux/init.h>
    * i# p. W6 w; `) F/ Q- z8 a
  27. #include <linux/errno.h>% B+ v; S& \. Q8 S' R& |: A) H
  28. #include <linux/types.h>
    2 O  A2 L2 X2 ^" r. K
  29. #include <linux/interrupt.h>
    ' O% k- A2 X. k1 y) X
  30. #include <asm/io.h>; a) Z% {6 m; W6 K( C
  31. #include <linux/moduleparam.h>
    7 b0 a  f0 F  }7 j& _' B
  32. #include <linux/sysctl.h>! N9 A4 z0 t- i( c& S- g
  33. #include <linux/mm.h>
    * p7 Y. H& O- w! A( B; d1 _: L; X2 a
  34. #include <linux/dma-mapping.h>, b2 f8 n& S8 _, K- V/ D" x
  35. # A! T8 I3 t8 q1 c1 R
  36. #include <mach/memory.h>  S' C- L7 M" ?( q, h1 [/ B
  37. #include <mach/hardware.h>9 |( v- N) a# @% e( J
  38. #include <mach/irqs.h>
    * S" ?8 l3 E  j  C3 I
  39. #include <asm/hardware/edma.h>
    ; \* J0 Y. v% L, x, S6 J
  40. 5 u  v2 @1 }9 F
  41. #undef EDMA3_DEBUG
    + `/ x" @& V! ]* I3 b% }
  42. /*#define EDMA3_DEBUG*/! u5 `9 t7 h& _3 r

  43. ! o6 ^% s8 r8 @  w. ]0 H
  44. #ifdef EDMA3_DEBUG2 r3 U* r$ t$ Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' T/ G" W1 a5 F3 q* s6 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  z; b( Q6 w! j: q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , L: b' P/ Q' g7 u' f; L# N) ]  x$ e
  48. #else2 |2 b! ^4 [' f) h, U! |2 y
  49. #define DMA_PRINTK( x... )
    ' D* s3 A- T, g; z' T) r
  50. #define DMA_FN_IN
    1 R8 W9 ^7 b+ _
  51. #define DMA_FN_OUT- t6 O8 h# X$ \  l( r4 B  q
  52. #endif
    $ i9 `. ^; j& J4 v& m  N

  53. 0 k8 O9 `9 K" e: W& t9 ?0 c9 r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 H' z* V) C" m& H; \
  55. #define STATIC_SHIFT                3
    6 k" i; s9 i! P/ V9 h! I% _
  56. #define TCINTEN_SHIFT               20$ z5 U) U8 o9 t& o( q) i4 Q: N
  57. #define ITCINTEN_SHIFT              21
    6 o  P1 q8 m& Z. ]6 Q" }6 I, s
  58. #define TCCHEN_SHIFT                22
    1 z6 Q, `* L; E: n: G4 V5 w
  59. #define ITCCHEN_SHIFT               23
    & w8 N+ `' v# [: p/ d7 L; b$ c1 j1 P
  60. # u5 _1 v+ k$ j/ c! N- C  d& M, m) [- s
  61. static volatile int irqraised1 = 0;" g  H, s5 L, U* M, n) @/ A
  62. static volatile int irqraised2 = 0;
    7 [; d+ i8 o, _- q3 p! h
  63. * E. A9 d  ~# j: `3 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- h. i" z' @/ w8 e2 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" W* A" B7 s; i8 s2 @) \2 y( z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . E/ X9 z! y& K+ |/ p7 Z

  67. 8 y7 a/ q& R5 z7 @9 S& E# x2 d& r
  68. dma_addr_t dmaphyssrc1 = 0;6 y' x& N# K/ L$ _" Q
  69. dma_addr_t dmaphyssrc2 = 0;7 Q& {! k& i% V0 s
  70. dma_addr_t dmaphysdest1 = 0;! P% M/ P. K- ?7 \: X
  71. dma_addr_t dmaphysdest2 = 0;- k' ~3 f" F& O# y  z5 B0 z' e

  72. & G: j: g/ S" B3 j
  73. char *dmabufsrc1 = NULL;) n% G$ }5 v7 M( x  r# n/ h; j
  74. char *dmabufsrc2 = NULL;
    4 d+ i( L' G1 q, b! J% r6 ^" G
  75. char *dmabufdest1 = NULL;
    7 R" {! R0 `2 H3 l  z
  76. char *dmabufdest2 = NULL;& K0 C/ ^# ^8 W5 Q* }

  77. : C0 s6 P, Y& L9 T
  78. static int acnt = 512;7 O! R: S/ D- Z, v' ?: U2 {1 A
  79. static int bcnt = 8;
    . i( V, R: j) p0 D3 y
  80. static int ccnt = 8;6 X8 f, z/ L- u& a/ d. S3 ]3 D6 c
  81. $ [- z9 b) a; b6 K" l
  82. module_param(acnt, int, S_IRUGO);
    & D% G  G) |& F0 s5 M( A
  83. module_param(bcnt, int, S_IRUGO);
    ' X  @# T2 N% s" l2 E% c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, H1 X) `4 f: {" Z
( F* j. J0 V5 u7 |, C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: P4 q* ?, X3 g6 t, R' d) O9 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 _/ K. q0 @2 {% |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ ~" r2 f( U! |! V& e; q' [9 I4 _$ Z  N$ d- e9 f$ _" x3 q0 D
3 Q) z8 C3 r7 J0 P2 h% I: c0 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-8 03:59 , Processed in 0.039466 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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