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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ R9 S8 p1 S$ v. f8 L7 @
  1. [code]EDMA sample test application' A7 Q4 \( S: M0 M% Y% X
  2. /*
    ( C: K+ m$ M' L
  3. * edma_test.c* G' f; [5 ?0 N' ?- I7 R0 N
  4. *
    ( I' W* [- ]  n; ]6 P' x6 w; p# H
  5. * brief  EDMA3 Test Application
    3 G- v  a, K% A
  6. *: L. I8 H. i5 e+ C- W2 }! [! D( o
  7. *   This file contains EDMA3 Test code.
    9 `- h: ]7 g+ Y9 \' Z& i7 R  K
  8. *- S3 O4 z$ q4 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. ]9 G, `  [6 c$ r7 u0 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ y5 _6 N3 M& W* k) e4 {  R# W
  11. *         TO CHANGE.! g4 \1 N/ X; H; z
  12. *
    + J) @6 e8 R' u6 K2 r; Z7 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * B1 H  @% D. M5 L
  14. *- l: _( S+ w1 f5 H2 {& M$ L
  15. * This program is free software; you can redistribute it and/or% d: |2 v8 ]# `: A7 b+ c5 ~
  16. * modify it under the terms of the GNU General Public License as( P7 y# b% \+ g5 V2 Q% C( W
  17. * published by the Free Software Foundation version 2.
    7 U. s7 ~8 T, h2 e9 u( b
  18. *. L8 l- @% e' E3 h: `0 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: e- ?* E5 x5 M# P4 N3 b
  20. * kind, whether express or implied; without even the implied warranty
    + H8 ]- p# v6 |1 P) w, _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - B: Y2 h4 s* A" \( v0 P
  22. * GNU General Public License for more details.
    ( H7 Z, x3 x" s" h$ X
  23. */
    % _: A: r# N/ \% N/ S* ~
  24. ) X1 l2 @& d% ]* K. u! J
  25. #include <linux/module.h>
      Z7 R5 a; G/ T2 T
  26. #include <linux/init.h>6 h! J: r4 c6 m5 u6 Y$ ?
  27. #include <linux/errno.h>7 t2 @" ^, @1 o$ x* W! g% ]& ~
  28. #include <linux/types.h>
    3 M6 r9 B: d0 ]. q( w' t, b' D; D4 A
  29. #include <linux/interrupt.h>
    ! h* O2 u. m  z+ ?0 c
  30. #include <asm/io.h>
    5 }/ M( z6 e+ e5 n) s8 D: L, y
  31. #include <linux/moduleparam.h>
    ( s, v* A0 @. t7 Q& ~1 w& j6 ~
  32. #include <linux/sysctl.h>" t4 Z! Y) K: U0 P- J# k$ v
  33. #include <linux/mm.h>
    , o7 e7 I" d& g3 H( g; o( y
  34. #include <linux/dma-mapping.h>( z: J% h; n' V# `# d) O9 u
  35. " N) I9 M1 u8 _( c% k
  36. #include <mach/memory.h>, R% X# p7 P+ s: j
  37. #include <mach/hardware.h>
    . S$ m) K# a" b& [* p
  38. #include <mach/irqs.h>
    4 b3 b  ]4 X! d& k
  39. #include <asm/hardware/edma.h>2 c2 Z  }, r+ s: A; X

  40. & i# h6 v+ j: `% ]
  41. #undef EDMA3_DEBUG/ }% K& I5 X! D, ]! ~
  42. /*#define EDMA3_DEBUG*/
    * B6 d7 U1 @8 s8 b" T

  43. . \) x/ Q& t3 Y1 _! P
  44. #ifdef EDMA3_DEBUG
    + f* W3 ^+ M7 W+ J6 p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' i7 i+ H# r7 O- Z8 O% |# H/ L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), T0 Q6 y" Q; c# c; q  b6 r& U- ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . Z1 S+ U: P! `0 C2 y0 I
  48. #else
    + A0 G- {3 v+ P2 P8 b$ A
  49. #define DMA_PRINTK( x... ). Q; n* H4 A7 G6 L1 {( t8 o
  50. #define DMA_FN_IN
    ( k' s3 e$ ~7 B4 g" i2 N) ?
  51. #define DMA_FN_OUT2 e: c9 ~" g6 h$ w. S2 r  q6 W, V( N
  52. #endif
    8 J% O4 R/ S. q

  53. * B8 j5 L* E0 k0 O# g1 B8 W" s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). h5 W4 A; `7 t; I
  55. #define STATIC_SHIFT                3
    . Y( R/ ]" S4 Q# A! b3 \" ?
  56. #define TCINTEN_SHIFT               20) K- t) F- _0 a3 }! \: [; h: w
  57. #define ITCINTEN_SHIFT              21, u0 m7 d) Z) @( k7 |& R" z
  58. #define TCCHEN_SHIFT                22! Z/ d0 x( [  z0 C
  59. #define ITCCHEN_SHIFT               23/ K8 e/ F' P0 M! j

  60. 4 x) ~  ?# h# Y
  61. static volatile int irqraised1 = 0;3 X. f. |2 V1 u  l
  62. static volatile int irqraised2 = 0;8 E, b4 B) Y' O* }3 p

  63. - e8 E0 b6 u+ u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 q; Y, V3 N+ G" }, y7 U' ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 u+ B( X0 X7 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / k; d4 Q+ I3 E, x" Y3 o8 d7 [/ V

  67. % K. {; l  T+ ?, v: Y; Z
  68. dma_addr_t dmaphyssrc1 = 0;! }: {* A3 N+ c$ _  U
  69. dma_addr_t dmaphyssrc2 = 0;$ `. ^/ q/ f3 M& U5 X: O7 a; c8 I! Y
  70. dma_addr_t dmaphysdest1 = 0;
    " K; R5 d5 |" Q4 v) \7 o
  71. dma_addr_t dmaphysdest2 = 0;
    2 r( m, E2 q( X. O. w

  72. 6 t0 ^- j  G) Q8 Y' ]: N
  73. char *dmabufsrc1 = NULL;
    * M1 @1 x$ i( s3 e2 `' x$ I& i
  74. char *dmabufsrc2 = NULL;' |. R% w7 f: m. H% q
  75. char *dmabufdest1 = NULL;' m" ]$ e) A' \3 y+ ~- ~* G
  76. char *dmabufdest2 = NULL;" a+ D$ E* E+ j; t" W
  77. 4 }# |! I9 _% P+ |3 i
  78. static int acnt = 512;  x( H& I" f  @# r6 H
  79. static int bcnt = 8;
    4 u- B. I$ R: K+ B
  80. static int ccnt = 8;, l2 a+ J6 c8 S5 W& p
  81. 5 N0 e! b8 X- q
  82. module_param(acnt, int, S_IRUGO);: [7 b/ {) [' `6 D) A) c7 _+ g5 C
  83. module_param(bcnt, int, S_IRUGO);/ M% u! o7 t& h8 T' C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' M+ H. S  _5 [5 A. I- p$ k/ l6 ?* g6 y5 ?4 b: _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: Q' b1 p' h8 @$ ]/ d; G  narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 ]' n* O# ^2 }0 D7 n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 u3 p: z8 Q( K( p$ r, [0 \$ L
" z2 X- t( ~' `+ i+ R3 F; r3 m
+ j  s# s5 p, p+ h" j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-15 06:22 , Processed in 0.037196 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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