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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + N% n3 P& }% I
  1. [code]EDMA sample test application
    * g3 p. q3 m, ]4 \( z6 y% ~( o
  2. /*
    5 H5 N7 \9 G0 E: t' o8 e
  3. * edma_test.c
    5 @7 }- d: U3 t8 P! o: B
  4. *6 c3 x2 l1 b$ s% u" l
  5. * brief  EDMA3 Test Application4 S. O+ I# d$ m: W5 E% I8 J2 @
  6. *
    * u0 h7 |* I; m6 k6 B0 Q9 u$ V
  7. *   This file contains EDMA3 Test code./ t- Q( P+ B8 U2 F* ~& v5 C
  8. *9 B' z% B  ?; B) v# j0 L( x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # s* k) S" G5 k  z+ e* S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 `+ K0 ~$ x" t" v. m
  11. *         TO CHANGE.+ f/ ^% R8 _/ F( N. Z4 K1 _' ?
  12. *
    8 e8 `$ ]7 b1 M1 \1 o' a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 ^3 c* a% Y6 o' [3 P
  14. *
    2 Z, ]9 {* |1 ~  X/ A9 L$ n
  15. * This program is free software; you can redistribute it and/or
    . _* V" N9 j) \& L5 J! [! W: p
  16. * modify it under the terms of the GNU General Public License as
    7 \& ?+ ?" s! h
  17. * published by the Free Software Foundation version 2.
    3 `0 D: O$ `, b- E( n/ _% \# d5 O
  18. *: ]! K' r( P1 Z9 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" F, c; Y  {) n5 Y
  20. * kind, whether express or implied; without even the implied warranty
    / N8 Z! T  g, R0 A9 \; F+ ^; m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 |0 S0 F, E; }9 |$ l
  22. * GNU General Public License for more details.
    7 m$ k; n* y$ n
  23. */
    # B% @6 C& c5 i

  24. 0 }. I3 B8 C7 D9 q8 i& j$ l
  25. #include <linux/module.h>; S& E2 Y4 }* _9 r( H8 J
  26. #include <linux/init.h>1 Z- L$ c- U8 `
  27. #include <linux/errno.h>
    ' k, i7 n' C) g$ ~5 `
  28. #include <linux/types.h>
    ( M; I+ R3 p( ~6 C1 _' ~
  29. #include <linux/interrupt.h>' l0 E& \- S, ?; j- J0 X
  30. #include <asm/io.h>0 d1 v3 c+ P% U- [% i
  31. #include <linux/moduleparam.h>
    4 I2 ]( U. f6 j" c4 H3 n
  32. #include <linux/sysctl.h>4 {8 N  [8 q+ x2 t- u
  33. #include <linux/mm.h>
    6 E. j& _  ]% ?$ N% ]
  34. #include <linux/dma-mapping.h>
    , A, p1 t$ N0 z1 ?1 @  t
  35. % G4 s- T9 O% U
  36. #include <mach/memory.h>, M) [5 [. i, z4 t. `! n# p
  37. #include <mach/hardware.h>7 G+ w3 q) L. f' y# y
  38. #include <mach/irqs.h>
    . ^5 Y4 z& W. o2 ^
  39. #include <asm/hardware/edma.h>
      \: R6 A# ^: c: N$ j( b; c1 K
  40. . j) \) D; C. w! r
  41. #undef EDMA3_DEBUG" Z. u& d+ k% e$ i# K5 [
  42. /*#define EDMA3_DEBUG*/
    $ R5 D0 ?5 L6 d. }/ `8 j  e
  43. 7 F- F; Q; `- r+ A% W2 I  a
  44. #ifdef EDMA3_DEBUG
    ( G0 D) R  N8 {2 N' C1 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* Y  Z4 E: S% g2 t; o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' \$ x9 ~9 N# n$ y  M4 }, e7 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ s7 N( U4 f/ H; ]1 t7 }5 K9 X/ [
  48. #else
    9 K% O$ q; M: k2 I
  49. #define DMA_PRINTK( x... )3 c5 _) K! @; P9 o$ E5 f; |5 p1 e; W
  50. #define DMA_FN_IN
    5 Z8 S: X+ |/ l0 n. Z0 ~* m
  51. #define DMA_FN_OUT
    5 l7 f- B  i3 Y6 q
  52. #endif
    ( v' a: a5 t* J" I! a
  53. ( o4 i: u8 z/ I9 i- i: P( Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 G3 Z$ X) v6 W. u9 P/ Y& ~& x5 x
  55. #define STATIC_SHIFT                3+ T0 K# w  A* m( J8 k, t
  56. #define TCINTEN_SHIFT               20# X# g2 T1 r( ], `) P1 s
  57. #define ITCINTEN_SHIFT              216 {9 ~" @, J) m* V6 `
  58. #define TCCHEN_SHIFT                22
    - K) u+ D* k+ H
  59. #define ITCCHEN_SHIFT               230 b* F9 p9 q  X

  60. ! l% f( z% C, y& e( m3 D
  61. static volatile int irqraised1 = 0;
    6 l1 W% P4 H4 }
  62. static volatile int irqraised2 = 0;
    $ [! {4 d: _6 O1 b! R
  63. 3 s2 \4 j2 D. }3 R, f4 @* _* @- f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % i1 r/ Y8 r& F( D0 H! K3 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 L. x2 f" L3 r5 _2 X5 s1 f8 }7 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 H% Y  t7 x; r. L/ L
  67. . G: \. |* R& ~0 S- O+ R, _/ X
  68. dma_addr_t dmaphyssrc1 = 0;
    2 W  K' m& f  E( U. z  K
  69. dma_addr_t dmaphyssrc2 = 0;7 _: S$ c& O$ n
  70. dma_addr_t dmaphysdest1 = 0;; G4 c# J& |3 h; |, s6 W
  71. dma_addr_t dmaphysdest2 = 0;
    7 J" ?( u3 W; x: a, @5 j
  72. 4 _# k$ |/ S0 X! H. |) w" j! R
  73. char *dmabufsrc1 = NULL;
    9 G/ u& d. \* Y" p) [6 N' I
  74. char *dmabufsrc2 = NULL;
    9 F/ {& A+ G& }
  75. char *dmabufdest1 = NULL;
    + W( F& z9 X  V; ]
  76. char *dmabufdest2 = NULL;. d3 N- X1 |( t+ N6 M& d
  77. 4 K" S5 t, x: q# S6 e) h
  78. static int acnt = 512;
    0 J. g+ {3 j* m! h6 v
  79. static int bcnt = 8;- I8 ^5 t5 I7 s  I: {) U) B' Y
  80. static int ccnt = 8;
    3 o/ J) e9 T' R  }

  81. : J; N8 a2 T4 b3 B) z0 z, J
  82. module_param(acnt, int, S_IRUGO);
    * l) @4 o, h8 Y4 o
  83. module_param(bcnt, int, S_IRUGO);, N, q  u, w3 l( X5 N, Q% F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 w. `1 y! }! M5 P( l# }
0 d8 d) d. b. Q6 K2 ]$ B9 v1 O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 S( D+ r# c( z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" W" q5 ]$ r6 n5 m- S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 @6 \( _+ g" V! f

7 ~/ b2 C8 U, H% M" }# K: u4 {2 z/ E! S
3 h; \! Z* T9 `* J) j. J7 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 18:46 , Processed in 0.048793 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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