OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 R# L- s7 U1 V3 W! }( c/ m/ I
  1. [code]EDMA sample test application
    ' s' @9 C: _" w6 L$ a$ s
  2. /*
    $ w0 d; _6 Z, |1 s
  3. * edma_test.c
    % D$ X  F+ r) P& E4 a: I( D* P5 T# o
  4. *4 g0 S' S4 I' H3 q  m! k0 u4 l9 s
  5. * brief  EDMA3 Test Application% d$ y: {8 A8 m9 M! q
  6. *7 p3 ~3 i5 j9 c: S6 O* {; }
  7. *   This file contains EDMA3 Test code.
      M' G' M2 T% ~- U- G
  8. *
    * C2 `1 j3 V/ r  ^% Q# B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: n* z. t/ g( ]7 G. N' o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ [0 b* U0 \! N. Q5 X2 X
  11. *         TO CHANGE.
    4 p5 Z+ T; y# h9 H
  12. *
    ; x6 G  _: Z% e% G& G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ V6 u  W1 k$ Z% |$ i# Q) x* P( t3 K
  14. ** Y& o5 w% f& G3 p+ z
  15. * This program is free software; you can redistribute it and/or
    ' s) o! d1 y8 O/ S
  16. * modify it under the terms of the GNU General Public License as
    ; q: o+ ~  C) u1 P$ W
  17. * published by the Free Software Foundation version 2.( x, l' e* f! L
  18. *" H: C# n/ B% N2 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( k* ~5 l2 o: H1 g# N. \! S* v
  20. * kind, whether express or implied; without even the implied warranty
    % r3 C1 g( ?( h. B( E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 h: F9 L4 C2 A3 D, S
  22. * GNU General Public License for more details.
    4 F5 ]) h7 \  ]# J/ x2 y/ J( e
  23. */
    3 @! P; Z- q& S# M2 j% Z; k
  24. , Y2 G& U9 i0 E/ n0 A$ H
  25. #include <linux/module.h>
    - ~( o; t5 g+ C* p. f
  26. #include <linux/init.h>8 L* m- p! E9 b3 |6 w  l. P
  27. #include <linux/errno.h>
    ' U5 e4 ^8 S# @1 _
  28. #include <linux/types.h>
    6 i6 F* B" J: G
  29. #include <linux/interrupt.h>
    % h. h* y; O* W
  30. #include <asm/io.h>
    2 d& a& g( E+ a, P! W$ k  e
  31. #include <linux/moduleparam.h># Y; M: W9 O& `2 c  r; q! F
  32. #include <linux/sysctl.h>
    ' J  g; x- ?" M- _5 W! F) j/ p3 |
  33. #include <linux/mm.h>& {, X! O0 G! I# f- `
  34. #include <linux/dma-mapping.h>
    9 f# `' I7 j) ]; j) v+ u
  35. 8 O0 u9 j( E- c$ Z9 W" n$ A5 `) Q
  36. #include <mach/memory.h>
    2 a/ {* h; V/ I0 g9 D
  37. #include <mach/hardware.h>
    / Y* I7 F+ s1 h, q0 a
  38. #include <mach/irqs.h>) h+ N; ^( Y4 M$ I# }. D! S! b7 ?
  39. #include <asm/hardware/edma.h>. u2 y8 y; h! C3 {

  40. ) J# n: c. }% C% z8 }: y5 Q! b- U
  41. #undef EDMA3_DEBUG
    , u. Y4 N' h/ V2 l' Q5 O
  42. /*#define EDMA3_DEBUG*/
    6 a4 Q& M' G2 V0 I* M) {
  43. 8 Z  p" _9 |$ ]4 E+ F0 O
  44. #ifdef EDMA3_DEBUG
    & U3 B" `' ?# q; o4 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& z4 k: x0 I: _7 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ^. P! C3 K6 O4 A4 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * u# h$ i3 G( v: {4 t
  48. #else8 E+ C5 c8 B- A+ J1 h& Y+ o8 ^, [
  49. #define DMA_PRINTK( x... )) }: l% d; |  g1 ]: x( C
  50. #define DMA_FN_IN! V! y  E3 c* b$ ^
  51. #define DMA_FN_OUT) N: p1 m+ S" R# C2 w* `
  52. #endif
    4 M2 \, t1 p* X; r, i
  53. 8 \; L* J. I8 a- b* l$ S7 `$ D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 D7 n2 W1 X# r+ \4 {7 G
  55. #define STATIC_SHIFT                3/ G7 O# |! B& T
  56. #define TCINTEN_SHIFT               205 H) ]  }& Q0 B9 S! l. A2 N4 w
  57. #define ITCINTEN_SHIFT              21
    $ [1 T$ W/ X  q8 R  B! t! z
  58. #define TCCHEN_SHIFT                22" D0 W$ K' M) a, n& i8 s2 p
  59. #define ITCCHEN_SHIFT               23
    * j; `  O5 `4 k+ x$ ~3 v5 _/ q! A
  60. 0 K; `: Z8 P; ~* c
  61. static volatile int irqraised1 = 0;
    : k0 e. T7 P' m' d8 K3 }
  62. static volatile int irqraised2 = 0;0 [2 W0 m- ~) b6 P7 X+ L% a

  63. 7 W! H1 }3 N+ j+ e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : E% z+ W, Q/ z) z9 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! U1 k! d7 `- Y0 s9 g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # y% @8 u6 B; C: ?. e. m  i, U1 L" l

  67. ) K% R( F: e6 ~1 @( Q  K
  68. dma_addr_t dmaphyssrc1 = 0;0 Y, r. x5 Q, |1 E8 _- T! @
  69. dma_addr_t dmaphyssrc2 = 0;, A# K) J9 L  A# C# ]2 N2 {
  70. dma_addr_t dmaphysdest1 = 0;
    / R& ?" a6 P, I6 x: R( q( z9 Y
  71. dma_addr_t dmaphysdest2 = 0;
    2 Q  z" a5 C* m/ R2 X2 _
  72. . B  [4 I  y: I* C0 M
  73. char *dmabufsrc1 = NULL;
    ; m) ~* }# K) Z6 `3 ]
  74. char *dmabufsrc2 = NULL;
    0 `3 [, t5 d6 U  H4 j: m( f
  75. char *dmabufdest1 = NULL;
    " g; A9 ~3 h; l
  76. char *dmabufdest2 = NULL;
    0 _' n' w& x5 ^4 p0 K' w0 L8 d' H

  77. 4 B+ f# e% `2 Z8 f7 S7 s
  78. static int acnt = 512;
    3 o, x7 x2 _3 S' a  S4 H
  79. static int bcnt = 8;
      x( T9 T" `9 [3 _/ u/ o4 O6 Y3 n' ~
  80. static int ccnt = 8;- T$ ?* y4 z9 p" f! a1 y! u9 s7 U
  81. ( z* y$ c& ~8 T3 |- I1 _; i. O
  82. module_param(acnt, int, S_IRUGO);! F) C5 B' h" |8 V4 J! c1 q
  83. module_param(bcnt, int, S_IRUGO);$ v; r: \" a' D# K3 S) L8 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" n8 u# f+ H6 t, i$ W( T& Y
% O7 \" s% m& F% v, S& d" q0 a% E) F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) ?: `7 a6 S. g! Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 J; [5 T6 Q+ ^' g9 E  z' H3 p! x7 D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" R( h  W2 s+ p0 P( ~* T5 Z& w

8 [# K4 ^1 ~& _2 f+ x9 M" t  y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-10 16:32 , Processed in 0.040177 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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