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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , U8 x& r, T9 s6 B/ Z
  1. [code]EDMA sample test application
    9 m5 U9 o' O& v# x7 I2 D
  2. /*8 u; b+ D4 f9 r5 D$ W' c( c/ x2 a
  3. * edma_test.c5 ~% S$ V& `) ^7 O
  4. *
    4 i8 n$ d- s- x$ b( y9 W' U' K4 e
  5. * brief  EDMA3 Test Application9 [: I$ S9 i. @* ?% T
  6. *1 h5 |, B9 I0 r8 C
  7. *   This file contains EDMA3 Test code.
    $ _* m0 R- l% y% q7 H" u2 e
  8. *9 q3 J8 y3 ?' e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 T2 s: R: B+ [# E, m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 n' w' N* }! P9 }
  11. *         TO CHANGE.
    ' k- L7 \0 P9 b: g: d" r( _2 O6 J
  12. *
    , r3 V7 p' I" c. @/ u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # d! H7 B: O# T7 f
  14. *
    & s: j1 o7 |- G' _
  15. * This program is free software; you can redistribute it and/or
    . D9 n* Q6 N1 c- B
  16. * modify it under the terms of the GNU General Public License as* r5 N# V  P* \3 T
  17. * published by the Free Software Foundation version 2.
    " L( D( m9 g, ]. [9 B# p
  18. *% E! \  ~7 Q, h3 s- w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# j* S7 S8 ?* M' r
  20. * kind, whether express or implied; without even the implied warranty' O& [$ \- [0 y; T+ ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( O, ^' Y; b- m9 ?+ F
  22. * GNU General Public License for more details.
    ! }$ Y( `9 B. [1 s  X4 p
  23. */! I' v  Z' T3 M( L
  24. 8 Y  D8 |7 V, b" V( Q! o/ d1 z
  25. #include <linux/module.h>
      B7 q  a. I; s( W! q  o+ G
  26. #include <linux/init.h>! y4 s; |2 @4 S, i# z, o1 k( F" q
  27. #include <linux/errno.h>; J0 E3 B/ f1 @9 H9 J% Z
  28. #include <linux/types.h>
    & q& r) q2 d* @9 x. `4 Z. k, r: ~# w
  29. #include <linux/interrupt.h>
    . m9 f$ y: W. u; C
  30. #include <asm/io.h>4 [! c8 z; Q/ `2 k! R$ c/ K- `) V9 z
  31. #include <linux/moduleparam.h>
    ! Q: b$ u6 Q# I5 K( T. L$ I- d: g, R
  32. #include <linux/sysctl.h>' v8 _' J( l3 a+ o+ p( t$ T
  33. #include <linux/mm.h>; b# j: |& k) M2 I- j  _, H
  34. #include <linux/dma-mapping.h>7 c0 Z! p- C# A/ {/ |6 Q. i7 G
  35. ' `* P" W: A9 H( a% I
  36. #include <mach/memory.h>
    * |: H# I9 \9 X# f, \& U
  37. #include <mach/hardware.h>
    , q/ J! v) V+ T& v9 l( k9 L) D
  38. #include <mach/irqs.h>
    & B3 g* n) O4 p
  39. #include <asm/hardware/edma.h>
    6 b; O- b1 e- Y8 l" V' \
  40. " d/ w7 p6 p. l9 S. W; S
  41. #undef EDMA3_DEBUG& V9 p/ _  z6 t5 f9 ~; |  m& [
  42. /*#define EDMA3_DEBUG*/# A+ z) M) L: a5 e% X
  43. * T+ a( f% d+ x, d5 O4 \
  44. #ifdef EDMA3_DEBUG4 t& u& e3 K6 v4 W2 \& f$ l/ K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 o; p4 f2 {! j' X5 |  N/ E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      k4 N: z  Y$ O& B) m# e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! J0 ^9 R* n1 r& ~
  48. #else
    . h4 U# U: \  v8 K: x" Q& Y( a
  49. #define DMA_PRINTK( x... )' m6 Z, H. k$ a, W& z  r/ ~7 q3 I6 P
  50. #define DMA_FN_IN- p: o7 V3 i2 t: i, x1 P
  51. #define DMA_FN_OUT
    & o2 e% ~& a7 u4 q
  52. #endif- k2 F1 g! g5 `2 K% \" W' q

  53. " \4 h5 }" d& N: h/ F& E2 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ b/ X/ J7 `+ m+ b, S
  55. #define STATIC_SHIFT                3% P( Q. K/ A/ s3 a3 g1 q; n
  56. #define TCINTEN_SHIFT               20
    9 J0 ^. w; r, B
  57. #define ITCINTEN_SHIFT              21
    1 f7 p# ]6 u% H2 s7 P+ _3 s
  58. #define TCCHEN_SHIFT                22
    " Z9 W: ]% Q+ H. T; U
  59. #define ITCCHEN_SHIFT               23& T( T3 N+ g& ^
  60. & z3 t' W1 j2 l+ x* E
  61. static volatile int irqraised1 = 0;: ]" ?6 o5 [" }" ]. N0 o
  62. static volatile int irqraised2 = 0;
    1 B0 H6 c& w6 p7 @9 N

  63. ' y/ I  D5 h1 c. t1 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 s5 m/ [! h2 T6 l/ p( F# e8 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. D, W8 O7 K9 o1 U3 o. ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' W) C& k; q( L* v" f
  67. 2 J* c: m; c; f6 @- |$ e
  68. dma_addr_t dmaphyssrc1 = 0;2 j* ^2 S, F* `
  69. dma_addr_t dmaphyssrc2 = 0;
      K2 L# ~: Y2 d/ n# z0 k# o" |: q7 X
  70. dma_addr_t dmaphysdest1 = 0;/ l3 N5 u1 K7 P% T& L: L- }5 q
  71. dma_addr_t dmaphysdest2 = 0;
    ! m: E- b- W9 b* U3 n2 y! u, j
  72. 5 o5 |. O7 A" E. H
  73. char *dmabufsrc1 = NULL;
    . H% }8 `1 e; |+ m! n& A4 U7 x0 m+ h
  74. char *dmabufsrc2 = NULL;
    ! i8 N2 u- q# J( N& P( Y. f$ e  z
  75. char *dmabufdest1 = NULL;* q1 n2 @- c+ n; q* W, b1 {7 T+ k
  76. char *dmabufdest2 = NULL;
    + w6 }  |& g2 S/ F# q+ ?
  77. ; X5 f  L0 |) X% N# l
  78. static int acnt = 512;  ^) e& F7 N4 M% W3 U* n0 k- ?
  79. static int bcnt = 8;7 K8 t+ }  h& S2 V7 `: l
  80. static int ccnt = 8;
    # b/ ~* E1 Y* G

  81. 1 y7 g/ A* H# e3 e1 S& R
  82. module_param(acnt, int, S_IRUGO);7 i2 q0 ~/ p' z% m
  83. module_param(bcnt, int, S_IRUGO);" K; N) I6 M3 C# a/ @# V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' y& ]) p9 Z& [5 Z2 r& [
, {1 E. B* I/ S; b1 E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' W1 I$ t/ n. b( X* f! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ V6 B0 Y; o4 \- k- f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" n( s2 Q% J% S7 u

9 J; Q" p" Y* R! y4 C& d& ?  Z; J2 [! ?; K& A$ Q8 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 04:40 , Processed in 0.043770 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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