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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & z, q# w1 ]* u8 `8 [6 F
  1. [code]EDMA sample test application, x$ l7 l5 S; f1 E/ X4 D" w. V' I
  2. /*
    % b, {6 S9 j8 v" Z. n- h3 A
  3. * edma_test.c
    ; `0 @- U+ n8 _1 x9 G" G: o
  4. *
    7 B; k0 d: l+ S# P
  5. * brief  EDMA3 Test Application) F7 c3 d  Y2 i7 e
  6. *4 {( c9 P: M5 Q2 r: I* H" X% L" U
  7. *   This file contains EDMA3 Test code.5 R0 }4 j: Y. W8 x8 {/ S
  8. *
    6 z+ [7 b( E3 L% h" \$ Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ u# ^3 q4 J+ c' _0 X( w" }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 d) }3 v, s3 M' N" @
  11. *         TO CHANGE.
    % [4 M) r6 A# ^; O5 {
  12. *- }6 ~9 a' c4 d: ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / s/ ^! R1 |! e$ T
  14. *; A( U9 W. V' U0 N) y. C
  15. * This program is free software; you can redistribute it and/or( Q) n% T' Z( @
  16. * modify it under the terms of the GNU General Public License as- E/ R. g: h* G
  17. * published by the Free Software Foundation version 2.
    ) i7 K  t. E& ]' R" L$ D2 s
  18. *
    8 z1 a/ j( {( `4 v$ d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 p1 }- e* f( K5 n
  20. * kind, whether express or implied; without even the implied warranty$ y+ {6 O% X' @+ E1 ~! C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      P/ K9 x; E8 z! \; }# Z% D
  22. * GNU General Public License for more details.# J+ c$ k  V( ^/ S7 @9 Q+ H7 s, D
  23. */% S3 b* H  j" A$ n% k8 w" N
  24. " A. X3 D& D# m6 {
  25. #include <linux/module.h>1 e& V) B  I0 {+ n( o" N6 @
  26. #include <linux/init.h>
    3 h; U/ L5 |- |" Z
  27. #include <linux/errno.h>
    1 c% d. s1 ?2 H5 S& b
  28. #include <linux/types.h>4 x( s  H! n% G! i4 }
  29. #include <linux/interrupt.h>: c  R4 Y5 N& n& s3 D0 E8 n# R5 ]
  30. #include <asm/io.h>1 X1 ], A8 {2 x* q
  31. #include <linux/moduleparam.h>. c: z) U7 `$ s1 M4 N
  32. #include <linux/sysctl.h>7 M$ u8 o+ h! T6 a- W
  33. #include <linux/mm.h>
    2 D! Z5 X: s6 h% q8 d4 d
  34. #include <linux/dma-mapping.h>' D6 b, @% i  k& l$ X, p( o" Z

  35. . `. S0 ]0 Q% w
  36. #include <mach/memory.h>
    9 _' t8 B/ |: Z
  37. #include <mach/hardware.h>& n5 U8 |0 f" `$ D5 \
  38. #include <mach/irqs.h>. ~' E( l8 I7 d& c
  39. #include <asm/hardware/edma.h>" j2 i7 D! m8 s! B9 m# J
  40. % c% n9 W; d7 @! j2 N
  41. #undef EDMA3_DEBUG5 V' o" K$ T5 Z8 m+ Y
  42. /*#define EDMA3_DEBUG*/& F4 e. f3 i& {% H. U/ A
  43. % A# B; l( X9 M5 P+ A- }& k& h4 z
  44. #ifdef EDMA3_DEBUG
    % N4 p: b5 a* U7 W8 u; S* O% j, }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / `7 M8 x+ s' x* w7 o: v+ q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 Q+ F# X4 q, Q1 D8 _# }$ W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # I6 S5 h" J3 [: j6 S; L
  48. #else1 a  l6 [. S/ A9 z5 R: d% n" T, j- N! {
  49. #define DMA_PRINTK( x... ): y8 ]; o0 C- `. ]- n4 b4 R3 u$ V: |
  50. #define DMA_FN_IN
    ! \: `/ {7 ^, I% [
  51. #define DMA_FN_OUT
    " k. F3 ~4 H3 J2 G
  52. #endif. t7 a; i! G# F" ?; T
  53. ; R; y1 I7 @6 c& }  s$ D6 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* T1 e& i4 U: R; ]
  55. #define STATIC_SHIFT                3
    : ]; ~; x$ ~4 ]6 T
  56. #define TCINTEN_SHIFT               20/ I: k$ z" m6 p  C" ~4 e- v+ x
  57. #define ITCINTEN_SHIFT              21
      F: f. t% \& y8 k
  58. #define TCCHEN_SHIFT                22
    , R; p& q! I" |
  59. #define ITCCHEN_SHIFT               23( a1 K9 H  u2 M6 {+ a
  60. 4 @; T- \* c( {, B: a* v. }- \% M5 N
  61. static volatile int irqraised1 = 0;8 q% K, ^- Z4 h# O
  62. static volatile int irqraised2 = 0;# m4 i9 A; u7 P* K. Z) L/ K) Y

  63. ) x% q, t. u0 i% A- u3 I/ ]/ Y  b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . a9 p2 Q& n6 M" z; ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / F* ]6 s2 \! o) T: i2 `$ \2 P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  }3 n+ w1 I# G% p4 q

  67. # {) R* W; \; X" u. t. }4 S# H
  68. dma_addr_t dmaphyssrc1 = 0;
    / [) r, Q) }0 G# I/ D) _: j3 c! E
  69. dma_addr_t dmaphyssrc2 = 0;
    / V/ m; w9 V% g$ N5 U; M
  70. dma_addr_t dmaphysdest1 = 0;1 X8 q! m9 F4 D0 b& Q' _
  71. dma_addr_t dmaphysdest2 = 0;' b7 U6 A8 G. z4 A. q

  72. ) r6 q% H+ g3 ?! X6 _8 S5 G
  73. char *dmabufsrc1 = NULL;
    # ]5 b5 e! f5 a  D- I
  74. char *dmabufsrc2 = NULL;
    * p6 ~* m+ Z8 K* f3 C( q
  75. char *dmabufdest1 = NULL;; m6 Z: Y( I( b- m3 d* x( \
  76. char *dmabufdest2 = NULL;5 R' O3 }4 z" n) x# ?/ J) g

  77. 4 O/ e5 I# p1 q7 f8 W) e, `
  78. static int acnt = 512;, T8 r% v% l; |/ S5 k( Z
  79. static int bcnt = 8;
    # x' Q4 k0 }, C
  80. static int ccnt = 8;$ s' T" m" `% _5 U$ M" f9 C

  81. ; F9 x* g  J! P' Z! L9 M+ ^# Z
  82. module_param(acnt, int, S_IRUGO);5 M  n3 Q) h$ n+ d8 E: o: D! Q
  83. module_param(bcnt, int, S_IRUGO);
    . Y$ H. W, P3 ~" g' K# W0 V# w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 h% D4 N! _3 z) ]
2 Z. Z: y/ f* O# w, Y1 ?# T  k: |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 i* E8 b" Z- u; d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. I9 f" O; `, G$ ]9 E! B- @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  r5 ^" q/ l: p. n) s2 a

. t/ j5 p# J4 N' a1 J. F3 ~$ ?; }, X5 g& u% [( a4 O5 q. b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 04:02 , Processed in 0.038871 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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