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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) I+ C6 ~) ^6 l+ m+ B0 u6 g+ |
  1. [code]EDMA sample test application
    6 |4 c! ^# O0 D1 k0 ?# Z
  2. /*
    % x7 P5 x9 N; f. c( a, a
  3. * edma_test.c. R  R3 J' Z; e% [* }( y
  4. *5 o1 c. ]: T- M0 r8 m
  5. * brief  EDMA3 Test Application" A& A0 |! W! G7 p3 Q! R) u4 w5 ^
  6. *) |* g' q. u, Q% k  {! N9 l
  7. *   This file contains EDMA3 Test code./ P$ n% S$ N& Z$ x/ ^: i" g
  8. *! U6 W% r. k' E6 p" w2 q, l. v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" I& C. E/ J( o6 g" u5 W4 W; f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      G1 y/ }0 K; B" U: S
  11. *         TO CHANGE.
    : f0 K) [! N+ B/ `" ]
  12. *
    ' c( Z; S- L  A# Q( X' c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// M1 P1 |4 {0 f( x& q1 |3 V
  14. *
    5 J, @# [/ A8 Y
  15. * This program is free software; you can redistribute it and/or
    : i( y( {' z9 M
  16. * modify it under the terms of the GNU General Public License as3 y6 x9 m, c  r3 T2 s- j
  17. * published by the Free Software Foundation version 2.
    : `, V% D9 t( u0 F' z7 B5 _. r7 i
  18. *
    # R8 h* x& W3 X+ o( ^) N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & |! \( V$ |. a% Z) n/ _0 r; E
  20. * kind, whether express or implied; without even the implied warranty
    0 c- f5 C* C+ i. s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 m7 D+ U$ ~; O) R2 l1 z* K- F
  22. * GNU General Public License for more details.! v( ?. e2 \' w2 |9 x3 U0 J
  23. */2 j0 O: n6 R) h( }; T1 X: o

  24. " f0 Q5 I4 G7 n1 T7 T5 c) R
  25. #include <linux/module.h>/ N. e( {# B' w# |; ~: v
  26. #include <linux/init.h>, O6 {: g) }% r  Z" S
  27. #include <linux/errno.h>) k+ n- N9 Z! ^, w: Y
  28. #include <linux/types.h>
    ( d# c2 i; V. y4 e1 P
  29. #include <linux/interrupt.h>
    6 H2 L( c7 z; a2 k9 g- R$ d
  30. #include <asm/io.h>, @/ E- {1 ~9 u6 C4 |1 W. P& f
  31. #include <linux/moduleparam.h>8 J4 a; D' m. ~' [1 ]
  32. #include <linux/sysctl.h>
    * c: a5 Z3 w" m- B3 n# S
  33. #include <linux/mm.h># @- Z2 N9 b) |+ H1 g1 p% q; I: w
  34. #include <linux/dma-mapping.h>
    # ]" l! C# C( l% N- C8 n# e1 E

  35. ; m7 j; c# N# [, ?' [6 ]8 J+ m7 _
  36. #include <mach/memory.h>! d. s, O7 _% y, w/ g4 P! ~2 M; i, _
  37. #include <mach/hardware.h>
    7 e2 A1 D4 X% V, ^1 h0 L4 E+ _
  38. #include <mach/irqs.h>
    . @8 K4 X9 @/ ]" L! m& H3 H9 n+ c% ?
  39. #include <asm/hardware/edma.h>
    $ i. U( ]8 S* J4 f5 R
  40. 9 k* Y$ B4 z3 @9 a9 ?: a- r
  41. #undef EDMA3_DEBUG
    4 W4 i- v0 x- R. ]
  42. /*#define EDMA3_DEBUG*/
    4 X1 ^; q' M6 i9 }' c- i( i' a
  43. , j( k* P3 m5 r6 N
  44. #ifdef EDMA3_DEBUG6 H3 ~# s' c2 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' c$ z8 L1 s& L- L$ ]) @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( L8 r1 w% j( R  ~. N( Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" R. Z* m5 c4 N  u- R
  48. #else
    ( N% r: }/ s( ~* D' S
  49. #define DMA_PRINTK( x... )
    & H0 `: M% v& S/ s% v/ R3 [) y
  50. #define DMA_FN_IN  E/ t* n' V' l6 @1 g  T8 b* C) _
  51. #define DMA_FN_OUT$ x0 q% G& o2 m2 [
  52. #endif# Q. @/ A7 k6 B
  53. 7 z& M4 G& }: i1 n. J4 b  L  Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* D3 O' q7 y3 s* u, p$ O0 j( T
  55. #define STATIC_SHIFT                3
    & t  D5 \- ^4 L: N, l$ M& Z
  56. #define TCINTEN_SHIFT               20
    ( S, L# w: i2 t1 Y1 a
  57. #define ITCINTEN_SHIFT              21) c6 j$ R( ~4 ]3 v3 a
  58. #define TCCHEN_SHIFT                22
    " v; K' P2 H' S% L, ?) D: {6 U; Q
  59. #define ITCCHEN_SHIFT               23
    9 }* r+ |: \9 A6 U6 w: M5 \
  60. % x  G/ S. ~9 x) q9 l
  61. static volatile int irqraised1 = 0;
    , p' k; N/ X" |& \
  62. static volatile int irqraised2 = 0;2 ~/ F- r2 Q* @' s' D$ }
  63. ) F$ |5 x4 Z* s) a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' l/ O# T" ^, y/ k, l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / N+ N. h/ b& F) Z0 ^0 A! Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 u5 o& b$ E) c* ]9 L. O
  67. 4 u; U( r1 d1 K4 @" O( E
  68. dma_addr_t dmaphyssrc1 = 0;; N# h4 x  w/ }% M( h
  69. dma_addr_t dmaphyssrc2 = 0;8 X0 O" R3 K$ J: P9 W# i
  70. dma_addr_t dmaphysdest1 = 0;: ?# Y: f$ q. w8 |9 D
  71. dma_addr_t dmaphysdest2 = 0;1 ~$ V4 X, Y3 M) Q, p2 ]) L

  72. 1 Y' i. C" D/ A1 F( D6 h
  73. char *dmabufsrc1 = NULL;
    - I4 [8 @3 T) C, \6 M
  74. char *dmabufsrc2 = NULL;
    * `# ^/ l% |* V% }" n
  75. char *dmabufdest1 = NULL;
    ' e" ?* X' V! t1 `( W& ]
  76. char *dmabufdest2 = NULL;3 y) F9 k3 I/ X2 t

  77. ; M3 L1 o  x7 }% o. e
  78. static int acnt = 512;
    & S" a7 v; b/ `1 ?. ^" _" Z% D
  79. static int bcnt = 8;
    7 `- J+ ~4 U* F' i4 R6 O. O' \( S
  80. static int ccnt = 8;
    1 q4 K1 P0 N- `5 b$ t( l9 [

  81. 2 G5 o# P0 }8 j9 }
  82. module_param(acnt, int, S_IRUGO);
    % w1 u5 f' J0 _' r+ [% E9 R: E
  83. module_param(bcnt, int, S_IRUGO);! C1 Z7 n) _8 B$ E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& ^+ H  F. P0 B- b+ g5 m* ~% P- U9 ^& Y- d$ R4 |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; S  h( c: z$ ?2 q0 G3 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; M2 V' S) P; u: w0 u/ C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! i+ h' N7 |  X+ \7 K( M: l9 l( O/ H6 a2 D
# T2 v0 O) i% F4 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-12 07:22 , Processed in 0.048411 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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