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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 Q3 T8 c8 K! t9 Z6 \  n
  1. [code]EDMA sample test application* f! }! c# o5 l5 Z- {
  2. /*
    & M" I: A  A) E" f0 K5 z
  3. * edma_test.c
    : I! M/ [+ J1 u! f4 W" t$ J
  4. *+ Q0 `- q* l( w" H! m
  5. * brief  EDMA3 Test Application9 g6 Z) B! L, j+ L( |) C1 ?
  6. *
    % C  D6 {! j: I3 t6 F0 d
  7. *   This file contains EDMA3 Test code.
    . a1 D+ I; p7 C# d8 c* `
  8. *
    5 c4 R8 r! e9 H+ l* I8 L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( g7 `: G( V6 |3 T4 j+ O* y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , {7 }( d9 Q( ^
  11. *         TO CHANGE.3 x/ }5 n1 i- S0 L4 A6 i
  12. *# n" ~/ G* N6 h( T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: _% Z5 w/ K7 A0 [* _
  14. *
    ; q  O6 P- e, W# i0 _1 h: \  o
  15. * This program is free software; you can redistribute it and/or4 s6 i  d- a. s) R
  16. * modify it under the terms of the GNU General Public License as3 i+ D2 d: J. I2 Q
  17. * published by the Free Software Foundation version 2.0 i0 D1 \. d9 E, ~0 P- y
  18. ** m! J* H- C* z  X" m/ z6 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , q8 M* P) ?. p  t9 y+ y
  20. * kind, whether express or implied; without even the implied warranty, ]! B6 Y9 ?2 t5 Q/ _' {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 M1 ]) u! o/ B$ G. u2 I
  22. * GNU General Public License for more details.
    # ^3 E/ ?; L+ E/ j# o
  23. */
    % f1 A' E+ }% P" I$ q  s
  24. 7 {9 \2 G6 Z8 g! [5 ~: ?
  25. #include <linux/module.h>- W- U, y. y1 ~: d  G( K  s) D
  26. #include <linux/init.h>
    7 \  @2 F5 l# q! d; m
  27. #include <linux/errno.h>
    & K+ [1 R, o1 ]* p
  28. #include <linux/types.h>
    0 _* Z0 \* O1 Z/ \! k
  29. #include <linux/interrupt.h>7 U( u! O8 n) c& B" `$ P
  30. #include <asm/io.h>2 B8 B: L; s8 Z
  31. #include <linux/moduleparam.h>6 s% ^5 U( Z( @; ?0 N8 D
  32. #include <linux/sysctl.h>
    8 B' g1 H" g& v5 f/ D! b
  33. #include <linux/mm.h>6 ~/ K4 m  R; X. x( i9 Y
  34. #include <linux/dma-mapping.h>
    8 n0 z( ^/ [6 [4 \/ o  b% y; ?" s
  35. 6 I8 j# D+ J7 f$ T
  36. #include <mach/memory.h>. W# C0 n) K! b- J; Z, P5 U
  37. #include <mach/hardware.h>5 K; c2 J+ j  ~8 l3 }
  38. #include <mach/irqs.h>. {" P9 Y! b0 H
  39. #include <asm/hardware/edma.h>
    ! V' j& |# m( {% H3 Y
  40. 9 O3 Z" G+ c4 A: Z& m* R; z) g# j& J
  41. #undef EDMA3_DEBUG  D3 s; \1 w. h
  42. /*#define EDMA3_DEBUG*/
    - I& w4 D# f$ t1 f1 V

  43. : h; _0 O6 _; W+ s  v3 g
  44. #ifdef EDMA3_DEBUG
    " h3 C9 L2 L/ t* w9 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); x/ g" f) S3 U4 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ x/ e) N4 n3 u5 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ Z: [& R% E0 y7 v4 n& ^! c
  48. #else; {3 G9 H: T: g& V/ w0 P. X
  49. #define DMA_PRINTK( x... ). A( X: [- o6 @, J* }( K
  50. #define DMA_FN_IN, a- ~3 s8 J6 a! F& ?- p
  51. #define DMA_FN_OUT! v2 j8 i4 n5 A3 U; m$ j
  52. #endif5 I( C8 Y4 T$ |( R

  53. $ a% a) N7 ?/ s1 n/ B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- A; f6 B1 R# M' c% w8 X  x
  55. #define STATIC_SHIFT                3
    # f6 n9 W. _5 r1 J7 n% |
  56. #define TCINTEN_SHIFT               20
    0 ]6 Z- a# G) I; t! E6 b
  57. #define ITCINTEN_SHIFT              21
    : f# R5 H3 c2 I2 C# q7 Y  L2 a
  58. #define TCCHEN_SHIFT                22
    # z: Y% |6 A1 n
  59. #define ITCCHEN_SHIFT               236 H" q! m! P$ j! U  b

  60. ! L. p- }- v+ {3 u& d' K; W
  61. static volatile int irqraised1 = 0;
    ; j( z- n" V* H  S+ q1 i" r
  62. static volatile int irqraised2 = 0;
    # j/ g  u# l' n/ R% m0 M' n0 A

  63. % m$ A9 i6 W% {# ^. Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' F: u! j2 k" S5 s4 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, o* g1 Z' C9 P2 M+ n3 W2 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. m8 N; ^& }4 M

  67. 2 i. b( k. b: c3 v
  68. dma_addr_t dmaphyssrc1 = 0;* Y" S* L( |$ t4 I0 A
  69. dma_addr_t dmaphyssrc2 = 0;
      P& Z0 J( W( b3 p( P2 V
  70. dma_addr_t dmaphysdest1 = 0;
    : i% z6 l  l. g5 e5 H* t5 \/ @# D
  71. dma_addr_t dmaphysdest2 = 0;  G- a7 k& [0 T& T5 Y% n) s% y$ z
  72. 6 n; S$ }- F. P0 o5 a
  73. char *dmabufsrc1 = NULL;
    . ]0 M7 ]* Z1 Z& |5 G
  74. char *dmabufsrc2 = NULL;
    / k5 z0 o7 P* p* S5 K! J
  75. char *dmabufdest1 = NULL;
    / P4 X7 Z- P6 O; T* w
  76. char *dmabufdest2 = NULL;
    2 R9 y, Q7 P) ]+ P

  77.   \6 E$ t4 B& ?( d8 ?
  78. static int acnt = 512;
    ; N  k: C. ~8 C% L. C" O
  79. static int bcnt = 8;5 X2 ]+ I# Z! I, R; E* s
  80. static int ccnt = 8;  A$ o, r- F" z" F
  81. ! ^1 V4 C* r3 ~( N, E7 ^" J
  82. module_param(acnt, int, S_IRUGO);
    & w7 |& h9 b# M
  83. module_param(bcnt, int, S_IRUGO);
    . m& h( K: E2 J+ l* Y  K% y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% g" j' e6 U! g% v

5 L& o. D+ ~; t& x; t' h4 x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 _5 w) r$ k/ S; T5 K9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 z  Q. J/ b  D3 A; p9 u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 \. |) M# h# a6 {# z3 ?) o' s

8 y+ j7 J2 ~! O1 I# U2 w) f3 |: J/ x, H3 r" @+ F3 T: B, F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 17:32 , Processed in 0.043886 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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