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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 e1 E* v0 e$ W$ [# O6 d& }" z
  1. [code]EDMA sample test application5 G' q2 m3 H) }+ A6 r
  2. /*
    # I. s. N: B) ^4 y* n
  3. * edma_test.c$ i, A  q/ ]7 [6 ]6 O: h5 A! N
  4. *
    ; ^; s/ i( Q* Y# f
  5. * brief  EDMA3 Test Application& Z5 E$ b7 K: l; Q" m
  6. *
    8 H7 m- ^! ?5 m( T
  7. *   This file contains EDMA3 Test code.8 _7 [4 G4 O. D$ q  }# p2 H8 G
  8. *9 K& f# u0 j( D# c$ ?4 O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 I3 S8 p) D- q3 y: K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 {$ [  X# K2 {, |5 [, c" H0 f& L
  11. *         TO CHANGE.
    % r% q, P- R! I8 k$ ]
  12. *
    7 {! x4 F4 Q0 w- W- g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , C/ v+ _* k3 s! n" o
  14. *  t% C% M4 g& A, E/ I
  15. * This program is free software; you can redistribute it and/or( w; H6 r# I( h5 z  a
  16. * modify it under the terms of the GNU General Public License as
    7 @  ~: ~2 j: V9 @9 ]# C
  17. * published by the Free Software Foundation version 2.( Z# D6 L: O$ ^# k8 y$ ^3 s
  18. *
    * o' X0 H9 M- ]1 v* f* O6 Y! |7 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! v7 N( p; ?% Z6 e  c
  20. * kind, whether express or implied; without even the implied warranty5 [1 U0 }( n# h/ F& k8 f9 v8 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: Y+ p3 w# |' B
  22. * GNU General Public License for more details.) N# }% W2 I2 _) [% ?+ t$ V
  23. */
    ! @" z$ J. U5 @% [6 b& |3 l4 R
  24. % A4 P2 f9 f7 T2 N0 j. c0 L
  25. #include <linux/module.h>) p+ c- K4 _: Q  Q3 [# e
  26. #include <linux/init.h>: }; ]5 V) G5 R. ~* l/ A/ R
  27. #include <linux/errno.h>% F6 G2 u! ?2 u+ n( D1 w
  28. #include <linux/types.h>5 f+ X+ C1 |: j; p
  29. #include <linux/interrupt.h>
    8 Z: M+ p# m$ r2 C# }( y
  30. #include <asm/io.h>
    + m- ]) T: ]7 @  `: z. S2 h) H  e
  31. #include <linux/moduleparam.h>
    ( V" P0 \' D( y" y
  32. #include <linux/sysctl.h>
    # t: N7 V4 s- D
  33. #include <linux/mm.h>9 E! B9 f% ^9 d+ B! D% ], f# f
  34. #include <linux/dma-mapping.h>
    ( }: G6 O' l9 N% n" H/ |; M+ G0 D/ F
  35. . ~. ?! Q! B3 \1 ]6 e
  36. #include <mach/memory.h>
    8 r, m7 t4 u6 w0 c: q" q$ b- C
  37. #include <mach/hardware.h>6 R  J0 J- K# U2 \$ {& J* u. n
  38. #include <mach/irqs.h>3 I( Y5 S5 |* `: E& u
  39. #include <asm/hardware/edma.h>
    ( R9 e( A' b3 T! t
  40. 0 ^9 F7 _& v( w" W1 U
  41. #undef EDMA3_DEBUG
    2 ~4 i# t9 o/ s9 ^7 g! L  y
  42. /*#define EDMA3_DEBUG*/
    2 w) e2 W4 d: q5 U8 U, F7 v; {! Y

  43. $ f- C+ ~+ r9 U. S- S
  44. #ifdef EDMA3_DEBUG: j5 w' p. ~: K0 J* {7 g* i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" ~. w- S4 g/ u- H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) ^/ I' L, p9 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): W7 s  z7 d: t8 ]
  48. #else6 K, ?& Z9 |5 B: `4 D9 ~4 r" T. k  ^. @
  49. #define DMA_PRINTK( x... )
    8 l) e" E! z, E. ?: V* _+ j
  50. #define DMA_FN_IN
    * D3 N* y4 p' i2 }
  51. #define DMA_FN_OUT
    0 W4 Q$ F. W# ]# p
  52. #endif
    & R: n' ]' l3 M, K
  53. 7 S8 t7 {$ |+ D: G* y& p! K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) Q8 k; a( Q* S* G7 o
  55. #define STATIC_SHIFT                3
    ' h1 E0 n3 a2 w" `; v2 d7 s
  56. #define TCINTEN_SHIFT               20
    % O* p8 P' a% ?5 O( F$ a
  57. #define ITCINTEN_SHIFT              21
    & J6 @7 I- b8 m' C
  58. #define TCCHEN_SHIFT                221 c* K) e! ~% f+ S* x3 E  l% u  F% q
  59. #define ITCCHEN_SHIFT               23& k! h& O+ _' H# K: e

  60. ; h6 ]  l% ^& M! m* [8 y) j$ E* @4 R
  61. static volatile int irqraised1 = 0;9 n3 R8 o* I8 Q! Q6 M# M$ U" ~) p% _
  62. static volatile int irqraised2 = 0;8 b: V  u( G9 S" x7 v' T' I
  63. - Z$ \! T' M3 ~1 B) ?. _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ?! C& s* a9 R6 W$ B2 L9 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, j, j7 M4 O7 y+ P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' }3 l" v5 l8 F+ ]' V2 q

  67. + n+ _1 w2 x5 j% l& q
  68. dma_addr_t dmaphyssrc1 = 0;
    ( G$ o& e8 s6 }5 X. Y, A7 Z1 E$ r
  69. dma_addr_t dmaphyssrc2 = 0;
    0 j. t, h& `: u! U3 F
  70. dma_addr_t dmaphysdest1 = 0;8 |& D) d4 T; J* _
  71. dma_addr_t dmaphysdest2 = 0;  p9 W' j" R: H$ v/ D3 @

  72. 8 c: C. ~% G4 V& E5 u
  73. char *dmabufsrc1 = NULL;/ J8 \0 x: Q+ R9 b9 Q
  74. char *dmabufsrc2 = NULL;
    % E. {& R9 r  f3 k% ]" |* r
  75. char *dmabufdest1 = NULL;
    . \# h9 W# U( _6 l5 J$ P" k
  76. char *dmabufdest2 = NULL;) L; Q5 y1 C- |6 e# p" ^8 x

  77. 4 I1 W* L# O8 l% O3 l
  78. static int acnt = 512;
    / _! t4 h" _) m. u
  79. static int bcnt = 8;
    0 v0 y0 d2 G. e& u7 S5 ?1 w3 i4 q
  80. static int ccnt = 8;/ Z) P8 b5 E) V' S4 L9 D
  81. ) y0 s: w9 K' S/ I4 V0 q9 z8 m
  82. module_param(acnt, int, S_IRUGO);
    6 {$ x6 O+ {$ w; x% i
  83. module_param(bcnt, int, S_IRUGO);! I' D8 k) v4 J! S; ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( e/ f2 S  F% Q2 X. W% K# i# w: x" b( @5 ~# a) I( Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- R; s  o% B# F+ ]) R6 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% x! ~7 X2 K' r3 X8 |! E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# @0 K  z$ q& M( v# z+ s" v

8 N9 x+ \7 o2 M4 z- L8 D6 E6 K3 \, U$ t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-29 02:23 , Processed in 0.043241 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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