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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, J2 H: g) }& J% k+ ?& Q+ r
  1. [code]EDMA sample test application9 y$ F( A! K  |7 J# a
  2. /*
    ' v4 ?$ V6 e4 @0 V2 @4 m% Q# T
  3. * edma_test.c$ v# W9 ^' T" ?# q3 Y# V
  4. *
    & a9 Y: V% `$ ?! ?) ~
  5. * brief  EDMA3 Test Application
    $ j0 t' G, ]  a
  6. *4 m& v# o" R# P- {5 m, B+ m' q
  7. *   This file contains EDMA3 Test code.5 q+ F& ~, G, r& W. Z
  8. *  I4 j% D" V7 A4 f+ f' O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + F6 P0 i* e" q$ h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; e, h, c0 Y( H/ @% p
  11. *         TO CHANGE.1 S  h! R  N  `5 c2 U
  12. *
    4 _7 C( ~( l& q% @5 Q# ^7 i% {- o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) E& c! @7 W% p; ?' j
  14. *+ g/ ^3 q& o4 F
  15. * This program is free software; you can redistribute it and/or
    $ v- A' D9 O/ _& _/ v9 Y
  16. * modify it under the terms of the GNU General Public License as. q* E% h) I# u* a9 i8 g8 k! ~6 c& T* t
  17. * published by the Free Software Foundation version 2.8 {( j* l2 S) [: m' s5 T
  18. *
    5 o) a" [$ _) g( V8 H: Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 w- x: J) }0 W: A
  20. * kind, whether express or implied; without even the implied warranty' c& b. f- a( N1 w. e6 d3 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 f* {, F! I7 C: d: X+ Y
  22. * GNU General Public License for more details." E( L# p8 o$ P. z
  23. */
    + e5 x# B( L" l) a! f$ ?1 u
  24. 9 Z1 d3 M  T4 O: D- ^7 {, P2 I; o% f
  25. #include <linux/module.h>/ z: B9 a9 q* I* P0 Z. k/ I
  26. #include <linux/init.h>
    $ b$ |% n/ i- n# k0 A+ Y" R3 k$ Q
  27. #include <linux/errno.h>
    9 [2 k2 b3 }7 g+ |% x  \
  28. #include <linux/types.h>  B3 i1 Z0 M. }8 a* Z1 ]( [
  29. #include <linux/interrupt.h>. g' v8 k  N) J, c/ A% u/ ^
  30. #include <asm/io.h>
    ' X( u3 p& R1 g* l/ m$ }' q2 }
  31. #include <linux/moduleparam.h>
    + a6 k+ B  c4 n( r! M9 M8 ~- L
  32. #include <linux/sysctl.h>- ^" x: m" U8 \# H1 k& W9 A: N
  33. #include <linux/mm.h>
    0 Z; O; ]$ A+ k* }. g+ r$ D: ]
  34. #include <linux/dma-mapping.h>4 T  C0 Q( S3 ~' m( R) X
  35. ! E" L- U3 n- i: C& }1 q
  36. #include <mach/memory.h>
    ( q$ g- j; ^7 |* h) e
  37. #include <mach/hardware.h>
    # \' H# j" b3 n. w6 @
  38. #include <mach/irqs.h>
    % c, M* f! \4 p/ s! S$ q
  39. #include <asm/hardware/edma.h>/ d, B: C+ P; L  G" y- p" L6 }! T

  40. : D% Q7 u( q1 a6 w; `( I# G% Y2 T
  41. #undef EDMA3_DEBUG
    + j9 R# l# n; F6 N
  42. /*#define EDMA3_DEBUG*/' Z# N3 t( q, V# g+ s3 X

  43. 6 g; u; M* Q) j& R$ y1 j
  44. #ifdef EDMA3_DEBUG3 L" T5 Q  \$ w" F' u8 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- p/ }% C4 o0 {( z! m. A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 v+ e# `3 a* K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 s' q, k- m5 i: `
  48. #else+ w* w* M# z3 ~4 ^" S
  49. #define DMA_PRINTK( x... )
    ! j+ P5 V- i, N
  50. #define DMA_FN_IN9 B! w; J+ ~- r4 j$ u; W6 K6 i
  51. #define DMA_FN_OUT2 t4 Y; ^  t! n2 I
  52. #endif
    0 c/ |/ ^7 }! ~

  53. * C* [, P9 z' G0 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : K1 s: W0 q; c( b
  55. #define STATIC_SHIFT                31 V8 X: r* g0 b+ R
  56. #define TCINTEN_SHIFT               20, j  A, f2 ^0 m; |- \$ x  K
  57. #define ITCINTEN_SHIFT              21/ o! A1 y, J, ^4 X7 ~
  58. #define TCCHEN_SHIFT                22% z8 Q' N/ q$ L3 @7 O( X; U
  59. #define ITCCHEN_SHIFT               23
    & B# l8 S1 l- N; K# Q( E2 D+ A

  60. ( _+ B* N) T9 ?+ B2 B
  61. static volatile int irqraised1 = 0;
      ~! P3 [% W6 C# J6 X% H
  62. static volatile int irqraised2 = 0;3 n3 w2 j' `% i. K

  63. ' I# i( r, P# }! S: H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 w+ F. O$ T$ z0 C+ f" T! [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ?% E' k* f' f. z& f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      I% O: F$ {0 N- Z

  67. 9 A( e) M3 T8 K0 \5 A( S
  68. dma_addr_t dmaphyssrc1 = 0;  K7 o; G: Y  t+ }8 L
  69. dma_addr_t dmaphyssrc2 = 0;: g9 q; w2 P, ]
  70. dma_addr_t dmaphysdest1 = 0;7 t+ G6 S7 ~9 W
  71. dma_addr_t dmaphysdest2 = 0;  Q0 d8 X3 Y  E6 i

  72. - _5 m/ s2 J' d( O9 K  h. i
  73. char *dmabufsrc1 = NULL;+ K) t' h/ o0 ]8 g& l0 B7 ]* o# L
  74. char *dmabufsrc2 = NULL;
    8 p: X: b# m" o0 j9 d6 w/ r" g
  75. char *dmabufdest1 = NULL;1 a! U9 _8 k6 K$ F  y+ _4 }* Y
  76. char *dmabufdest2 = NULL;: n: r5 u5 J. d$ ?' V
  77. , J+ b' O( c7 T' t* Q
  78. static int acnt = 512;! p/ O& K: z. @
  79. static int bcnt = 8;' Z2 k4 x& J; B& s! U% z
  80. static int ccnt = 8;
    1 M; K. U2 U# J9 s) c( j+ |0 W

  81. * Q# o( L+ b% K/ _' a4 k
  82. module_param(acnt, int, S_IRUGO);
    1 A2 p9 N4 f( p7 L
  83. module_param(bcnt, int, S_IRUGO);
    8 {" q7 j; X* K1 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 j2 W, ?7 A3 d$ `6 p. O" v% D6 }( H3 p; M2 S+ J2 z& G: e2 q' j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: _5 J. S( h. |) `! ?& Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! I* T1 }0 ]4 _: d! m6 n& ?' T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ i" p1 r( s4 J

5 O7 ]3 U6 B4 x5 q8 k% h
- w6 Q8 p, ^6 Y5 Q9 f% f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 08:45 , Processed in 0.046205 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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