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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% `1 I( l6 P) i$ j$ A
  1. [code]EDMA sample test application
    . Q3 D6 a% m8 r/ d
  2. /*; u/ I/ S6 X8 s5 x
  3. * edma_test.c
    9 u% n! z: L9 ~: P4 i! f( `) N
  4. *
    2 F8 @  w4 a. ?; ]& e* H$ }& _  G
  5. * brief  EDMA3 Test Application5 A# [. I) c2 T* R# i' X% r
  6. *
    ; m: b. ?& k! G% R: i
  7. *   This file contains EDMA3 Test code.
    9 J! r$ N  ?* X. A! i
  8. *7 g! i8 _, `) A" \1 y* A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 V+ B; L- M0 \8 K: C. k2 s" n# m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 Y5 S( ^) {: a
  11. *         TO CHANGE.
    ' @. G4 |3 j+ T. R" m/ X
  12. *
    # @) b1 W8 R# @& s3 |% ?& Z7 P, N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 L+ I; G9 L9 d; U! `
  14. *8 g/ G+ c. S' v* F
  15. * This program is free software; you can redistribute it and/or7 e1 b9 l1 f) K2 z3 f, d
  16. * modify it under the terms of the GNU General Public License as) z. J9 k" D7 h% E
  17. * published by the Free Software Foundation version 2.
    0 h# V4 l3 }  P3 ]0 r# f& ^
  18. *
    # {* f# o* o# q6 g; E# e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ z! w  A& D: y3 J8 H: x
  20. * kind, whether express or implied; without even the implied warranty
    7 ^% ~+ T1 z2 G+ H- h1 @6 I* f5 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. U! O9 M% U' X2 C" N
  22. * GNU General Public License for more details.- X5 Z# i$ ?9 d- [9 Q! j; b8 h. f
  23. */: g' Q/ b  B% ], Z3 s

  24. 3 w; o. P( X: w: P7 F
  25. #include <linux/module.h>- g5 s! t+ J8 \# w" J
  26. #include <linux/init.h>
    * L0 t0 `% Z8 C' D7 _0 b, R
  27. #include <linux/errno.h>, c- U( T+ q$ m* ~
  28. #include <linux/types.h>
    . d) R! {! r5 n3 Q
  29. #include <linux/interrupt.h>, g. D: O. W0 ~4 B- ^  Z6 |
  30. #include <asm/io.h>8 y0 l: E6 t: r5 [% B- U
  31. #include <linux/moduleparam.h>+ g+ f2 d6 F+ l8 Z8 G
  32. #include <linux/sysctl.h>2 J; [# k8 h/ S; h. z9 |) G. m
  33. #include <linux/mm.h>; y: u4 S0 t% i2 K! _
  34. #include <linux/dma-mapping.h>8 ]  Q; x) `  \7 ~+ v( w' ^/ n" w( o

  35. 3 |2 H( a5 i: H+ B: Y; e5 U" L
  36. #include <mach/memory.h>
    ' z9 K! K' Q: q0 P2 ~7 s$ }
  37. #include <mach/hardware.h>
    % G5 Q! U6 r" z$ v( @; W  c5 b
  38. #include <mach/irqs.h>
    3 r- r6 S2 {2 p( T3 R8 j
  39. #include <asm/hardware/edma.h>5 R) S7 T; k) f' j' ]
  40. * x# m0 F, M) e1 V( B1 r# _
  41. #undef EDMA3_DEBUG
    - S. H0 R& d6 F  ]: f+ ]  O7 R
  42. /*#define EDMA3_DEBUG*/
    4 ?# ~9 y! E, C; E$ A
  43. 7 i/ M( r) o  J  G
  44. #ifdef EDMA3_DEBUG
    # c' F* O/ m' K1 h9 z- R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 F, f) e+ n( W3 A5 U7 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 G8 |" Y* ]4 W/ d3 Z, k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& e/ j& i! D+ V6 R7 l
  48. #else: d$ R' ^& {5 n4 k0 m5 J
  49. #define DMA_PRINTK( x... ). x$ o8 v- ~) `" u) ~
  50. #define DMA_FN_IN) U% j, y' X9 e: I. t' |6 s! e
  51. #define DMA_FN_OUT6 x" s% y0 n5 S# M1 T" I7 i  E
  52. #endif
    / }- Y  Y: t/ P2 M" W/ W

  53. + _; p" C* {+ h7 W' }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 p' O, m& t0 G
  55. #define STATIC_SHIFT                3! ~, Y* S6 \- F
  56. #define TCINTEN_SHIFT               20! a# ]6 _' d( R; r! c
  57. #define ITCINTEN_SHIFT              21
    ) O* E( j* b! Q
  58. #define TCCHEN_SHIFT                22# ]+ D& R, D$ c4 U% n' e5 e; P5 o
  59. #define ITCCHEN_SHIFT               230 p9 y7 Z0 Q& K- E' o& ]

  60. " @. q+ K# P8 I7 m) {7 `. l' ]
  61. static volatile int irqraised1 = 0;5 X, n5 Q4 p; h' L4 w9 G$ c0 W3 [
  62. static volatile int irqraised2 = 0;
    9 }7 O& m: S: J7 }6 X

  63. + C+ H8 S: V- x! u8 d4 A# @8 w7 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 c; @3 Y7 f  b8 _3 D- b1 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ m1 X3 g# v! m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ]" c' p& }. f8 ]5 ~7 }0 B

  67. # W4 O/ F. N0 V  r
  68. dma_addr_t dmaphyssrc1 = 0;9 M. O& @7 P: a% d9 w
  69. dma_addr_t dmaphyssrc2 = 0;8 B) Z8 b8 k2 C% H& g. v& ]' {
  70. dma_addr_t dmaphysdest1 = 0;
    ' X2 v6 B- U" F4 l8 M# B
  71. dma_addr_t dmaphysdest2 = 0;
    9 s/ M+ u/ }4 X* m" X' I3 Z
  72. % u7 H: l( S+ o8 ~1 @6 B2 A
  73. char *dmabufsrc1 = NULL;
    $ x2 z- D) `7 G$ F& E1 l
  74. char *dmabufsrc2 = NULL;: l+ T5 N1 x  ]! n3 W
  75. char *dmabufdest1 = NULL;1 Z/ h) N6 O5 J" g1 a
  76. char *dmabufdest2 = NULL;, Q" i! ]: K! j$ v; t
  77. 0 W; C/ G: w# x( ~( c
  78. static int acnt = 512;
      s9 D! H4 u* ~1 _2 C# g  i' d/ }
  79. static int bcnt = 8;
    ! V6 t6 v, w2 z& y1 X
  80. static int ccnt = 8;
    ! A2 Y% p2 D7 ~: I

  81. 2 j" T( v6 ~8 H
  82. module_param(acnt, int, S_IRUGO);
    2 `; H( g1 _+ x! c7 H( M
  83. module_param(bcnt, int, S_IRUGO);
    : x2 `- O, b- m6 C- N$ e9 |+ a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. W( A% i6 A6 I# R) S; j

0 @8 {" W8 \$ ~9 @( }5 L9 u/ R! |4 W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 s) G" Y4 @# K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( H* D* \/ N6 h3 d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% @% E7 U$ \# ^/ ~' a$ {9 e- v4 x+ {
* X" _/ A: w+ {( ]+ ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 11:08 , Processed in 0.050857 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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