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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' i2 A+ j5 {" }
  1. [code]EDMA sample test application
    & f2 Y: t9 L$ T0 O
  2. /*
    , g5 q" ~! |+ F1 N9 I" T" O
  3. * edma_test.c
    5 ^" z: ]! a% \/ B. R2 l& q1 ]
  4. *: a3 j- L. h" R& r
  5. * brief  EDMA3 Test Application& N9 }- g) Q" d6 E6 c  W% x
  6. *5 l' \: v& m* J
  7. *   This file contains EDMA3 Test code.2 q# a  g1 _" K3 M5 {: N2 H( B# f
  8. *
    7 i  t$ }/ D4 G0 P5 z6 |# {* P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 p$ h' f! e3 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : z8 e6 Q& ]6 b3 Z, X
  11. *         TO CHANGE." ~' ?  H  a8 B2 _. P2 t6 n
  12. *
      x* I9 {: c% L0 Y) R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( F/ D. ~2 L" ?& }' R) @
  14. *' b# u- @! J, F5 a' }, D
  15. * This program is free software; you can redistribute it and/or) z9 @, |$ M' I3 A; p9 I' L% t+ j9 `
  16. * modify it under the terms of the GNU General Public License as
    ) A; ]6 ]+ c2 f
  17. * published by the Free Software Foundation version 2." p7 b+ N: m; ?( b6 X% }# W
  18. *
    ' O" a9 o5 ]5 O& C/ J! d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . o! L) [/ p) \: Z3 @
  20. * kind, whether express or implied; without even the implied warranty- G# E- u; u4 o6 s8 J! L, Y& Z' n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! r1 n+ A7 U: \( ~9 @
  22. * GNU General Public License for more details.
    % p# ^4 f8 Z. l' {9 u/ Q" r
  23. */  X& h& J* [3 Q) D; n

  24. 8 h# e1 V% r7 ]. Z. o. b# C
  25. #include <linux/module.h>
      I& n) @1 b# k0 a; Q; s  U( q7 C
  26. #include <linux/init.h>2 n, x4 d% a0 [4 ?
  27. #include <linux/errno.h>% n0 J$ X, [, V  V* F
  28. #include <linux/types.h>9 M* m. C( K9 y5 T' n; ^* u
  29. #include <linux/interrupt.h>; U) Y# \5 F9 o; W+ B9 _6 _# ^
  30. #include <asm/io.h>8 g9 E5 E- }. |6 V4 v
  31. #include <linux/moduleparam.h>/ q7 C0 Z+ m( v5 d( r+ n
  32. #include <linux/sysctl.h>
    * y6 |6 W3 {$ A
  33. #include <linux/mm.h>; p6 l, I8 O0 y" o
  34. #include <linux/dma-mapping.h>
    9 `9 T2 o* n  v# g9 \9 d* R

  35. 9 z2 I, g( P. U5 d
  36. #include <mach/memory.h>) m. K7 Q$ r, B
  37. #include <mach/hardware.h>" E9 k0 K( q4 N5 a  a; e# |, S
  38. #include <mach/irqs.h>, {8 c; e' M9 d8 X  ?' V
  39. #include <asm/hardware/edma.h>
    * F! S/ r: a( z# B0 N% G

  40. " D6 o, ^; P( ^; q
  41. #undef EDMA3_DEBUG& q* U  ~* G' U  V9 C8 `
  42. /*#define EDMA3_DEBUG*/. v$ \8 u* u7 w
  43. ' S9 r+ Y2 o" h
  44. #ifdef EDMA3_DEBUG
    ) I; b  H8 ?+ e6 p4 ^9 a1 V2 L" o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ L; J/ Y) ?  v, g+ l0 L) C! i# k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): t  q3 [6 N8 p: D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); X7 L! j- Q" j9 x. X/ F+ Y* ~
  48. #else+ x+ E/ S$ i6 k+ Q" I" L) N' h
  49. #define DMA_PRINTK( x... ); N; s$ m3 p/ B4 e
  50. #define DMA_FN_IN
    8 H  o2 K. ^- L0 F& e
  51. #define DMA_FN_OUT
    8 T" ?$ S0 C! E. A# O, T7 @
  52. #endif
    ( ?9 B8 c6 C1 X* b9 B! P  S, C

  53. 0 _9 K+ ]" c, t: v% M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); R- q$ f' o+ |. m& e
  55. #define STATIC_SHIFT                3
    . q7 o8 |" P/ s
  56. #define TCINTEN_SHIFT               20
    7 l9 {, d* R( J* M/ L
  57. #define ITCINTEN_SHIFT              210 V+ M$ c2 @% M( T
  58. #define TCCHEN_SHIFT                22
    ( `) v4 R  U' r5 X% ~- V
  59. #define ITCCHEN_SHIFT               237 `9 z( [3 k2 t% P3 k7 e, C) N
  60.   n# y( H& m$ Q) [3 f
  61. static volatile int irqraised1 = 0;7 S* i$ [) q# _) x$ f3 j7 ?1 r& O
  62. static volatile int irqraised2 = 0;
    6 T1 t! ]  h" p, v2 q0 L0 E
  63. / |% u7 [. T" F$ p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& i' z4 b, z! a$ O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& a  V' ^  T6 t- ~3 h' |+ o( F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 c: \9 T$ w# _  S$ Q+ M

  67. . u% B; E1 L  d: i( Z9 t0 H% o# m& e
  68. dma_addr_t dmaphyssrc1 = 0;
    . B, N5 d7 H. E, E7 [
  69. dma_addr_t dmaphyssrc2 = 0;9 d+ G' H" u5 B# |$ [. z7 ?, }
  70. dma_addr_t dmaphysdest1 = 0;4 e/ s7 v1 w4 b  r6 j4 T" a
  71. dma_addr_t dmaphysdest2 = 0;7 }  O$ U! S& B

  72. " h3 Y; Y, i5 o/ n& C# T6 b$ j1 c
  73. char *dmabufsrc1 = NULL;
    : i7 a& G+ n& `3 E4 U
  74. char *dmabufsrc2 = NULL;0 [% w5 m5 ^' U" U* t- P0 Z; d; T% \
  75. char *dmabufdest1 = NULL;
    ( y0 v5 O2 G5 L5 F  o
  76. char *dmabufdest2 = NULL;
    $ K. R% p# ~5 U) o+ u: G3 h
  77. 1 Y" p; A7 q* O  u: z  m: f, U
  78. static int acnt = 512;
    / W2 T$ w. B- x/ ^
  79. static int bcnt = 8;3 U6 ?  c3 _8 `
  80. static int ccnt = 8;
    ) c1 S! a5 `3 w! g0 \
  81. 0 G# Y0 U- V5 Y; P  q$ B
  82. module_param(acnt, int, S_IRUGO);: W7 g  N! S  b# `- f6 l& t
  83. module_param(bcnt, int, S_IRUGO);
    * g) p7 u! D; e! G% \4 n8 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! h2 f9 Y7 b/ n+ B9 z* Y( k( |8 ~9 W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( P! j2 [2 J* E+ n- _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. Q( o' n5 g- x% O6 O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( `# s8 n. I* x
# z. d* i  P6 @* x- _

! K& L6 j  \: S" ~' s0 N+ V/ t6 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-19 07:51 , Processed in 0.038169 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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