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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( }/ a7 D% Y7 z
  1. [code]EDMA sample test application$ M9 y3 c& e2 y- s* P
  2. /*1 P2 O0 j8 [& Q+ @  x9 I2 `
  3. * edma_test.c
    . J* E5 F+ |% T
  4. *6 j3 {, B, D. R$ t
  5. * brief  EDMA3 Test Application/ D7 Z% n1 R: w7 v$ t) x
  6. *
    ' {  Z2 m5 t3 y+ s, E
  7. *   This file contains EDMA3 Test code.
    ! r4 N) @; N, t- U
  8. *  H7 p, t# C4 x: G& n: q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! G2 \/ i) B; `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! |  O7 C0 U8 A* G; A* ~( i
  11. *         TO CHANGE.
    5 ], X3 S. h6 e2 p! D
  12. *
    , u" q+ }5 S7 f9 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 g: ~2 s3 Y1 [( O  A& e# g
  14. *8 T7 R/ H& d0 {/ e  l$ s+ v
  15. * This program is free software; you can redistribute it and/or
    / D% k9 [8 M$ |4 U
  16. * modify it under the terms of the GNU General Public License as
    1 t' O, A; j& L' ?) f
  17. * published by the Free Software Foundation version 2.2 z+ Q" p8 i: [+ A/ e
  18. *
    5 I9 K( F% O0 W! ]$ D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% S+ S0 X/ U+ M% ?0 |6 B5 U/ d
  20. * kind, whether express or implied; without even the implied warranty
    * B8 ], b# k9 p! t. T0 i( p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& v$ J% _0 |, L7 h8 D
  22. * GNU General Public License for more details.
    + d: q$ c8 V; f3 n. _2 s
  23. */
    0 |4 X2 ~' k! d1 ]6 o1 D" f8 X
  24. 3 Q8 H! u) w8 b. G( }4 J
  25. #include <linux/module.h>
    # y* p1 _" ~/ B/ I( f; I# T) ^
  26. #include <linux/init.h>
    2 |6 j3 x. D; V; Q6 ^* A) [
  27. #include <linux/errno.h>) `2 W  v! D0 O) H) y0 M
  28. #include <linux/types.h>
    ( Z* M' H4 m3 C7 d9 n/ D' t
  29. #include <linux/interrupt.h>
    1 I9 |5 o& v8 Q4 p! D$ n
  30. #include <asm/io.h>
    8 G/ k) N, r5 M: A6 [! H
  31. #include <linux/moduleparam.h>
    ' R+ B  \) ]) c1 D
  32. #include <linux/sysctl.h>
    8 R2 q: F5 Z& u6 m* K  d
  33. #include <linux/mm.h>+ A' p' {$ X& M6 ?( Z/ G: w
  34. #include <linux/dma-mapping.h>
    3 ~: \0 f9 x4 y& u
  35. 5 |* L( \5 K" h2 k: O
  36. #include <mach/memory.h>
    - g' h/ ~3 X6 F5 l
  37. #include <mach/hardware.h>
      Z; t7 O9 [- C; V' @, t. e) p2 T+ H
  38. #include <mach/irqs.h>' _0 k# }- e" R' O2 ^8 l$ e
  39. #include <asm/hardware/edma.h>0 {) Q/ D& r7 ^# W" w4 @. H$ @

  40. 5 e9 _$ ]* [5 D, Q& w6 k' U
  41. #undef EDMA3_DEBUG
    . B0 d" |  m6 w- f* W
  42. /*#define EDMA3_DEBUG*/6 x) N+ O' T3 s# {* v4 N
  43. : O/ _7 w) @7 J3 @" S1 o
  44. #ifdef EDMA3_DEBUG0 {2 Y. R1 C4 s8 U4 v" X: d! ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), f" C, ~5 `- o' o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * [$ U; R  F, G- [( j( Y( A) ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 c) C' [8 C5 y- d8 c) \" t
  48. #else( w0 p& H( s5 C" g# h& s
  49. #define DMA_PRINTK( x... )- V# J8 a0 A8 S* |- v7 v
  50. #define DMA_FN_IN& y# y6 E% z" l. f
  51. #define DMA_FN_OUT/ H4 B% v8 T2 _# R" K+ b0 \
  52. #endif
    - M4 \2 Q+ [& `" H" `

  53. 4 M" l: o8 Q7 p8 k0 _) `, x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * [: p$ R% ~' f2 \" B
  55. #define STATIC_SHIFT                3
    ' K! o; T1 `1 X3 Y. m
  56. #define TCINTEN_SHIFT               20) Y9 M- l0 V, w
  57. #define ITCINTEN_SHIFT              21. Y% ~* T' ?" u9 W) _  }$ c2 v% b
  58. #define TCCHEN_SHIFT                22! r% w, k" L, X& s
  59. #define ITCCHEN_SHIFT               237 f+ h3 `% m. t% U+ i1 M) d$ O6 Z
  60. $ H. f8 ]4 a2 s
  61. static volatile int irqraised1 = 0;; r1 q/ _7 |9 d1 ^
  62. static volatile int irqraised2 = 0;6 X- N# {6 _2 b7 l- b* F
  63. 4 S9 e+ C3 K5 s1 `+ h+ I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % L, W' ]8 k  h9 c0 ?! p( ~% r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 W2 ]6 ~4 l. ~* d3 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) V' D: e; m7 U$ U

  67. 4 K& N  J% o/ P" z
  68. dma_addr_t dmaphyssrc1 = 0;
    ! [- O0 u, D. e) \, Y; ~
  69. dma_addr_t dmaphyssrc2 = 0;0 `* |) L; r$ ?# G4 s
  70. dma_addr_t dmaphysdest1 = 0;4 @  P, Y" A9 J# O9 M. |0 q* ^! A
  71. dma_addr_t dmaphysdest2 = 0;$ b' E+ H$ H. h( L
  72. - |8 t+ R. t$ e3 L; d* q2 @/ U
  73. char *dmabufsrc1 = NULL;
    5 L8 f# y; i5 [. N
  74. char *dmabufsrc2 = NULL;
    ( F+ m; l* T' l, B; S& ]
  75. char *dmabufdest1 = NULL;
    2 ?( w3 |" v7 F: {; G5 y" b
  76. char *dmabufdest2 = NULL;9 `" V: L( h5 a
  77. 9 y( ?4 B$ F' Z6 f& s* T. Q& L
  78. static int acnt = 512;% b0 E) A. F  K( Z% T  Z, u  E1 m  J
  79. static int bcnt = 8;
    . b2 N4 Z! a( M  S$ ?
  80. static int ccnt = 8;; B! T; ]9 _4 R5 A

  81. * h' ^" z7 U, ]  N
  82. module_param(acnt, int, S_IRUGO);
    6 Y) A8 V" w8 e  Z2 O
  83. module_param(bcnt, int, S_IRUGO);
    : [8 Q; ?1 @% G* O: ]- ]6 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ k" x4 G7 w* L5 U. q
4 t; r: n% M4 @+ e- k( x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 v+ ]( Z& J; x# Q$ `% \/ E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ X! @: g9 ]% J# @* a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  |; q5 [( {: A4 @- y

: L0 O0 r, X9 c; X6 ~
7 z* o% P% v) c8 @. I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 08:15 , Processed in 0.039717 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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