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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* {6 Q# Z; [) M
  1. [code]EDMA sample test application
    / U' R( @+ ~/ _& k  g$ z3 }3 C2 V
  2. /*
    4 w) b& B# i" n; E" Y' m% N- s" R
  3. * edma_test.c
    + e% h* {: U! _; w
  4. *
    0 Y* w+ K  x% ?3 s6 W* }( [( N
  5. * brief  EDMA3 Test Application
    5 x9 I9 F, ~0 [  Z& _
  6. *
    7 V( m( c$ u/ ]; q8 o
  7. *   This file contains EDMA3 Test code.
    # s, d6 h2 D& g  `% o% S
  8. *) `) S1 F  x9 Z( T" @& Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ i0 Y, f* s7 v3 w- ?4 a% M: G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # l% V! M% I( G
  11. *         TO CHANGE.1 F8 D, d, |8 P& v2 f: o
  12. *
    $ E$ v/ b' j( e- f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* l; ~3 v7 j: q5 A6 W' Z& n
  14. *
    , s3 O. n% |) m6 z4 {& ?  }
  15. * This program is free software; you can redistribute it and/or$ s5 Y6 q: E( V, y- Q
  16. * modify it under the terms of the GNU General Public License as3 G  ~4 a& q! a1 R- h2 K
  17. * published by the Free Software Foundation version 2.
    : v$ V. y! l7 y, N
  18. *: `- G8 y0 V$ D" |9 |: |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 M+ f/ V! a5 R" i' p+ T) R
  20. * kind, whether express or implied; without even the implied warranty* _) F2 \3 o& [( ^' B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% N0 l# U% ^) r. B7 {
  22. * GNU General Public License for more details.' k! S7 S5 {7 `$ {! G9 M) U' ?
  23. */
    " |( j* Y& w! J8 A1 r$ ~# j4 w
  24.   A" N" m- T: Y  g; s! Q) q
  25. #include <linux/module.h># v  g6 `3 n7 p8 K* z' S; q
  26. #include <linux/init.h>7 p* a) L/ i3 a4 I# V. Y$ V3 E( l
  27. #include <linux/errno.h>
    9 E5 x8 t6 l5 \: T% @
  28. #include <linux/types.h>1 @: W% i: I1 ?2 e' q0 ?1 d
  29. #include <linux/interrupt.h>
    0 A" B& g4 C8 t- @0 k
  30. #include <asm/io.h>% N7 B1 I: @) Z# _
  31. #include <linux/moduleparam.h># d3 ^8 W" N0 C- o) s1 o
  32. #include <linux/sysctl.h>
    , `) d; |" s' ]
  33. #include <linux/mm.h>  N+ X( D" ]6 [  m
  34. #include <linux/dma-mapping.h>0 O, R2 e. m  c) `1 R4 l
  35. - ]  w8 U5 H7 M% a. S- }+ G" g/ f
  36. #include <mach/memory.h>
    ( \$ R. s$ J% ]
  37. #include <mach/hardware.h>
    2 W4 U& g  N9 I- N
  38. #include <mach/irqs.h>
    : {4 q, Q6 j, P
  39. #include <asm/hardware/edma.h>
    2 X) T* J8 A# ?# c# T' J" ~( ?2 w

  40. . y; }7 v+ A' `: E# W' E. b+ p- t
  41. #undef EDMA3_DEBUG% T; R  ~) I, C9 S- j
  42. /*#define EDMA3_DEBUG*/
    # a9 z* j: X' m# {0 J: b

  43. 4 C, C, x6 `1 x8 F0 E8 p; ?
  44. #ifdef EDMA3_DEBUG
    , X8 y. H8 K0 Y: ]+ L% Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! C) U0 t. e, c) c8 Q, t1 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): [! Q$ ~# ^) t, f' J' l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : Z5 Q- F- p! R1 O, @( Z. L) e
  48. #else
    1 f( _6 d3 g& v4 D' R( K
  49. #define DMA_PRINTK( x... )% Y5 J/ Z4 d1 q# e4 S4 k$ x
  50. #define DMA_FN_IN  u. x: j1 Y; B4 ~! L( t
  51. #define DMA_FN_OUT* v" @: f0 X! c) C6 W; V
  52. #endif) h! E0 C$ I" f, @5 q

  53. ' r/ G3 y' y5 x/ \, D6 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( i3 T7 A- m4 D1 m$ _
  55. #define STATIC_SHIFT                3
    , L* x2 K% E6 ~, {/ b/ q) b; E% }% c
  56. #define TCINTEN_SHIFT               20. Q0 v5 N$ f7 T/ t8 \' E
  57. #define ITCINTEN_SHIFT              21
    9 ?) T. T! G4 i# k
  58. #define TCCHEN_SHIFT                22
    ' F- z2 D  K* ~5 Z! B
  59. #define ITCCHEN_SHIFT               238 e9 ^2 Q- [1 z$ A7 U
  60. % c+ A0 C% M7 i0 g5 H% d
  61. static volatile int irqraised1 = 0;
    7 C& x1 S  J3 \$ T
  62. static volatile int irqraised2 = 0;2 _# y3 A; a+ ~* q5 x1 w8 A
  63. 5 \) H) G* q1 k6 w! g; T. ?- L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& A, u5 Y1 ?- ~1 r' E5 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 E# W9 X( h1 A2 U+ F* Y0 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 g- ?4 L4 E# t. U

  67. % P0 |  R% z+ V) X/ P* j
  68. dma_addr_t dmaphyssrc1 = 0;) Y" k4 d' u( L, H" k, Z* ?
  69. dma_addr_t dmaphyssrc2 = 0;  ]& G; ]7 h' B: Z4 b& G, F# E
  70. dma_addr_t dmaphysdest1 = 0;8 f& I/ p. x9 k- S1 J! m  n
  71. dma_addr_t dmaphysdest2 = 0;
    # f7 X- T" q4 y; t9 }9 m
  72. 0 u$ w$ r5 z% q  K4 ~$ h6 \
  73. char *dmabufsrc1 = NULL;5 `; d4 ^. m) A6 ]$ A( b
  74. char *dmabufsrc2 = NULL;6 x$ a0 O% B% r4 N$ a" A5 F- P3 I
  75. char *dmabufdest1 = NULL;
    : W" @6 W, q/ `/ l
  76. char *dmabufdest2 = NULL;
    1 C/ x6 M9 N3 X+ E, N
  77. # ^& P7 W7 c  J/ E9 e
  78. static int acnt = 512;
    * B  T) C9 C1 p' U  U- v  ^
  79. static int bcnt = 8;
    ' B5 n; s' h, l, o! k. f! B
  80. static int ccnt = 8;' _5 V4 X" w; N& S( o
  81. ' \! \0 H% y: g, C* e. G
  82. module_param(acnt, int, S_IRUGO);
    + Q4 O& u; o1 s7 s( o  U8 M) y
  83. module_param(bcnt, int, S_IRUGO);
    7 _- x& k6 G! l; Y8 [( p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 n- L7 `# U+ g7 D0 ~
' @7 f' r' B2 c$ L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ X# T" @1 }1 a5 s; X' }4 T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: j  Q. i  j4 l4 z8 [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; Z3 F- C! g$ F5 Y

/ N  l  l$ X' a* m! U& x
3 S4 {" ?; w+ L9 Y5 T' o6 B2 |4 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 18:39 , Processed in 0.040915 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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