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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 g; j/ |8 e# {3 K- R' G/ S* T
  1. [code]EDMA sample test application
    ) {+ z; M0 o* b3 n4 @
  2. /*
    $ u; U& r1 S7 q) F
  3. * edma_test.c
    : A0 A1 w( G. S% v! T
  4. *
      F4 P' ?6 S1 y
  5. * brief  EDMA3 Test Application5 W' ^8 F7 o! s- t% f* V: P- i
  6. *7 w8 N1 i0 g& d/ R* d
  7. *   This file contains EDMA3 Test code.! ]3 c7 O. b2 e
  8. *
    6 ^' P  g$ Z* Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , I& p! I# R' n! r  o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 F2 L# F$ B* R' G% q; G& j, J3 e6 k4 g
  11. *         TO CHANGE.
    5 n6 k4 y; ?- K& J+ [5 G0 }6 ?
  12. *$ i* p8 P; f4 T1 i1 T2 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 H2 t! o# m( L7 C
  14. *' h9 W2 I' k/ l, A
  15. * This program is free software; you can redistribute it and/or
    & n- H% G. g( a, J5 @1 I0 D
  16. * modify it under the terms of the GNU General Public License as, {% B; g2 A) F
  17. * published by the Free Software Foundation version 2.
    $ K% K. m& U8 l. ]. `3 p
  18. *2 R$ S( \% y  Y8 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 ~' p( I0 X% N( Z  x4 i5 d6 p
  20. * kind, whether express or implied; without even the implied warranty2 a/ H4 O' z; X% k. z6 H0 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 E! U; M- n' m
  22. * GNU General Public License for more details.
    ; H0 I0 N, u; R# F, R2 |) e
  23. */6 ]1 B; e5 t2 j% F5 u5 }1 T
  24. 2 w- \! `" Y0 ?, [/ [
  25. #include <linux/module.h>
      f2 E, p8 C/ V( D5 L
  26. #include <linux/init.h>
    3 P7 E  z! [: G
  27. #include <linux/errno.h>
    9 t7 Q) z! R! U3 e0 u# Y; G
  28. #include <linux/types.h>
    2 N0 K# f# j; ?* B& x6 z3 H3 `; s. w
  29. #include <linux/interrupt.h>8 ^4 i9 M4 t+ w5 @0 i( j  X
  30. #include <asm/io.h>
    " ]  p' g  x! V) o* P/ x
  31. #include <linux/moduleparam.h>
    ; o! ~+ i. ^  F+ Z
  32. #include <linux/sysctl.h>
    + z( N! D* h. B7 w% b! h
  33. #include <linux/mm.h>0 A" H" b$ Q* T
  34. #include <linux/dma-mapping.h>
    8 Z+ B# J2 Z6 b( o

  35. ; P  N, {$ X+ U
  36. #include <mach/memory.h>
    8 ?$ T/ \" U# H2 G% P# m- u5 E
  37. #include <mach/hardware.h>+ i9 P% X. u& t& w& f# o1 F
  38. #include <mach/irqs.h>3 ?4 h; p- J9 h6 h% b
  39. #include <asm/hardware/edma.h>
    . K! q% [3 D9 O# z7 ^7 T

  40. % @0 F/ k$ G- r* |, C0 E( D& ]
  41. #undef EDMA3_DEBUG1 M9 U6 D% j& x. b. S6 F
  42. /*#define EDMA3_DEBUG*/
    3 ~6 k4 p1 h8 d  z( l; }

  43. ) A5 k- q' `6 p  a: s  @
  44. #ifdef EDMA3_DEBUG; _7 p0 A9 O2 l* ^0 K, E( t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # D+ _9 C6 V, Y1 V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 q! l) X5 j1 u7 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , A; D5 z2 J; W- C; u
  48. #else
    ' H6 `; x: q, ?
  49. #define DMA_PRINTK( x... )
    . [( T! j  |: U% Q! Y. H: E
  50. #define DMA_FN_IN
    # [3 x  m1 ]+ V5 ?+ @% y7 U
  51. #define DMA_FN_OUT
    ) Z+ Z+ |& Y* ]4 L& ^% V
  52. #endif: W% h) h& E1 _- s
  53. 1 o/ G- Y! G0 H9 d2 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 W: `: b/ C5 }& j+ ~6 S; T
  55. #define STATIC_SHIFT                3- E' k7 O: K+ v7 \
  56. #define TCINTEN_SHIFT               205 R4 r  k) O4 f
  57. #define ITCINTEN_SHIFT              21  M- u$ P5 j" `+ L
  58. #define TCCHEN_SHIFT                22
    7 U& m# c6 s2 y
  59. #define ITCCHEN_SHIFT               235 }6 \7 B* W. V  E$ X& @
  60. 9 J1 F) |3 q2 a1 ?# O, L! o# e6 R
  61. static volatile int irqraised1 = 0;
    , w" b$ h( u5 K; w9 J8 d
  62. static volatile int irqraised2 = 0;4 g0 _0 I& V: y& B) S- u# Z

  63. 4 h/ V% H4 r& k* X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! C# o4 U0 x6 C3 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & F9 [( K0 V. P( o, s1 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & j7 \# ?0 P' F1 k

  67. : ]' d0 {( x4 t1 l1 t! _) v
  68. dma_addr_t dmaphyssrc1 = 0;
    9 t/ t. l' Y% ~" H9 F
  69. dma_addr_t dmaphyssrc2 = 0;
    ) G! ]; h* ^+ s
  70. dma_addr_t dmaphysdest1 = 0;5 J* I* O, r# l& q: v9 p; ^
  71. dma_addr_t dmaphysdest2 = 0;
    + g$ _) B  R8 o7 X' o& I+ G
  72. 4 r$ m5 o" g$ S( M# |
  73. char *dmabufsrc1 = NULL;2 C2 [2 O& L( c+ u8 D1 _  Z5 P# v8 x# a
  74. char *dmabufsrc2 = NULL;
    , u" |9 ?- i9 U: J7 B( X
  75. char *dmabufdest1 = NULL;
    9 _* }# U7 [: m, S7 `
  76. char *dmabufdest2 = NULL;
    6 r% W3 ]% v' g. k1 m1 D8 l

  77. / x4 U( r  l2 ^$ f  P
  78. static int acnt = 512;! i9 I! a' Y/ L5 w
  79. static int bcnt = 8;
      }) q' ~7 {+ j: _8 y- r+ R
  80. static int ccnt = 8;
    . e7 ]# J2 v7 o9 p3 q, Z) A/ q" B; n
  81. % Y6 }, K3 ~1 W7 x% ^: [2 T
  82. module_param(acnt, int, S_IRUGO);
    5 b+ H. u9 D/ j$ j7 e2 y+ t
  83. module_param(bcnt, int, S_IRUGO);3 d+ Q% B% y% C2 }+ U! C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 ?( C! H; {- J) E1 |. ^( `
, F' U+ c+ p3 C1 ~7 N. A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) c$ ^5 W. E4 v% k+ k% w  y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 I# O! s+ B+ c5 @2 A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- U5 j  U8 _2 P) [; ?  B* R4 K4 M& p& m# G1 n

7 m. G) Z1 g2 U- B; f  `' b& J$ C2 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 00:35 , Processed in 0.038052 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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