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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " w7 K8 n4 T1 h& u4 b% b6 W' I
  1. [code]EDMA sample test application
      @& o$ V- s( j( s, K
  2. /*% M( O0 U5 O- `* J
  3. * edma_test.c
    , l+ O  X2 e) X6 u& X
  4. *
    0 `/ g4 l0 x6 x, Y# m2 t
  5. * brief  EDMA3 Test Application1 m) l/ u1 s6 S! q4 `9 Z3 e4 t
  6. *) u( ^4 }( s  Y: Y7 m
  7. *   This file contains EDMA3 Test code.4 e/ h9 p3 ?$ {5 ]& A0 j( F
  8. *  C% S8 l/ ], E) h( R+ S. G/ X" Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " ]) j, E  r" K0 Q& F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      y+ o% Z- t' L- N
  11. *         TO CHANGE.
    : m0 X6 ~$ r0 ~5 j: o# w
  12. */ `  u! W3 u( W. U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( V& U7 z) `. M. o5 K3 K2 f1 y
  14. *) J7 u* D. b$ q$ l; m/ ~
  15. * This program is free software; you can redistribute it and/or1 r1 p1 [/ k& d) d; G) D
  16. * modify it under the terms of the GNU General Public License as
    ; P" Z& L" `& W
  17. * published by the Free Software Foundation version 2.
    5 ^3 x. U- Z4 a4 |, I, V
  18. *
    & q7 g, o3 ?6 b  h. Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  S- ]6 t2 y* X) U/ z" Q; o. E# X
  20. * kind, whether express or implied; without even the implied warranty6 b' b/ o) X2 n  S6 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. ~! I3 F2 l( Y; I' g9 X* c
  22. * GNU General Public License for more details.; b/ C. N7 J! ^. x' R
  23. */
    1 v* f$ }$ G; j. Z( k3 n

  24.   \0 v- X5 m! _6 {  p
  25. #include <linux/module.h>8 W% A) ?" a& ]
  26. #include <linux/init.h>
    $ I% H) p, @  X6 q: z
  27. #include <linux/errno.h>/ f* }  z/ T3 v
  28. #include <linux/types.h>/ t+ W- d  t& }+ e
  29. #include <linux/interrupt.h>: r6 y: i0 m( B! x1 g  T
  30. #include <asm/io.h>
    ( M* |. l. _/ p- I
  31. #include <linux/moduleparam.h>
    ) T, J' i+ \: Z8 Y
  32. #include <linux/sysctl.h>
    1 H+ S1 B- l' `- {( B
  33. #include <linux/mm.h>
    / _! J& N8 B' u% z/ u% N& O' Y
  34. #include <linux/dma-mapping.h>
    , \+ N& A; ]3 B8 J

  35. " K3 w( _* V; n* j; e  W
  36. #include <mach/memory.h>4 x$ S. |# p4 S1 c
  37. #include <mach/hardware.h>
    9 y9 u" c! E: U& T& T  N7 [2 c
  38. #include <mach/irqs.h>
    ) G2 m9 z/ H* h
  39. #include <asm/hardware/edma.h>1 H7 |0 J* T9 O2 R& n

  40. $ E7 X+ `9 H; f6 ^
  41. #undef EDMA3_DEBUG. `5 N; S) M! ~: H, z
  42. /*#define EDMA3_DEBUG*/
    . V& q- o# j: h  z

  43.   g, J/ p2 J3 p3 M  i% j
  44. #ifdef EDMA3_DEBUG/ a. n) U/ Y( j% H+ h6 b/ H* N. ]! P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* |1 V3 T# x; K4 J% @$ }4 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ M! m  f( Y. O. w: o" t! ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- y; B/ x/ h3 N& v6 X
  48. #else5 {! C2 I% b( Q* b  [; K8 M, C7 }
  49. #define DMA_PRINTK( x... )3 v! o* b5 J) w9 ?
  50. #define DMA_FN_IN
    # O5 {; F0 v: ]! b1 U  C1 t$ a1 y! |
  51. #define DMA_FN_OUT5 f9 W% ]; b( }" y% H
  52. #endif  N9 |  |. @. M1 {3 ^
  53. 8 @: @, {+ N2 v6 n0 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  j  z8 D" b7 i+ a7 C6 \9 y
  55. #define STATIC_SHIFT                3
    7 B% m1 U# \1 Z/ r
  56. #define TCINTEN_SHIFT               20
    6 \9 D) K: w) L1 M" b: P( i
  57. #define ITCINTEN_SHIFT              21
      d! |0 f% l- b0 V5 i) y
  58. #define TCCHEN_SHIFT                22
    + R4 |" Z# x8 d. H
  59. #define ITCCHEN_SHIFT               23
    . n4 I, o( Y) j+ ]/ E
  60. ) W% p* H% k% ]1 U% \  N
  61. static volatile int irqraised1 = 0;
    / }  J% A: U, G. G; z4 ?/ a3 t
  62. static volatile int irqraised2 = 0;
    . W# t3 L0 w/ s( l+ G
  63. * {5 \" a0 V0 H$ o1 T) W: d% W( F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' |' ^2 P* l2 C& d  e+ u/ N& d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) v* _0 k2 v* W9 b7 w0 C0 ]0 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 l  P, g; A: d+ n4 k

  67. . a* f5 ^, v& P, ]
  68. dma_addr_t dmaphyssrc1 = 0;3 f& S; s, A4 c3 H; c! N
  69. dma_addr_t dmaphyssrc2 = 0;/ `, Q0 [2 f* d4 T1 W5 f
  70. dma_addr_t dmaphysdest1 = 0;
    ! x- {" Y9 ~8 K9 p5 ?9 r8 V1 a
  71. dma_addr_t dmaphysdest2 = 0;
    ; M7 X; ]: s( o/ I) j

  72. ' n3 r, z* V% z3 o$ s: X' I
  73. char *dmabufsrc1 = NULL;- G( l% y$ @2 {+ M! q* p4 \* j4 N
  74. char *dmabufsrc2 = NULL;  j# P( [' I/ K# W0 Z
  75. char *dmabufdest1 = NULL;: \( T1 T1 \& J" {5 L
  76. char *dmabufdest2 = NULL;9 A4 \  N4 s6 |- l9 N) ^
  77. 0 u, D* l- J( L. o0 X. A
  78. static int acnt = 512;
    0 Z: \/ J/ k" G, j' u3 o) h7 c, s
  79. static int bcnt = 8;2 I1 J9 [- o/ \! \" J3 t* l/ g) o
  80. static int ccnt = 8;: Z: |% O" D; m/ k8 H0 {

  81. : P# i; |" A4 S
  82. module_param(acnt, int, S_IRUGO);$ I# d7 Y4 K, H& z7 K% J
  83. module_param(bcnt, int, S_IRUGO);
    $ O& q1 g* Q- k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" r2 Y4 B( D+ i* s. e1 R, H. }
0 Z1 ?8 ]4 m5 D- G% S6 F9 S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' h( H5 b( k# O  \5 z* a9 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# A# J  K/ f( x" m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 D7 y1 k/ |4 m0 x, [5 M0 X; B: ^9 U$ ~. W9 i+ e

; d" e7 ^; z: _$ n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 19:32 , Processed in 0.040689 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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