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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + t7 p0 t: w0 _# h! A
  1. [code]EDMA sample test application
    0 ~3 |) \& }; n  }4 m' l
  2. /*2 Q2 ^4 C% y/ `$ N3 k+ m- S* x3 q
  3. * edma_test.c
    8 r0 ^8 _4 p$ w# J; |3 F, k5 m6 {
  4. *5 ?8 ?0 O1 J6 ]7 g( h
  5. * brief  EDMA3 Test Application3 o; B: c1 p  ]- T6 f8 h
  6. *
    2 r5 x1 ]- y$ d% p
  7. *   This file contains EDMA3 Test code.
    2 D/ E* N" Z0 h# p& E
  8. *
    5 N* F* f. J# e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 p  L. J' w8 N" C; Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 \' Y) C) o* i
  11. *         TO CHANGE.
    9 c. K7 F. y; _+ x: J8 ~, G5 H
  12. *, K% o$ o5 N& ~' u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ l1 m# S6 o7 C8 H" R1 I4 a  [
  14. *2 i9 O5 K: S+ J* F
  15. * This program is free software; you can redistribute it and/or
    7 A& j5 _3 j5 X# l$ o. z& |( f
  16. * modify it under the terms of the GNU General Public License as
    6 o2 l  |* F2 S1 G# O) n
  17. * published by the Free Software Foundation version 2.
    7 Q" H, Z$ K/ Q; v: w$ {
  18. *
    2 |& {8 b3 N- U& ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 o$ X0 L  _* |: F; [  T
  20. * kind, whether express or implied; without even the implied warranty
    / o' f- V! x1 l- i) T6 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " {: v; V9 @8 M7 P) ?* g
  22. * GNU General Public License for more details.% D: x2 ^1 B- k
  23. */
    # Y6 c# L3 F0 k' t2 K
  24. " A5 G) p1 Q* l2 e0 y0 R, F
  25. #include <linux/module.h>5 {2 {; r. S& ]  j" x3 k4 ~# D0 R
  26. #include <linux/init.h>8 b# j2 p0 U3 I! |7 [/ y
  27. #include <linux/errno.h>
    ) {" E5 D$ H4 @6 N0 Y
  28. #include <linux/types.h>
    8 T5 M, J2 t1 O8 |! X1 V, L+ K2 H, J
  29. #include <linux/interrupt.h>: y# F7 b& K$ ?
  30. #include <asm/io.h>7 M9 s, W- g( U
  31. #include <linux/moduleparam.h>$ y2 f( K8 c% G/ T3 W
  32. #include <linux/sysctl.h>. R$ D3 v$ x! }4 f$ A8 l
  33. #include <linux/mm.h>/ _% h8 ~* a! [& c& [
  34. #include <linux/dma-mapping.h>* M$ [. Z9 M4 C. d* W  L" e1 r
  35. ! U- |5 l0 ?% m" s; y
  36. #include <mach/memory.h>
    ! l9 \  g; ]( Y7 h2 q
  37. #include <mach/hardware.h>
    + d1 p. ]. e9 ?) a; }& ^
  38. #include <mach/irqs.h>
    & ^! _. o9 S& m  X+ n4 D/ _3 K
  39. #include <asm/hardware/edma.h>
    / b' W, @* |( @4 N+ L
  40. 8 J- h( D; c. P
  41. #undef EDMA3_DEBUG
    1 j. L! l) ~: Y9 Z
  42. /*#define EDMA3_DEBUG*/
    " ^7 F( c- G- w: B4 z& U
  43. . q! _9 t6 ]3 H8 |$ c/ m/ W, x
  44. #ifdef EDMA3_DEBUG0 G- {& v/ H- M8 w- H3 m7 o/ e5 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  i* h4 N" i- d+ x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # K0 a3 m& K( N& a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + D# t3 Y! k& r
  48. #else' e; R9 q* n+ U7 H9 P
  49. #define DMA_PRINTK( x... )
      ]9 [9 q- f% w$ D
  50. #define DMA_FN_IN4 l. k5 j) c; l, X0 N- F* M5 I
  51. #define DMA_FN_OUT
    : X# W) y9 [$ t& U- c, V
  52. #endif
    , H+ h- Y) |" T8 t

  53. 8 [5 n' V% q8 }- B5 E2 Y# O+ {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , c. x5 Y: n" t# m. i
  55. #define STATIC_SHIFT                3
    * p4 k- F9 }# G( O: S  H+ Z
  56. #define TCINTEN_SHIFT               20
    . `+ ]2 |7 C: k" K
  57. #define ITCINTEN_SHIFT              21
    * r  S2 g6 o/ T
  58. #define TCCHEN_SHIFT                22
    " g% Q5 X1 K( {! s
  59. #define ITCCHEN_SHIFT               23+ b, I8 w9 c3 @0 p

  60. * s! d/ D* N2 U7 a, ~6 m0 U
  61. static volatile int irqraised1 = 0;8 m- u/ m8 R# w! x
  62. static volatile int irqraised2 = 0;, y8 P$ V5 F: l, n8 R

  63. 9 z' X2 m6 I' r2 Z! L9 e. h; C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( M% ?1 G+ Z  f8 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 m8 a* I+ I2 A8 `/ d' ~$ O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      u7 [' k+ d; k

  67. " R7 J6 ?0 N& e- P( K
  68. dma_addr_t dmaphyssrc1 = 0;
    7 F; r0 P5 E& k4 T& ?
  69. dma_addr_t dmaphyssrc2 = 0;5 Q: u9 l! W, i
  70. dma_addr_t dmaphysdest1 = 0;( x& Y. ]& L2 q. }
  71. dma_addr_t dmaphysdest2 = 0;
    * ^+ a3 K3 r: E3 t) w% F3 t# _% d. Z1 g

  72. 7 ?2 i" Q+ t6 D) L! u2 p+ _$ ^
  73. char *dmabufsrc1 = NULL;
    + @; g# u  v4 H! h- y( F6 q
  74. char *dmabufsrc2 = NULL;' p: y  `4 ]- K) P% K; v
  75. char *dmabufdest1 = NULL;
    8 M# a4 W& E- i5 U( j
  76. char *dmabufdest2 = NULL;! k  [. Z" X' J" i9 Y
  77. $ X0 Z+ p$ _' t
  78. static int acnt = 512;- u: e* X* ~0 n1 [
  79. static int bcnt = 8;( y& `! C% ^4 q- E. ~7 N
  80. static int ccnt = 8;6 n: p2 S" J" L

  81. , W0 L3 i! y2 h; ]# X
  82. module_param(acnt, int, S_IRUGO);
    $ X5 r' E; _/ H+ N
  83. module_param(bcnt, int, S_IRUGO);( Y8 L6 Z$ _; b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 j9 U  Z* \8 N5 u8 _

# W0 r. Q$ d7 @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 ~' ~% r2 l. `1 x! }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 i+ P/ Y$ P/ b7 E# f6 D, Q4 r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! x" u8 H$ C# Z% h9 L

6 \0 ^* i/ T( {! X' f; N0 {3 N) t* h. S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-9 18:55 , Processed in 0.036855 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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