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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ `$ T. Q( o1 N- ?6 ~# e
  1. [code]EDMA sample test application
    ' l8 Z) J8 i5 v' L8 |
  2. /*
    8 K# N: |1 J1 b
  3. * edma_test.c- Q) K' `1 M8 ^
  4. *4 F! M" ]6 T3 m2 g! C" D
  5. * brief  EDMA3 Test Application
      z$ u2 E$ r* \+ l6 p" m3 D. n6 c5 X7 C
  6. *+ e$ [$ k9 |* w& Y7 c/ e
  7. *   This file contains EDMA3 Test code.: L5 e: V% t5 g1 U  h) W( A4 _
  8. *
    6 R' }8 ]* `+ D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 e1 ^  |" [9 l& c- a: n* L0 }1 u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # }) n2 x  z- i3 W# g
  11. *         TO CHANGE.) g0 k- H/ w( a7 k& r% F
  12. *. P9 _9 B: m9 C! \6 M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 u8 g* M% X% U6 N3 t5 X" m
  14. *- a) _( i3 q- C% i; L; g+ }
  15. * This program is free software; you can redistribute it and/or
      t) n1 ~: l+ E
  16. * modify it under the terms of the GNU General Public License as* U( K( t( F* t) L4 _8 I2 m
  17. * published by the Free Software Foundation version 2., E# c2 j" K+ u9 Z8 S/ p3 j
  18. *! [9 C9 I2 @. Z( V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * f6 F, Y7 y; I$ {0 i
  20. * kind, whether express or implied; without even the implied warranty
    4 c6 ]! b7 M5 G. o+ e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - m! g3 g# k7 }1 c9 P3 G
  22. * GNU General Public License for more details.
    # r6 i- J" @" b; p7 L
  23. */" a# [5 G! |9 H! ]3 J" _
  24. 3 n% C9 Q6 n' b! @  Q
  25. #include <linux/module.h>
    6 N" I. f. Q* r1 e4 k
  26. #include <linux/init.h>
    6 o- X$ h9 I- m" P% U6 u
  27. #include <linux/errno.h>/ o% D& V4 ^& h8 |$ s
  28. #include <linux/types.h>
    ) d6 `1 _. m: m1 @! l: m
  29. #include <linux/interrupt.h>* O: K3 Y' x; W
  30. #include <asm/io.h>; J+ H# O9 C9 v
  31. #include <linux/moduleparam.h>$ d6 d, X( ?& |5 i3 E& }5 _- X7 R* m
  32. #include <linux/sysctl.h>
    1 h" l+ Y  }) h- |1 A* |+ U
  33. #include <linux/mm.h>( m! j  m4 m  g* e
  34. #include <linux/dma-mapping.h>& N& i& b& P7 b; E( ~, \3 z2 q1 }; R
  35. & v5 K# l' h) D
  36. #include <mach/memory.h>
    8 L0 i3 j2 S  Z( K; E$ }! e
  37. #include <mach/hardware.h># I% \5 k% B# r+ z" _: a( L6 h
  38. #include <mach/irqs.h>6 i' H7 H9 U& S- @
  39. #include <asm/hardware/edma.h>
    ! _+ _; m7 g* t

  40. . p3 w+ O6 I/ }- e( p
  41. #undef EDMA3_DEBUG
    : C! p) B) [7 t9 l7 o  D* Z
  42. /*#define EDMA3_DEBUG*/+ q5 {  @/ {0 ?/ |% Z# c, f) y

  43. 8 D/ x" p3 L7 I& K, {+ E
  44. #ifdef EDMA3_DEBUG! w4 n" }9 l; g  @3 _0 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* o2 u8 \8 L- ~: y/ B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 `( n: Z" c6 C  N+ S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# {2 h2 Q* b- W( y( R* Y* v/ Q# ^
  48. #else
    ( g  w0 V& k1 Y& o& U
  49. #define DMA_PRINTK( x... )" L( E" t0 R' |. ]
  50. #define DMA_FN_IN$ ^" i+ |( n6 ~9 [8 C, K* M
  51. #define DMA_FN_OUT
    + z* d) l. }0 F) a9 }! m
  52. #endif% a& h7 G& }$ p7 l, T8 I( X
  53. / @6 e2 K* h, ]. ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) k4 s! ]7 p% X6 s: C* R. g2 B1 m
  55. #define STATIC_SHIFT                3
    " E0 B8 e1 G4 q' i8 h' U! e
  56. #define TCINTEN_SHIFT               207 P# ?$ M# h3 {' f: L2 D
  57. #define ITCINTEN_SHIFT              21
    / |: B: _0 n# _3 N9 T& |0 P5 A
  58. #define TCCHEN_SHIFT                22
    5 d- h0 S& v6 f& r
  59. #define ITCCHEN_SHIFT               235 y/ o% F) W) E7 z+ d

  60. 5 p" R5 G  x0 q) Y% |( B$ t
  61. static volatile int irqraised1 = 0;
    : Y1 _9 U; @4 k1 t# ~' D2 |
  62. static volatile int irqraised2 = 0;) I; X% N0 `- L
  63. 5 x7 Q2 ?; Z: s* F- b: |% a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 i: e2 Y9 @$ ~! E2 G8 r  u$ I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * ]* ?* i6 E; |( L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ^+ J( X* V7 X2 i' ]

  67. / `; S, O5 s. o6 S+ n: b1 f
  68. dma_addr_t dmaphyssrc1 = 0;
    & G$ C$ e) _# i2 u8 m6 [9 ?' @5 c
  69. dma_addr_t dmaphyssrc2 = 0;" S( ~" E% I4 ^+ A7 N: a
  70. dma_addr_t dmaphysdest1 = 0;
    . n2 q7 n$ y, R9 J5 ~; t  Q
  71. dma_addr_t dmaphysdest2 = 0;' k+ \% x- e9 J, X) a

  72. 8 Y3 `) G+ j+ \. `9 `' o% o  W
  73. char *dmabufsrc1 = NULL;
    9 C" l. |1 B6 F$ N# l
  74. char *dmabufsrc2 = NULL;
    2 p% n/ z2 c: L8 u  t- {8 }7 ~- U3 P
  75. char *dmabufdest1 = NULL;
    8 Q: u9 @! S4 U3 |& v- @
  76. char *dmabufdest2 = NULL;0 d: Y9 l% t, l" j' R: [

  77. % r" q  C, h3 p( t
  78. static int acnt = 512;# O8 r  o: Q* d* ]9 ?! O
  79. static int bcnt = 8;8 o  g" k) F5 N7 a/ ]1 d
  80. static int ccnt = 8;
    & B% z! l9 f7 X( x2 d! c
  81. ( O/ `9 r  l, c8 F* E1 N7 f
  82. module_param(acnt, int, S_IRUGO);
    1 t) |% ~  I* d9 q
  83. module_param(bcnt, int, S_IRUGO);
    $ I8 h, e. Y7 f6 y7 X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) b7 h4 v+ e, K. V6 |* B3 h
8 P5 y, k  p( U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- N( U) ]) z. K+ L# T9 C* [$ V* Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# z8 @) N  `7 ~  ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) O# G4 a6 S) c7 Y

; C! Z# Y9 V5 r. e" ~- ^* J# V7 V" M7 e( S- J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 19:36 , Processed in 0.036840 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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