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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% F( z" g, g1 a9 m, b# V& g8 [
  1. [code]EDMA sample test application' c# S' N- @8 w+ d! u
  2. /*
    ! v; k& s/ A4 `* _& C9 I( o
  3. * edma_test.c& e& ~& i' `) t) f' Z# a0 w
  4. *
    * Z' N: B6 x1 A1 l' @: q
  5. * brief  EDMA3 Test Application/ m' W, j1 ]2 ^
  6. *- e# b/ {0 ~4 h2 m  m) M) K& `
  7. *   This file contains EDMA3 Test code.
    ( y- j8 k2 i3 _3 h; b  f
  8. *
    4 t8 H& Z' K3 \* |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% h  H1 p( `% g1 b/ f" K2 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 f9 E. q% @: c( b! R0 m! g; t
  11. *         TO CHANGE., K: J- z$ k/ K9 n9 C
  12. *; ]+ h$ N, K& l7 y8 M% `% J5 t1 ~5 }' B5 l* @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 {! M7 C# \! w% k" H
  14. *3 K% m- W, t& I1 d! a, o2 e
  15. * This program is free software; you can redistribute it and/or
    ! _' j9 {2 L7 ^* `/ [  e! y" K
  16. * modify it under the terms of the GNU General Public License as' c/ h8 H6 r+ E- ~
  17. * published by the Free Software Foundation version 2.
    % ^7 T0 X9 r: r& P
  18. *
    3 l$ R9 F# m0 L2 r; @6 m1 W0 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 e$ y3 L/ X# f/ F. @# z
  20. * kind, whether express or implied; without even the implied warranty5 K0 e' E+ [/ [0 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - Z2 L( a( ], f
  22. * GNU General Public License for more details.
    ; s6 H  Z: P& W( B" D
  23. */2 X3 [1 d" B0 E2 T2 }

  24. 1 b9 q0 X9 W9 g9 I- U( k+ ~
  25. #include <linux/module.h>' Z' T% o3 p! t* W# t
  26. #include <linux/init.h>7 g0 ^% p$ P- n$ G, B
  27. #include <linux/errno.h>" m3 Q2 [, |# R& e: C* X
  28. #include <linux/types.h>
      u5 |8 _; m8 B, @/ ^9 L
  29. #include <linux/interrupt.h>
    ( c% a! H3 E+ s- D( [8 x& b8 |
  30. #include <asm/io.h>0 x* p/ Z5 A9 ~$ @
  31. #include <linux/moduleparam.h>
    5 A" r/ Y) v0 S$ F- S9 s
  32. #include <linux/sysctl.h>  u% M0 F' y2 i! B' a; x- X* x* W
  33. #include <linux/mm.h>
    % |5 p0 Y4 L# G7 ]
  34. #include <linux/dma-mapping.h>
    1 Q/ i0 l8 q, @8 l2 B, R9 E
  35. 0 e8 ?! `; q: Z) E4 `* C  Y
  36. #include <mach/memory.h>7 _6 k+ G* |, a
  37. #include <mach/hardware.h># M$ t+ t4 }6 v* O
  38. #include <mach/irqs.h>
    " _0 s) L- \( ^: e4 J9 [" M
  39. #include <asm/hardware/edma.h>
    9 S! b3 [. A0 @# s9 I( C9 X

  40. 3 I# h, A2 j3 K/ s9 V/ O5 E0 q2 z
  41. #undef EDMA3_DEBUG- t9 [- s- p0 o' R5 E0 E
  42. /*#define EDMA3_DEBUG*/
    # h3 D: j8 g8 r+ M
  43. - [! U+ r1 m. r% P" E
  44. #ifdef EDMA3_DEBUG$ f4 z$ _9 G) @) g/ {" Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; q/ _" ]) }0 g1 U9 A! t/ D5 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - D: g; T3 c, k' ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 p, n1 n; j2 F( e1 j( T8 x
  48. #else
    6 G3 b1 n1 }( Z$ Q
  49. #define DMA_PRINTK( x... )
    ( u  J' ?: g* R9 W2 F7 Y: D7 e
  50. #define DMA_FN_IN
    ; ^0 m" X3 s" d9 J
  51. #define DMA_FN_OUT- h8 b0 G1 D. D: [5 m$ G* q
  52. #endif
    % }9 a! ^" ~! l# e$ B% W% T

  53. + C! k3 m- C$ Z& x" `' u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + [# g9 {6 j" {: h) Z
  55. #define STATIC_SHIFT                39 V$ x) j, r5 j7 X9 e' o0 ~: a8 ?
  56. #define TCINTEN_SHIFT               206 K" k* D# q# _6 e: H6 b
  57. #define ITCINTEN_SHIFT              21: i& [  ~7 U1 k/ e; l/ g
  58. #define TCCHEN_SHIFT                22
    3 y$ g& T0 u' s! T3 M, q: T$ H& p0 E
  59. #define ITCCHEN_SHIFT               23
    * {' g' ]; `3 w

  60. ; k' u2 k$ W2 w
  61. static volatile int irqraised1 = 0;
    . z0 c1 F8 W/ ]% f% }. J
  62. static volatile int irqraised2 = 0;
    ! x" r( V! a) q& h$ x5 a
  63. + o) M  _  L# d, j6 T: \% z4 Y% |! j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) P6 U% G! T; ?$ K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& }* s1 W5 Q$ ^! P4 C' R) P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; `. B$ s2 F+ y- _3 a! s

  67. + G; ?# }. O" U* N
  68. dma_addr_t dmaphyssrc1 = 0;. w' g4 M1 L" G* k" }
  69. dma_addr_t dmaphyssrc2 = 0;. {4 Z0 P& I& X9 M1 f1 s3 I6 Z# ]
  70. dma_addr_t dmaphysdest1 = 0;$ g. a" U; |1 g0 S: {
  71. dma_addr_t dmaphysdest2 = 0;
    . v$ {* `. ]  J+ G- e: S

  72. % Q& L% @) u+ a8 e" j9 d5 m( w$ L
  73. char *dmabufsrc1 = NULL;% H) i& w$ _( l% ?$ r; C4 i
  74. char *dmabufsrc2 = NULL;
    2 i2 i2 i  b5 @
  75. char *dmabufdest1 = NULL;  p' i% C$ X% B) w" x7 S0 g9 p
  76. char *dmabufdest2 = NULL;
    2 Q( u: e! _6 Q: B

  77. " a8 }  B  b$ Z; V
  78. static int acnt = 512;4 T8 V7 X4 ?, N5 c. t, |
  79. static int bcnt = 8;% H* a' q: x5 a; \+ |
  80. static int ccnt = 8;
    . I, z& e" ]3 Q
  81. $ [* I: y0 B' t; i' v3 o2 e
  82. module_param(acnt, int, S_IRUGO);! t& k' o& o1 ]- y+ P( A2 C- x
  83. module_param(bcnt, int, S_IRUGO);) B( z. `" ]) m7 Z) [7 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) b1 X, I1 X& t) z/ g6 i" y- J! @6 a/ H! C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 k/ q8 e* P$ m+ E' F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 }2 N" {% q# f5 O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% \: ?$ g5 t# C$ L, N  }$ v' ^
  ]: x, L$ {. @0 C- }/ H. v+ q2 Z" Y3 K- y0 f) M" I' W9 D) U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 20:24 , Processed in 0.041006 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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