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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 ?; F& M% V# h
  1. [code]EDMA sample test application
    ( q( f* |' Y' ^3 n# v% k0 r
  2. /*. Z( ?( Z/ J! g0 L7 y
  3. * edma_test.c
    ! [5 y$ T+ Q8 s- V
  4. *
    ! n+ {) v; A- O' X; _$ J
  5. * brief  EDMA3 Test Application2 f! h' c3 i! i, V2 e
  6. *$ i8 Z) h; n5 S) e8 n% }( n
  7. *   This file contains EDMA3 Test code.5 h5 `1 k0 Z- d- l7 b9 D
  8. *: r; z$ e  c( B) A1 M4 v' q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 j, n+ j1 x# `/ l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 G( V2 i7 S, r. A9 k
  11. *         TO CHANGE.
    / E, P/ X2 B4 W% q
  12. *
    - L1 k0 h$ K9 n5 |8 E2 _/ Q# w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 o/ g# {# v# S  s
  14. *) Y* p" g% ?- S  h7 Y
  15. * This program is free software; you can redistribute it and/or
    - Y5 D; q9 b- r( O; _6 t8 L
  16. * modify it under the terms of the GNU General Public License as6 G: x7 e% G  G
  17. * published by the Free Software Foundation version 2.
    + v% T! e4 d1 w7 c, W
  18. *
    ' L# T1 N- ~3 }) y/ C7 v# O% n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " u# G* a, E$ w. b9 B( C: X
  20. * kind, whether express or implied; without even the implied warranty" M8 B; N$ S9 E4 Z. R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! F) s0 {, m8 d8 Y. Z9 g- z
  22. * GNU General Public License for more details.
    ( l; T$ i1 t; V
  23. */
    # E- U8 l& {- n) {$ m; I0 X0 S2 }

  24. + y6 S# X# B8 |
  25. #include <linux/module.h>: Y# D  x- u" X5 ~
  26. #include <linux/init.h>
    1 `6 q! F- G# o& X$ Z1 B
  27. #include <linux/errno.h>6 {4 s' t* n% D  V/ B5 x) E0 v
  28. #include <linux/types.h>
    ) j+ a: K: F5 [
  29. #include <linux/interrupt.h>
    , H+ c3 P7 T  w5 K) Y2 ]
  30. #include <asm/io.h># n# o1 [. |0 g: F- R
  31. #include <linux/moduleparam.h>1 l+ W* @8 c: m
  32. #include <linux/sysctl.h>
    ' Q! l4 q! R3 U" d% `* ]+ L
  33. #include <linux/mm.h>) d) e5 v8 }8 L1 K- z
  34. #include <linux/dma-mapping.h>( j9 c) o0 z3 g1 X- H; O- q

  35. 9 f9 p' {# ?6 E
  36. #include <mach/memory.h>
    5 _# k9 a8 Q7 `- z; F: t+ [
  37. #include <mach/hardware.h>/ l3 X- |6 k# l5 y: s( b  S8 t$ s
  38. #include <mach/irqs.h>; e1 l9 n/ ~6 {7 g) L/ U; v
  39. #include <asm/hardware/edma.h>& a+ a- H8 I# b; W& N3 C4 g
  40. * S( r( y, ~, M( ?- g: p/ I, b
  41. #undef EDMA3_DEBUG
    4 W9 F2 w" Z6 J. ~' r1 Z0 z  H! Q. ]
  42. /*#define EDMA3_DEBUG*/
    8 }; E3 ^1 h9 p) w$ ^) o6 s/ V
  43. * c4 q2 D7 s+ {" ]# P' n
  44. #ifdef EDMA3_DEBUG
    2 s4 m  d5 i! C( S& W( p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( F! c4 j; ^) D( F& q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 D; S. Y7 p5 {  g% F& B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 G! Z: M# U+ N
  48. #else
    9 i" U6 _% j- Y6 D% p: p
  49. #define DMA_PRINTK( x... )
    * B0 J$ _- u  ]& q8 D
  50. #define DMA_FN_IN
    / }: C3 O* `3 L
  51. #define DMA_FN_OUT
    * k9 Z- u! F8 Z. A5 Q2 g) x8 F
  52. #endif& h2 d3 z* }! g' R$ d' A; n

  53. 1 f& O" a2 ~% S" L( X/ A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- y" W' p& @( W, M/ t. G9 U
  55. #define STATIC_SHIFT                3
    - q4 P9 T, O# o5 u" I
  56. #define TCINTEN_SHIFT               20
    5 F# I3 z2 I1 }2 Y1 D
  57. #define ITCINTEN_SHIFT              21
    . r$ X4 c" K( c- U; d; I6 \/ B& \
  58. #define TCCHEN_SHIFT                22
    " |2 e$ ?1 {( A6 _5 e
  59. #define ITCCHEN_SHIFT               23
    9 G3 O6 y5 X* ^3 m

  60.   |: t% ?/ e8 \6 T1 \
  61. static volatile int irqraised1 = 0;; _  A. z  b" e( N- @
  62. static volatile int irqraised2 = 0;
    9 h" c! r# o4 Q, p! f; y( c4 k

  63. 4 S; P0 b; T5 C5 `, ~" T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 s  H# s4 D9 y* ^: I5 Q( m& E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. Y- S$ u+ l% h5 I+ H  S6 V& l7 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 E9 y) j2 Q$ |# v, k$ u3 p) V

  67. , S6 B4 O/ D1 ?4 z$ u1 G
  68. dma_addr_t dmaphyssrc1 = 0;* m" H1 E) B: _
  69. dma_addr_t dmaphyssrc2 = 0;
    . ^9 e% r+ P7 B2 V! R. D0 ?% u
  70. dma_addr_t dmaphysdest1 = 0;
    6 s" q  o) D7 R4 {; o
  71. dma_addr_t dmaphysdest2 = 0;
      j9 g8 V. J1 G$ L$ h
  72. 0 g# v" r  n5 t2 k
  73. char *dmabufsrc1 = NULL;' F+ C# G" G4 U# H
  74. char *dmabufsrc2 = NULL;
    : o# J1 U& |/ X  I9 p
  75. char *dmabufdest1 = NULL;
    + x" f0 e% A1 z  {; r5 S4 a
  76. char *dmabufdest2 = NULL;! k7 b3 Q9 z/ e9 J: A/ z' L
  77. 4 E& E/ c3 i2 X: u! \/ S
  78. static int acnt = 512;
    5 g0 ~4 b; c& M  ^" t9 L' J9 D1 s
  79. static int bcnt = 8;
    . g: B+ c% D* B0 |! Y
  80. static int ccnt = 8;  i7 f0 m" @7 H3 x$ X
  81. / j; e* C2 ^! [' Q# W
  82. module_param(acnt, int, S_IRUGO);
    8 C# \/ m* A1 {; k+ I: ?
  83. module_param(bcnt, int, S_IRUGO);( [% R/ W. A# c# ~$ A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ w( q3 I6 V% y

( a( O$ C" N4 K4 g, V, s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, L5 E  ^/ \2 L4 c" _( R" G; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ z- G; a) t; P( M; v  r; g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* D. x3 A- [0 d9 r0 o8 B# {0 c* Z; c$ g! o  ^1 f: E/ a1 A

+ ?1 G# Y( g5 b) v4 k' E7 Q2 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 23:22 , Processed in 0.039703 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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