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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. J) G/ t* i! H9 ~
  1. [code]EDMA sample test application
    + F+ n* A' V4 d) B) h- B3 q0 i
  2. /*
    - G2 H5 T! V1 k- N% V
  3. * edma_test.c# x" h7 Y6 z2 E/ l4 M
  4. *
    ' |! ]( z, F- l+ a+ }: E9 n
  5. * brief  EDMA3 Test Application
    0 C# t% v. G- e5 ^. U1 v  ?
  6. *% f  }4 }) N- F# B1 n
  7. *   This file contains EDMA3 Test code.2 _7 u* Q7 e6 I) J3 i: l9 O
  8. *  H5 A/ C0 }9 \+ ~; q  R3 i! y7 c! P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: u; u0 s& M* F: B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( D' I6 X; e9 r( ]% f$ q4 O& K
  11. *         TO CHANGE.
    # V0 {% i' ^/ }; Y
  12. *
    4 ]) ]) E* l. k% l' M2 ]; N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / V. ?: m  D: x' p
  14. *
    4 b; E+ f+ r. d3 }
  15. * This program is free software; you can redistribute it and/or
    4 O: V4 ]8 }3 i" o! r
  16. * modify it under the terms of the GNU General Public License as
    0 s2 A' K' P9 [5 l: `
  17. * published by the Free Software Foundation version 2.! O* O- I* Y6 u* u3 s
  18. *
    * \* g4 f4 I1 C) ^; v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) [5 g1 b! z* I" }0 q/ B5 G
  20. * kind, whether express or implied; without even the implied warranty
    ! O, k% k5 K+ v( t, K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 f' o4 N: W: f5 k# v& k9 D
  22. * GNU General Public License for more details.3 _) H; `+ C- O  E8 I
  23. */
      L! J5 ^3 t: `$ I2 L4 [$ a

  24. 0 T3 F. ]5 R% ?
  25. #include <linux/module.h>* [4 E! i/ a7 s6 k  B. V% A; s' L! Z
  26. #include <linux/init.h>
    , @" ?# X+ _* j
  27. #include <linux/errno.h>
    * Z+ a4 K. i9 k9 u4 a' Q
  28. #include <linux/types.h>
    1 @) V& O* u- y+ d4 `3 ?! M
  29. #include <linux/interrupt.h>
    6 Q1 \8 e; J  x/ l* u! U8 p
  30. #include <asm/io.h># [2 K1 Y" C, n$ s, b
  31. #include <linux/moduleparam.h>) S7 ~' a7 \4 |- h  e2 i. T
  32. #include <linux/sysctl.h>
    % _) T3 M/ b* i7 ~
  33. #include <linux/mm.h>
    $ R: I5 e, {! D9 f" L+ O/ t: l
  34. #include <linux/dma-mapping.h>
    - H: U1 C& j* l6 b2 b

  35. * ^2 Z! G# S4 P
  36. #include <mach/memory.h>
    # k8 Z3 T) H2 A* ]% }# r( `
  37. #include <mach/hardware.h>
    - ^& o- B% T" X! v
  38. #include <mach/irqs.h>! k/ g, t& ?* j& B8 g' H- u" R
  39. #include <asm/hardware/edma.h>
    8 h: K. P- c$ P* D& G5 G

  40. ) Q( z7 {$ e* O
  41. #undef EDMA3_DEBUG+ P* V( e. {. O  I! h! R3 k1 }. |
  42. /*#define EDMA3_DEBUG*/2 X  ~/ C- _; X+ K" P
  43. 8 G" J: i9 ]; I! `  M' F& U
  44. #ifdef EDMA3_DEBUG
    ! V! Q$ E$ C9 j1 ^4 B% V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! d- i+ B& d, K( ?' A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( H1 L( U- [- q1 d" J! b3 h) D; w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 p. |3 j' R. b0 k. c0 b" m
  48. #else0 b# `9 W4 F) {+ G  `6 F5 A) p; Q
  49. #define DMA_PRINTK( x... )
    1 v! W: c2 y0 E7 K' n4 D5 S/ X4 g
  50. #define DMA_FN_IN
    + t! U2 K! G" [3 j% c" i$ \
  51. #define DMA_FN_OUT
    : m; j: A2 f9 U, P) v
  52. #endif6 A/ T9 \' ~! \0 U/ h

  53. 9 x$ M; P6 _% V3 Y+ F/ k2 k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 l5 [2 W1 i& V6 l+ _
  55. #define STATIC_SHIFT                3( y/ @  L6 L) N, j1 l& Z
  56. #define TCINTEN_SHIFT               20. t8 F1 C6 R% J4 |
  57. #define ITCINTEN_SHIFT              21
    - [9 c3 g! t2 `
  58. #define TCCHEN_SHIFT                229 Q( w0 E& U9 `* y
  59. #define ITCCHEN_SHIFT               23* Z1 N' z4 k2 E7 v% i- T5 p
  60. . V% K8 z& _  W% ^. I9 V
  61. static volatile int irqraised1 = 0;
    & c; V, S" M# m2 v; A
  62. static volatile int irqraised2 = 0;- X; D4 {: o0 Q$ O' X) L) C

  63. 3 G* R6 p' }, {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Q' v; z8 A3 f# X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 y0 H# r7 k, p0 o/ c, o. e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 Z. x& v& K! P# F9 h6 I/ m: {2 K

  67. ) ^6 @5 u, x) o! P) F
  68. dma_addr_t dmaphyssrc1 = 0;; \9 N/ ~2 R$ `- }) j8 `
  69. dma_addr_t dmaphyssrc2 = 0;
    " A' Q; Q7 H% P6 R, C7 n! ?% F
  70. dma_addr_t dmaphysdest1 = 0;
    ' K6 c; T9 I- d4 g& ?
  71. dma_addr_t dmaphysdest2 = 0;
    ! W0 P' H/ ?4 a+ }

  72. 1 b: j5 S3 v8 M
  73. char *dmabufsrc1 = NULL;! ?9 t' f$ a% W) I4 P# r
  74. char *dmabufsrc2 = NULL;
    8 R! V' n9 Y% C3 A( v4 z1 f
  75. char *dmabufdest1 = NULL;
    - Z6 B3 ?: k; R3 P# z2 z( E0 l
  76. char *dmabufdest2 = NULL;
    8 N* M$ S1 ?; d, [, I" z0 d3 o
  77. 5 A0 H$ M. @$ }3 x! y( T
  78. static int acnt = 512;
    6 b7 A$ h4 Q0 O2 R7 Z: ^+ ]# t
  79. static int bcnt = 8;
    ! a7 E- U3 O+ V
  80. static int ccnt = 8;
    / Z# ?  d. t. u' D6 @7 N: l+ ?

  81. 5 E/ ?3 ?1 @( }0 h$ @' `' ?
  82. module_param(acnt, int, S_IRUGO);- Z* c4 {' t1 w0 R; L
  83. module_param(bcnt, int, S_IRUGO);
    7 }. z  l6 _2 V' j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 U6 _; |6 H0 T- J" J* X. @

, b# X& k# u; n% _: r2 g6 p! R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 B. o+ S; h: N. Z& s  v" c5 o7 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 K1 Y$ j5 @! I% [8 y, Z' O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) O  Q: [+ K6 T4 W2 ?

6 U! a: o& f3 k% F6 @: T; J
3 g3 \  F7 o6 e$ [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 00:19 , Processed in 0.040729 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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