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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% ]8 j& r$ |6 }/ R, P$ R
  1. [code]EDMA sample test application6 o. e* ~' c% `; y/ @/ R
  2. /*
    * n3 ^1 e! T5 x! }% V. x* [
  3. * edma_test.c* V+ b/ m! W: w
  4. *4 l8 b( v3 Z6 o$ m5 ^& y& b1 C
  5. * brief  EDMA3 Test Application$ Q- Y4 j2 J7 O8 [% v. r
  6. *9 O$ u: [" N7 z- `/ I) A
  7. *   This file contains EDMA3 Test code.# k4 {0 p4 d. G3 X5 W& |6 k7 s
  8. *
    + P. {  Z: m. n4 l& n& T! I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , Y$ o! x8 j6 L0 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& B8 r% z: a% C0 c1 Z. O9 s0 f+ @
  11. *         TO CHANGE.
    ; Z. S2 V/ V' e. c. ]6 I2 I. d
  12. *6 i+ g4 G8 a$ Y" R* a0 j8 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: T/ b, S. K) d. K! C. P
  14. *
    2 Z5 x' t1 b. T- f, M) n* \$ H
  15. * This program is free software; you can redistribute it and/or% c( Z/ {3 N/ D& i+ r, }2 K
  16. * modify it under the terms of the GNU General Public License as
    ) U- e. O+ K! U
  17. * published by the Free Software Foundation version 2.8 f2 _! v: Z3 ]% b
  18. *
    # X; o$ G$ ^- V; o8 Q4 |4 t+ V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 \  L+ ~! E" v; {  O1 m; D
  20. * kind, whether express or implied; without even the implied warranty+ h) b! V9 b4 ^; t$ T' u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ A! z' O0 ?5 n' H& Q) f
  22. * GNU General Public License for more details.2 U, F4 `6 @. u
  23. */, s3 J. f/ |8 _4 T% P" {+ v
  24. 3 C- ?1 ~7 _1 s$ \8 A( o
  25. #include <linux/module.h>
    ' S8 d) p) k) M$ v8 g/ a3 p
  26. #include <linux/init.h>
    3 ~$ M, |/ w4 [/ E
  27. #include <linux/errno.h>
    ' k" d9 ^% H; `! l3 G( F$ y8 j
  28. #include <linux/types.h>
    0 z1 d& W0 l5 \' Z/ c
  29. #include <linux/interrupt.h>
    5 U. O$ i/ \& {% B
  30. #include <asm/io.h>
    / y$ O+ ]' f* }* V
  31. #include <linux/moduleparam.h>) j4 \* I  N8 e# f1 s$ m/ @
  32. #include <linux/sysctl.h>9 y9 A5 p4 M+ B- T9 g6 j$ X
  33. #include <linux/mm.h>
    9 M" ^4 d* |, I# X) k' B
  34. #include <linux/dma-mapping.h>
    $ X4 Y5 I1 j, r+ e0 |6 _, P) q( K( K
  35. ' z0 _8 Y" p( P3 I% v1 l: ?
  36. #include <mach/memory.h>
    8 F4 j7 l% z; j; U3 F
  37. #include <mach/hardware.h>
    * y& _/ V$ V; B1 n! M3 ~, v
  38. #include <mach/irqs.h>2 Z) O: u. C- T4 _5 B
  39. #include <asm/hardware/edma.h>3 `- X5 a2 ]3 v: U; S+ {

  40. ' |4 Q/ ]" i: x9 m+ h
  41. #undef EDMA3_DEBUG# e) F& i3 ?6 |
  42. /*#define EDMA3_DEBUG*/
    & x3 R2 @" V2 ?" T
  43. . _/ T0 M  u. G" v6 A
  44. #ifdef EDMA3_DEBUG
    . t8 b# m- _3 a1 p$ W& O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 M/ @( l3 Q" q# B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): A8 x2 d  o' C6 q! h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) u' E3 P" Y) D
  48. #else
    - e3 f2 o% b' H$ S
  49. #define DMA_PRINTK( x... )  K% o+ d9 \4 j6 M7 T3 i
  50. #define DMA_FN_IN$ a3 N* `6 J. X" J. X
  51. #define DMA_FN_OUT
    ; S' K7 \4 K" W/ p4 B
  52. #endif3 T# f. F: j, k) p  i% f' T

  53. 4 l: X# j' U; p; L4 ]7 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / e) N* s% q2 b: k
  55. #define STATIC_SHIFT                3
    % S# e2 @% u! W5 i' R& h9 w
  56. #define TCINTEN_SHIFT               209 w5 X5 o- H, `' Z, C
  57. #define ITCINTEN_SHIFT              21
    & L+ E3 v+ N  Z# J0 n3 e. P
  58. #define TCCHEN_SHIFT                22
    8 b( o( I$ S) N- r
  59. #define ITCCHEN_SHIFT               23
    . P% i0 n7 H$ \3 @6 a1 C( [

  60. ( b2 s* I  V) g5 L9 p  Q3 W; Z
  61. static volatile int irqraised1 = 0;
    4 C1 U8 V, A. z: a* V
  62. static volatile int irqraised2 = 0;8 F+ P3 I* `3 L9 L3 z8 ^
  63. 4 h+ i0 s0 G4 x2 I* v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 M$ k; y" Q4 V5 k! o  V) h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( g3 N2 }& i$ h0 T% L. G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ g' q. J& I& k' z5 m0 r; X
  67. % d3 n$ {$ [* o+ r1 {
  68. dma_addr_t dmaphyssrc1 = 0;
    3 T' c2 N) I7 h; @
  69. dma_addr_t dmaphyssrc2 = 0;/ [# e) W$ h' z/ t- j4 h
  70. dma_addr_t dmaphysdest1 = 0;/ l9 N! O6 L$ z: G; P
  71. dma_addr_t dmaphysdest2 = 0;- X1 Z+ D. w2 o* C! C
  72. / ~& x- i- c! H' {1 [6 |
  73. char *dmabufsrc1 = NULL;3 F; K0 ]; D) T' _% p
  74. char *dmabufsrc2 = NULL;
    / `8 V2 Q+ Y4 G! a8 o
  75. char *dmabufdest1 = NULL;
    $ G1 \6 q3 n# U' }# f$ ~& V- ]
  76. char *dmabufdest2 = NULL;
      K+ X: g- C! h
  77. * s$ u. n# \1 ~
  78. static int acnt = 512;3 q9 o: ~$ G7 j: a
  79. static int bcnt = 8;8 B7 k( E2 P6 {; X% S, s
  80. static int ccnt = 8;" O( T* ?; J6 c. J. v1 v

  81. + ~, G2 d/ Z4 ~
  82. module_param(acnt, int, S_IRUGO);
    ( n: G1 U& U- Z0 W. ^
  83. module_param(bcnt, int, S_IRUGO);2 A6 |6 L* _0 x( ~* V3 ?  c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" ?9 w! Z3 @0 q; I1 P; R/ l! L9 \  ?; ]4 p# k9 k! }* H) Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: \, ~6 @, y% \* E  o3 B: J" ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# \5 c8 n8 l1 s/ y" B' ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* @# i# T3 A) T5 U- r
& J4 Z% @- Y" z9 d' k" m% M/ K
2 B0 J8 N5 {! l0 k4 j  M- b$ a3 f0 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 21:29 , Processed in 0.041917 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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