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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , H; `/ N+ ^# q8 e& N0 a
  1. [code]EDMA sample test application  V: z6 b( `' j/ ?1 N$ H
  2. /*
    " D3 E- G! I( u) S! A2 S
  3. * edma_test.c3 Q+ W* y! }: i9 G4 l  s. N
  4. *
    1 J& f8 @. t) M2 [, ]( C
  5. * brief  EDMA3 Test Application
    / }: {# r: G/ H0 Q% S
  6. *
    ) U8 W$ @$ H- E8 [' y, D- }
  7. *   This file contains EDMA3 Test code.6 O+ L  s: T# b# Y" B$ H/ ~" A8 ]
  8. *
    % [5 F' g/ V! x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 w( k! O4 R$ P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 Y* _. {0 ^5 n0 I7 r: h8 v
  11. *         TO CHANGE.; T' d' m# D0 g6 ?4 A- ?
  12. *1 \3 w  g( v; o2 h, Z. L6 H; J/ N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' i5 ^6 f8 S" K9 R0 X2 Q9 g- F
  14. *9 I+ b+ Y4 }3 T4 E5 t8 u
  15. * This program is free software; you can redistribute it and/or
    1 W, g" v+ C" I/ G7 n6 D2 Z
  16. * modify it under the terms of the GNU General Public License as& I0 P1 k, ?! L6 s
  17. * published by the Free Software Foundation version 2.% A' N2 ^, W5 r8 R" w; P$ j
  18. *6 @& S/ \! i- @/ n* o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( ?1 k7 a. c3 H1 |" H' P
  20. * kind, whether express or implied; without even the implied warranty
    / E1 @! O1 w, W! _( m3 o5 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 W. U! z+ f" ]# U! r
  22. * GNU General Public License for more details.
    7 n$ _# ?7 _# e$ ~5 h
  23. */
    % H! [' l, |! n* l, @8 ?# g

  24. 8 u0 K3 K: y& y* Q3 G
  25. #include <linux/module.h>- J* Q/ W7 t: e5 [+ a% B+ b
  26. #include <linux/init.h>
    2 ]7 G1 U: R% ~
  27. #include <linux/errno.h>
    * d  m# E# G/ r1 r
  28. #include <linux/types.h>
    ; b, s) n; v- m# R
  29. #include <linux/interrupt.h>
    7 z/ A$ g  h7 O' c% S* j7 C+ f
  30. #include <asm/io.h>" Q3 U4 P; x; _- [' }5 x
  31. #include <linux/moduleparam.h>
    2 B4 Y5 H. C% x9 ]9 J/ k7 I7 V0 p9 I
  32. #include <linux/sysctl.h>
    * D  Q& s; D7 {- G8 x8 [
  33. #include <linux/mm.h>( Z0 {2 [7 n/ m( a+ C0 q% r
  34. #include <linux/dma-mapping.h>
    ! E" D$ E. D" y( n3 A) w

  35. ; g$ K  R2 H1 k  W7 Q$ s
  36. #include <mach/memory.h>
    2 U" m& X! @6 Q9 ]! @; P/ l
  37. #include <mach/hardware.h>
    2 q9 c3 S4 }9 q2 R' z
  38. #include <mach/irqs.h>
      V0 c  y! T3 e8 q( a7 A
  39. #include <asm/hardware/edma.h>
    7 W8 N" V2 \6 a7 B
  40. 7 w: H1 k+ D" J: M% F% Y( @' G9 P. z
  41. #undef EDMA3_DEBUG
    1 f  u" \  `# o8 W
  42. /*#define EDMA3_DEBUG*/3 [; e& `- x! m2 [. v) a9 Z' V
  43. ; A0 t% y7 a. D$ U( T6 q: a, k
  44. #ifdef EDMA3_DEBUG
    ! U  n9 W5 v) e+ w7 ?( e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) E; H" k. ^- D1 x" ^, {' F" ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! ^9 T% [6 D" j; z' h  T8 w% T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): ^* j. g& L  K) }! J
  48. #else2 |' v0 X  V/ _
  49. #define DMA_PRINTK( x... ). x/ s1 J8 a# O0 }* Y5 n
  50. #define DMA_FN_IN
    ; f1 @* |3 k6 _7 G5 t& Y- E
  51. #define DMA_FN_OUT
    : M" J5 j* I- k1 Y5 l$ c" u! L
  52. #endif
    / h0 ?  S8 X  n3 U0 r

  53. 8 h6 \- W0 |0 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * m) j! h0 U; ^4 G' e" q% R% ?
  55. #define STATIC_SHIFT                3
    - a; F& h" v) ]) e8 y8 J6 l: V  c
  56. #define TCINTEN_SHIFT               20) E7 o( ?, i+ a$ }% K. r
  57. #define ITCINTEN_SHIFT              213 j6 Y$ F( l. T/ |
  58. #define TCCHEN_SHIFT                22
    # s/ M5 O9 d+ [
  59. #define ITCCHEN_SHIFT               23
    - v9 I9 a; \! w$ K" `

  60. " V) T9 l. t" i! g! l/ I
  61. static volatile int irqraised1 = 0;( [& n6 \/ m" ?! y5 t- Y
  62. static volatile int irqraised2 = 0;. ^. J' ]( L/ S! I( h+ I5 }- ^
  63. . d9 X$ y7 R# `% g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % h0 m! u% }9 w* E, C3 N; L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / w2 @, |# z4 J9 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& W* ~# g* t: |
  67. 7 |- P3 [9 ?, e, R2 p9 [
  68. dma_addr_t dmaphyssrc1 = 0;
    5 R: K6 Z& I; n) b. T; L" Z
  69. dma_addr_t dmaphyssrc2 = 0;! k/ j) F! i: K) k) r
  70. dma_addr_t dmaphysdest1 = 0;
    : V0 m8 [3 f& t1 X
  71. dma_addr_t dmaphysdest2 = 0;
    3 S8 O0 l' G! P, e2 o; I% X" |, b
  72. 0 c0 f& n" k* y
  73. char *dmabufsrc1 = NULL;
    5 m( T6 K# X$ e" p, s* u* K' t
  74. char *dmabufsrc2 = NULL;
    ' I8 ~$ M  Q! K6 g4 G3 T2 q9 ?, ]! Q
  75. char *dmabufdest1 = NULL;$ R: f+ K" b2 i$ j2 {# L/ z- \
  76. char *dmabufdest2 = NULL;! @" i( |6 e  n# H! A% V' _

  77. " ^) L; O; E" ?* E: D- E$ Q
  78. static int acnt = 512;
    " b  q$ N" h1 C
  79. static int bcnt = 8;% R+ b" t0 K1 j% d4 {/ b
  80. static int ccnt = 8;+ b' w3 r! }0 o  \
  81. $ g% g$ D1 u2 \
  82. module_param(acnt, int, S_IRUGO);
    : U& [- z; I) l( l/ d9 V# G
  83. module_param(bcnt, int, S_IRUGO);9 V+ V+ h" H, F9 ^7 j* P, y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, a: I5 H! l1 e; d# b' d
/ b* R8 s" p6 e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: o5 k" r, [1 D7 Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 Q2 Q4 Q6 Q( G. ]2 S% I, _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" u+ m: _8 y) z8 O& y8 u* w. C7 T$ V- I
: q, R* r- T: ]& |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 08:58 , Processed in 0.037015 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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