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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   l# Y$ P0 P) M2 D
  1. [code]EDMA sample test application
    4 W2 V! R" b* z+ x7 Q9 P8 L
  2. /*
    * k" G+ X( i' V8 W
  3. * edma_test.c' \- c  A6 l1 i
  4. *' [5 b& j7 v5 q* w7 `3 r& C
  5. * brief  EDMA3 Test Application
    9 ~+ T% |5 p6 z' I. D5 y  D
  6. *1 k& \. A. E& S0 D" H" b
  7. *   This file contains EDMA3 Test code.% }! y( N& j, s7 Z( g) s/ `$ I
  8. *6 M5 S& q; R+ C- f, _/ j& x% ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: [4 a) Z# E0 K! _! p, n/ U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & T0 p4 F3 J! X2 ~8 F
  11. *         TO CHANGE.  o6 Q0 Y$ k6 e$ t" g! e7 m9 b
  12. *
    * N5 k; f) ^9 U+ i! _% u# ^- i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : T' i5 y5 x9 P5 \6 k* g' d
  14. *
    9 X4 L1 i: @$ I+ Z+ s7 `$ Q6 D
  15. * This program is free software; you can redistribute it and/or% ?) }+ z4 `1 B$ o: j, I1 |5 t
  16. * modify it under the terms of the GNU General Public License as
    2 z. e+ C$ l$ P0 z8 I* C
  17. * published by the Free Software Foundation version 2.
    5 R1 ~/ A3 Y# w. D
  18. *
    + Z% F8 k* l: V5 y6 C" m0 O5 C+ h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 f+ N2 ^2 @; \! w
  20. * kind, whether express or implied; without even the implied warranty
    5 {, a# E9 r8 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 E, |( q% x& d9 K8 i/ `
  22. * GNU General Public License for more details.
    3 M' C9 c$ F' u4 d2 J
  23. */
    # L3 y' p& y9 r, }: e, e6 q
  24. ! M1 W, S2 y6 @0 }4 T4 u
  25. #include <linux/module.h>; J4 ~/ h( z4 V9 q8 a' R
  26. #include <linux/init.h>
    % @" @  W/ l4 q( s
  27. #include <linux/errno.h>
      F( e) \9 e5 ]& R9 M' t: \
  28. #include <linux/types.h>
    " V% a4 i6 O. |& h1 o% |/ E+ g
  29. #include <linux/interrupt.h>
    5 D- n1 M* S% L: b" H0 h6 w
  30. #include <asm/io.h>
    , @9 T- e9 e( b* R! @
  31. #include <linux/moduleparam.h>9 e4 U0 e" o. d" E4 K. E3 {7 C
  32. #include <linux/sysctl.h>
    . e, k# t8 e: d: G. g0 `# Q
  33. #include <linux/mm.h>
    3 Z( G- z- c8 T7 P0 n# ^
  34. #include <linux/dma-mapping.h>9 _) \/ }4 |( ]1 J
  35. % @5 }5 |- W  Z  i4 {5 \' t: k
  36. #include <mach/memory.h>
    / w( d, @/ x# d* f0 F( N
  37. #include <mach/hardware.h>4 r) y/ D3 P" [1 K: a
  38. #include <mach/irqs.h>  \: Q% y' X6 [6 A) d& B+ A. T
  39. #include <asm/hardware/edma.h>
    1 B+ m$ [9 D$ P" m2 e
  40. 6 C. N" C5 [# ]* H
  41. #undef EDMA3_DEBUG
    5 {2 Z. K4 J- K/ Q; [+ u
  42. /*#define EDMA3_DEBUG*/& {4 `0 ?9 E# V; f" b
  43. 8 l/ W/ i) C/ _% Y) `: \
  44. #ifdef EDMA3_DEBUG/ C  w- G0 P6 i/ x2 c$ u: Y0 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 g, l% I; w9 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 e( s! O! s" q/ \/ ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- k" ^, y% U( }3 S  `3 Y. Q
  48. #else7 E: E: c" D5 L3 W! d
  49. #define DMA_PRINTK( x... )
    0 A1 @* w1 |6 ^' V# }  _* l
  50. #define DMA_FN_IN
    % [! M6 G0 z' R" P
  51. #define DMA_FN_OUT
    - m4 j! P& k) r! u
  52. #endif1 ?5 j7 e7 u9 S/ e& J% y$ D
  53. " S# |0 d$ b# X) E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! K1 _* I8 }; l5 Z3 u
  55. #define STATIC_SHIFT                36 h' b: x2 `$ ^: \3 o! p4 k
  56. #define TCINTEN_SHIFT               20
    0 V2 Z! p, e, b) {6 t+ @. H! b
  57. #define ITCINTEN_SHIFT              21
    / a* D9 R6 L' M9 W& H: Y) Z3 M
  58. #define TCCHEN_SHIFT                22& z& Z8 t6 t2 p1 Y
  59. #define ITCCHEN_SHIFT               23  X: x: s6 H( E" ?2 _# S. u
  60. ) _7 a/ P# L, [% g! {
  61. static volatile int irqraised1 = 0;
    5 k  A: r) T( ]; [
  62. static volatile int irqraised2 = 0;
    ) N9 R  m) y% W/ I. c3 l
  63. & M6 @+ X: Y8 l. k( w- ?" c% K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # J0 I  l/ y7 c  X8 K# a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ |. E( L/ A( s; s6 p. P  O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / c" Z/ `3 `# f) X! a. ?

  67. + a- u# M+ I" B$ y/ w9 o( ?
  68. dma_addr_t dmaphyssrc1 = 0;! d( U. C2 g' i) P$ E' G
  69. dma_addr_t dmaphyssrc2 = 0;
    6 v4 J% ^1 i* x# `
  70. dma_addr_t dmaphysdest1 = 0;
    ! z  \( @" e. u. [- |! |2 G
  71. dma_addr_t dmaphysdest2 = 0;
    # Q, L4 H& m, v' @9 |. y
  72. 9 v/ G: v% I2 P
  73. char *dmabufsrc1 = NULL;
    ( L+ d1 q3 d6 N
  74. char *dmabufsrc2 = NULL;
    ' i6 o2 E3 r; p5 H! Y
  75. char *dmabufdest1 = NULL;
    : G% O; N6 m2 y% N: F; i
  76. char *dmabufdest2 = NULL;! f, g9 M0 R3 V

  77. + H! |( S6 o* T
  78. static int acnt = 512;# ]+ U0 C( g! I) ^; H
  79. static int bcnt = 8;
    6 c/ O6 a3 _7 b. r. F
  80. static int ccnt = 8;
    1 P: ~/ j1 N9 ]$ K

  81. " E; w; c) ]' p9 c6 d+ H/ H
  82. module_param(acnt, int, S_IRUGO);6 }- g# q9 g5 |( m) g
  83. module_param(bcnt, int, S_IRUGO);  s( j1 y6 w  G4 e) O8 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 z9 q, s* Y% J* B  H1 U3 \+ \5 E/ A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% V0 S# A, F! _6 t* Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 O- R. U5 @" m# g- _7 q6 C9 D' C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  K5 q! G3 h+ i8 R3 x# r$ S* g7 z0 B- q6 c

# j8 y+ Z) T- v9 g3 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 13:47 , Processed in 0.040474 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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