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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' G6 T" q: n4 D, G+ U
  1. [code]EDMA sample test application7 |) E6 q: }9 M; P2 n0 a0 d' l
  2. /*
    . T+ D% ^7 I# O, z8 T) @
  3. * edma_test.c
    % _: d5 D0 h$ l9 m& M$ v
  4. *
    4 s# l8 X% V! V
  5. * brief  EDMA3 Test Application1 y& r! g8 H& c
  6. *' q6 @( _4 N$ ~0 k( B- [+ a+ k( c
  7. *   This file contains EDMA3 Test code.
    & O7 U* m+ r9 @7 R$ J. i
  8. *
    ; P* Z4 ?: K# q" S( p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # d5 W- Y* C' i6 ^* |. C' `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , [! g6 `# [6 B- c& c7 s# L% u# w
  11. *         TO CHANGE.
    # W, s2 A/ q# s- E1 @" G
  12. *
    & m$ r2 E! ]+ n% z$ x8 q( _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ K; ^6 I- t. h% u& p
  14. *% ^+ b1 A# L, e" |$ `4 Q2 h
  15. * This program is free software; you can redistribute it and/or0 W& y( [4 y' W8 [1 t! T
  16. * modify it under the terms of the GNU General Public License as
    6 \% t. w* p5 ]; X
  17. * published by the Free Software Foundation version 2.
    9 l# |5 h' [/ V
  18. *. ]' v9 S( l4 R! N/ L4 a& P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 _2 w: ^( x  X6 E  }
  20. * kind, whether express or implied; without even the implied warranty7 ~. I: @8 S) a# k0 X# V5 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * M7 W$ E& P8 f/ {! m- x- q
  22. * GNU General Public License for more details.
    % O( R4 d' C2 B( \  W& s2 k
  23. */& r* c* R# ~  V1 M. [) ]) G
  24. - N- w- r1 x) G" x% N# X
  25. #include <linux/module.h>3 s& U7 D6 z' o, |8 [
  26. #include <linux/init.h>5 v5 e/ E0 L: W* Q
  27. #include <linux/errno.h>
      h  }# k  u$ r" B6 ]+ }1 K
  28. #include <linux/types.h>: D- T! t" ]1 I3 R5 e4 q
  29. #include <linux/interrupt.h>
    - s: u, f5 w0 X% M
  30. #include <asm/io.h>
    $ o, W7 [& V9 D# {% K
  31. #include <linux/moduleparam.h>9 Q5 ]) [* m" b. e2 S
  32. #include <linux/sysctl.h>
    5 v! X/ _9 c, t/ h
  33. #include <linux/mm.h>
    0 _5 r) L: w+ q3 H- V0 s- x
  34. #include <linux/dma-mapping.h>! I; Q6 W$ ^! A! v8 m

  35.   [' W* y& ^4 w- |% n
  36. #include <mach/memory.h>/ v5 y  [8 f# K' ?/ f- i8 s
  37. #include <mach/hardware.h>" o/ C3 O' R" M7 `# y
  38. #include <mach/irqs.h>
    6 Z5 D/ q# u1 m; w. Z& C* J$ f  O' Q
  39. #include <asm/hardware/edma.h>& ~  q( K9 K. ]; b& J0 `
  40.   t3 A+ r- d) W4 b
  41. #undef EDMA3_DEBUG
    # ~& G; e3 z# g2 V, _8 J& K
  42. /*#define EDMA3_DEBUG*/
    * I5 }6 B) O) _4 W2 M4 ~: j

  43.   J6 O8 p1 U1 l2 W8 U( A$ e/ A
  44. #ifdef EDMA3_DEBUG! Q, i. B( o6 K) H4 N# s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; Y: [6 K. p. {5 b! }% Y8 t7 v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * o$ g) p/ ^4 c! h& t% p: |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- [5 O# ^) n3 Q1 Y# g7 {. b
  48. #else
    + y- J3 C  G, X* Y% [
  49. #define DMA_PRINTK( x... )
    ) \( o  z! V, H  |. D( f0 @& y
  50. #define DMA_FN_IN
    : Z7 U4 _  ?6 g
  51. #define DMA_FN_OUT. _& g0 u* {( E# O* Z( G/ d% D
  52. #endif" |9 m/ U  S3 t. [" a2 V8 i

  53. & H) U1 e; a3 ^. i" l& l' C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 `+ I( _+ t! _' C
  55. #define STATIC_SHIFT                30 r$ ?5 B3 u+ S$ _4 p0 Q
  56. #define TCINTEN_SHIFT               20
    5 x1 Y( l3 _/ Z# S8 F' s
  57. #define ITCINTEN_SHIFT              21$ ^% u  _; ^# a
  58. #define TCCHEN_SHIFT                227 ^# Z. k- K5 x& q! r% J+ C
  59. #define ITCCHEN_SHIFT               23
    8 j) N: ]) ]0 w( V  g
  60. " S- P' l  M, f' O: a7 p/ u
  61. static volatile int irqraised1 = 0;
    1 @4 i/ I6 ]  N8 Y2 u
  62. static volatile int irqraised2 = 0;: `* H" h3 f3 N$ ^5 H7 r9 d9 }

  63.   B1 i/ S2 Y) n, }0 L4 Y# R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; _3 n! h7 |7 Y* M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 q: o, r0 M0 m- L3 ]! X7 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / p$ h! D' r+ T* |9 {

  67. % e/ _8 s# j3 A' [" p( Z! g
  68. dma_addr_t dmaphyssrc1 = 0;' S: f. G3 X% ]  I2 P
  69. dma_addr_t dmaphyssrc2 = 0;
    2 m+ A: t4 f! G/ M, h$ _4 k7 k
  70. dma_addr_t dmaphysdest1 = 0;3 t# ?: \1 `3 W- D
  71. dma_addr_t dmaphysdest2 = 0;
    % b  w( D2 @! S3 }, H1 I1 d6 w

  72. . O0 w! \+ k2 X  _6 D9 v
  73. char *dmabufsrc1 = NULL;7 [2 s' ^& W5 `5 q3 A; N0 J
  74. char *dmabufsrc2 = NULL;
    . j% T( K3 F* _- f$ v
  75. char *dmabufdest1 = NULL;/ \9 V& [; H% c0 h# q" R, w9 j" b
  76. char *dmabufdest2 = NULL;
    ) P# K7 }9 {& A

  77. % U% j+ t: F( I( l6 b/ ~2 Q3 |
  78. static int acnt = 512;5 U4 j4 E1 `9 G1 x: T6 ]0 L
  79. static int bcnt = 8;+ A6 v0 X* E. G( H# ~: G0 f
  80. static int ccnt = 8;0 P+ E  W# F7 {+ k+ `6 _) l

  81. - H1 \: x0 s0 A% P6 S4 c5 ]! q
  82. module_param(acnt, int, S_IRUGO);
    3 Y) Z( @, M, B
  83. module_param(bcnt, int, S_IRUGO);* g3 E6 n+ y! A1 M. f( }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 F& c& V5 l4 k5 ?& `
3 W( v. Q' H' c* D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 L# N8 Q% D% s# ^5 ^7 [# zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# V: n: Z; j. H0 D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# f9 S, Y! s0 M4 @& Y5 K
, h& X2 T2 q* h" _
) O2 T3 S, T" b( q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 15:20 , Processed in 0.037218 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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