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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : L7 ^( x3 g6 F2 r  A  X
  1. [code]EDMA sample test application
    ) R; F& u7 u. P7 G
  2. /*
    . [1 Y' f0 O3 E! O
  3. * edma_test.c
    , L+ b* I, u; L# c7 D; A0 Y1 E, ^
  4. *
    ) o. l. Y6 S$ h$ h4 a
  5. * brief  EDMA3 Test Application
    2 V; t" h8 v* T! k4 [% u0 Y* B1 R
  6. *
    2 o- E/ L7 p6 M6 O/ Z
  7. *   This file contains EDMA3 Test code.5 E" N' Q) ]( @" J4 T
  8. *' B6 ^) T- o$ Y7 f; m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ F( T0 e. d# M# Y. G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- k; s9 \6 K" |' t
  11. *         TO CHANGE.
    + Y$ C6 Q: @$ t* {+ m
  12. *
    ! _  _' f" h* \! C. M# K7 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + V8 K9 n' S9 Y% d( _
  14. *" L6 V3 |6 i  r- e* X
  15. * This program is free software; you can redistribute it and/or
    : x1 h- s! g1 r: A& y  |
  16. * modify it under the terms of the GNU General Public License as( n( e0 d) L& i
  17. * published by the Free Software Foundation version 2.
    # v3 P& c! i) ^! a" y5 r4 f0 U) V# \
  18. *
    ; ]3 O# K: t$ j! B. g5 T% S) E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' z1 S4 J- e4 g9 B4 I. ^
  20. * kind, whether express or implied; without even the implied warranty  x+ a' c/ d3 D" _' F% l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! j, g5 n; r3 Y' H' Z
  22. * GNU General Public License for more details.- x& L7 ], p' l
  23. */1 F' H6 Y# w( k7 R, Z. O2 H

  24. ( v3 A% H  J  s
  25. #include <linux/module.h>2 v+ W" v' n) d6 F  D
  26. #include <linux/init.h>
    , n; Y# A+ Z: A
  27. #include <linux/errno.h>! p" v4 S' Y( e# c$ |: h( w- z
  28. #include <linux/types.h>( `3 g) `" S3 ?- E3 I; L7 y: K
  29. #include <linux/interrupt.h>  `# ^6 w+ I1 M3 o: _6 O
  30. #include <asm/io.h>
    6 V2 c) D5 ]4 u! E8 X6 w; R( z1 c$ F
  31. #include <linux/moduleparam.h>, e' o: E0 Z/ E( s# g/ h" n
  32. #include <linux/sysctl.h>  G, @8 Y% D5 R0 w/ |, N8 M7 d. j
  33. #include <linux/mm.h>
    6 a' \+ N$ J% s8 g
  34. #include <linux/dma-mapping.h>
    2 Q4 N+ B' O, Z! O! N8 H

  35. 2 f; y) e% R; |
  36. #include <mach/memory.h>) q& m) V: r$ p; C: d) b8 u
  37. #include <mach/hardware.h>$ [6 m) V0 r% H) k: w) R
  38. #include <mach/irqs.h>
    / r7 \& G4 E- a6 o
  39. #include <asm/hardware/edma.h>
    # `" x3 Q7 M7 |
  40.   q; _* t0 y5 s& d& S" O5 `" _9 ^$ ?: s( U
  41. #undef EDMA3_DEBUG+ M1 `' J$ ~8 t8 v" Q+ s, O
  42. /*#define EDMA3_DEBUG*/% E. G* P, T" {6 y0 p& @5 |

  43. % ^' c0 Q; l; B  S' p
  44. #ifdef EDMA3_DEBUG+ F  z; c- Q5 r+ `' C2 @" E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  g: q  U0 j' G2 P1 p6 {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& O" C6 N- B6 \9 J, i+ w' p" X* h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( Q' i; G* K8 N% p5 F1 q
  48. #else3 o$ n2 G* l$ T' k; l8 C* t0 \
  49. #define DMA_PRINTK( x... )$ Q) H% f+ V. B+ P1 }7 U6 v
  50. #define DMA_FN_IN! C" N5 V! \) O: ]8 h6 g  p1 N
  51. #define DMA_FN_OUT
    / C4 B1 |1 k0 x+ l! a
  52. #endif- d3 U* }1 d3 i  e- R( R- n) Z

  53. 4 z/ I7 x. K$ x; h0 D$ Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " Z5 ^1 @$ n! x7 d3 h8 {5 U
  55. #define STATIC_SHIFT                3
    # f  R8 x9 X( J: p, B
  56. #define TCINTEN_SHIFT               20
    ; H2 f9 F+ U& n( \2 C# l, H. v2 z
  57. #define ITCINTEN_SHIFT              218 m1 w9 ^" N1 V. P' N% Y
  58. #define TCCHEN_SHIFT                22
    , F) U) h  Z7 `) _& ?5 ~* q
  59. #define ITCCHEN_SHIFT               233 i  W# L. Y% l4 {7 h/ S
  60. ; C2 z) p1 Y$ O. A. ?( W
  61. static volatile int irqraised1 = 0;
    ) k6 d# v8 N* s; x5 ?
  62. static volatile int irqraised2 = 0;
      i+ Z  \7 x& B: P5 I- h

  63. ' Z& _& x. L; K3 A, W* N  R5 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' G: X  M# H6 G/ E2 I8 d* g  U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ c# [- X  Z2 M- W( [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & W. s& O7 K- T
  67. % e+ r9 d+ j  A9 {) y& ~
  68. dma_addr_t dmaphyssrc1 = 0;
    7 k  B8 ], s% O2 m
  69. dma_addr_t dmaphyssrc2 = 0;
    : n, @& m. X, a: Z
  70. dma_addr_t dmaphysdest1 = 0;6 n; p) F) T5 Y! c
  71. dma_addr_t dmaphysdest2 = 0;5 Z# y& @  Y6 g. r: Q

  72. 4 @9 u# e" [  z( Z7 R9 O
  73. char *dmabufsrc1 = NULL;
    & |0 f$ q- ]/ t! U6 }  |0 U& @
  74. char *dmabufsrc2 = NULL;6 ?  x5 T9 C2 O0 {$ W+ h
  75. char *dmabufdest1 = NULL;
    ( l+ N1 U$ L% q( i4 y) o& ?  j+ `
  76. char *dmabufdest2 = NULL;$ I3 l: V' _0 c/ B3 ~1 S$ R% M# L( y
  77. / G. J. q# z: d4 V5 E3 P  t
  78. static int acnt = 512;' M; R. z. |0 R) V% N
  79. static int bcnt = 8;
    # c6 A8 m" [% _7 g
  80. static int ccnt = 8;
    ' z6 J2 |: }; E; o& M7 \& f7 a
  81. ( J) ^7 s) ]$ {/ M" q3 V. R
  82. module_param(acnt, int, S_IRUGO);5 X1 x7 B8 b; ?. Z8 J' G2 ~
  83. module_param(bcnt, int, S_IRUGO);
    , w* j" [% N  G- W% U0 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% m! L8 \/ {4 D$ l
1 e6 e5 B' {0 c3 m) o- I2 q  q8 L: e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* J' P( a7 D2 A- E: z' ]0 R- f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; U: s1 i7 W8 g) Q; t3 d3 j4 \3 o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 Y$ B) L! m- s
+ O7 \' G& B2 o  p5 b, ~7 u; @
% H8 m: ]* {; Z9 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 14:56 , Processed in 0.040298 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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