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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 y/ b1 G/ R4 @5 P- n: b# F
  1. [code]EDMA sample test application# }& c  W: S' b1 M3 [
  2. /*" E( ?( P) Z) X; Z5 u6 U0 Y8 _
  3. * edma_test.c
    ' S6 |9 u" e9 @6 k( Q' U6 Y
  4. *
    4 c& S3 B- s/ q3 U; V, Y! L
  5. * brief  EDMA3 Test Application
    : O- j4 C2 R* l6 X' W: `9 z
  6. *7 P* V3 z! }- l
  7. *   This file contains EDMA3 Test code.: `7 V$ r6 O& m0 r) ~" X
  8. *
    0 c- _9 Y& {6 O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + M5 i2 i& V. h+ A; h7 n( M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * L( b7 R6 p: e: V
  11. *         TO CHANGE.: j- k: g( }! S6 @+ \9 l$ W
  12. *& [  R! |4 ~4 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' C3 d" h* q2 ^5 Q+ C
  14. ** z; G! P! }5 l7 i% c# i
  15. * This program is free software; you can redistribute it and/or  `0 Q- Y9 j: w5 k5 i
  16. * modify it under the terms of the GNU General Public License as
    ( p' C+ l! V" g5 y
  17. * published by the Free Software Foundation version 2.' Q; z3 T( q1 D7 w) i
  18. *' k2 y) q: ?8 Z! ^" W4 L+ C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " `# t+ b& r7 Q
  20. * kind, whether express or implied; without even the implied warranty; z: O+ n+ K' z( O% q! a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) ^% z: h0 e2 j  E# `1 a
  22. * GNU General Public License for more details.
    $ s9 `; _* Q7 W% B) X5 H. Q
  23. */
    % z1 v8 }4 m3 C( d

  24. ) B- A# r" j! K) {1 s
  25. #include <linux/module.h>
    1 @7 w! I$ \4 g
  26. #include <linux/init.h>
    9 g. e1 K7 t% a9 E) i/ {& Y
  27. #include <linux/errno.h>
    5 A2 O0 v6 E1 Q& p. }
  28. #include <linux/types.h>1 `/ E, b3 M* `6 X2 ~% C: K
  29. #include <linux/interrupt.h>
    " ~: p* n, y5 c+ c2 `. ?
  30. #include <asm/io.h>
    0 _: }% Q7 A: B: {8 |! r; N5 [
  31. #include <linux/moduleparam.h>5 M# d9 z$ W2 {$ p/ {# H; T
  32. #include <linux/sysctl.h>4 m& ?7 n1 z+ k3 y% I% }1 ]* k
  33. #include <linux/mm.h>
    2 |1 R8 A! I* P' M8 Z8 Z
  34. #include <linux/dma-mapping.h>
    7 ]8 j# U& x) \  Z- ?# L

  35. : t+ z, k- f, t1 O+ |9 f
  36. #include <mach/memory.h>8 ^/ o( i! d+ A: u" H
  37. #include <mach/hardware.h>
    0 s. T# L- a& v: h1 K7 C
  38. #include <mach/irqs.h>( U/ h1 _4 P: T* S2 x
  39. #include <asm/hardware/edma.h>
    ' B# n! @3 K+ I. J+ V7 i
  40. + G& N8 O7 s) \! l6 Y, i
  41. #undef EDMA3_DEBUG
    3 d! r. i; D% r
  42. /*#define EDMA3_DEBUG*/
    ( y, T" _' e/ a1 \7 b
  43. ( s/ u/ _$ S+ v2 D5 I, L) b
  44. #ifdef EDMA3_DEBUG
    9 J6 T5 _6 B0 D7 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 p0 V& I# J9 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( L2 k! Q4 `$ J: H% I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / ]  P7 O# p9 N% M/ L5 d' f' `- B  l
  48. #else
    $ r. G( S" W- C# \% [7 B/ U3 H
  49. #define DMA_PRINTK( x... )) I# y! Y- L/ j
  50. #define DMA_FN_IN
    - A4 w8 n# a5 h
  51. #define DMA_FN_OUT- m; U& i1 L8 q7 Z
  52. #endif
    $ i: ?& O5 b4 o5 o! b
  53. ! n: Y$ [+ V/ j4 {% ~  @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  m, n! g( c* x% j6 V9 _7 T
  55. #define STATIC_SHIFT                36 j" _$ ^: d& p+ T. e
  56. #define TCINTEN_SHIFT               20
    6 S, P9 {" w( k4 ^0 o$ Y8 R
  57. #define ITCINTEN_SHIFT              21/ h& J7 ]3 O; v; P1 |) c4 P
  58. #define TCCHEN_SHIFT                22
    " {( N+ N) u1 }
  59. #define ITCCHEN_SHIFT               23
    2 R2 S7 C' P* b" V: b

  60. & y1 Z/ w; t- [- a$ U# h2 h
  61. static volatile int irqraised1 = 0;
    / D& f9 E' U( H9 d( m2 k3 c0 }5 C6 ~  ~
  62. static volatile int irqraised2 = 0;
    1 N  P; Y$ c0 ]( v& [% C; W! t, \; Y

  63. ; M8 D1 c- l& W4 Z" |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! u& Q. ]8 ]. y5 e/ `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % D/ J' s' \4 {3 x* P1 T& i* U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, C+ ~: t8 ^# `' f& l+ j' ?- a, ]" }  A

  67. 7 j4 Z' @% a3 o5 g+ X8 d
  68. dma_addr_t dmaphyssrc1 = 0;! u% V, _. H; t( x3 R- Q# x
  69. dma_addr_t dmaphyssrc2 = 0;
    $ w- [9 R& X" l1 T/ i! s
  70. dma_addr_t dmaphysdest1 = 0;! m$ L/ Q2 p4 b' x8 A# ^8 `- O
  71. dma_addr_t dmaphysdest2 = 0;
    - `4 M. R+ Z/ [: i) |
  72. 4 U6 q, A) }! w9 ]. N# o6 z
  73. char *dmabufsrc1 = NULL;
    ! @! ?- ^1 @" {  o& z; [; Y
  74. char *dmabufsrc2 = NULL;
    4 h1 Q( ~% M5 N' B. o5 E! Q: k
  75. char *dmabufdest1 = NULL;8 L5 Z, E2 k/ d
  76. char *dmabufdest2 = NULL;
    + b. d  v) [/ Y8 X- x

  77. & P+ T  a3 I- y
  78. static int acnt = 512;
    8 _- ?* J  n5 ?
  79. static int bcnt = 8;
    7 W4 C- T! B! e7 M9 a
  80. static int ccnt = 8;
    & [. b7 V$ s: E, o, R8 P

  81. 6 d! Z6 n5 I& s% v
  82. module_param(acnt, int, S_IRUGO);
    ) e6 Q' v+ A- p1 \$ R
  83. module_param(bcnt, int, S_IRUGO);
    & o" z( S0 g% m$ \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) H5 r/ \5 x1 u
! q7 f# j) ?+ |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. f. G- G' |# I7 Aarm-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 p  e0 v& W- k$ |: b7 \: R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 a6 c! c/ Y) {. T) `8 I
- J; B* s4 R, u" ~, ^! x
3 Q5 [7 ?& @9 A# V5 Z$ o2 m) l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 22:03 , Processed in 0.039840 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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