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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 R1 ~1 M5 Y$ R
  1. [code]EDMA sample test application0 z6 i1 B) Q% c; W0 m  k% r
  2. /*  W  E2 @/ X5 _5 H) i- D) r
  3. * edma_test.c
    4 t1 g: l2 @+ g: V0 h( h9 z
  4. *
    3 G* ~9 D. t5 E+ ~+ H- p5 }
  5. * brief  EDMA3 Test Application
    4 e! r' O) ~! j9 d. r( J
  6. *
    3 y" h3 E' b- ], S# s( y* T1 |
  7. *   This file contains EDMA3 Test code.
    8 z% Y0 p. \2 r
  8. *- C3 ]+ N3 D3 n) @' Z7 q/ g5 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% B7 y+ h: R& l$ r0 M0 @; Q+ ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 A% d* }8 d' D
  11. *         TO CHANGE.
    4 i# p. h4 }/ f! f
  12. *2 l# |8 s( {4 U4 s4 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 N) |) f* {. v
  14. *
    % V; T5 L, n0 |! \/ ]
  15. * This program is free software; you can redistribute it and/or: o3 r8 R3 t6 i
  16. * modify it under the terms of the GNU General Public License as
      A( e! b7 X" r! g
  17. * published by the Free Software Foundation version 2.
    9 p0 A# {8 F2 Y( p1 J# C
  18. *
    % D* j$ a2 V- F% C' V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # i4 l' j4 \- z: \" `
  20. * kind, whether express or implied; without even the implied warranty
    4 c" c* f9 Y6 d2 O6 P% Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + u1 n5 G$ [, T' Q$ T/ |7 T. T+ U
  22. * GNU General Public License for more details./ q+ a- y  v2 q# M: i
  23. */! u  B" _  t" g) Z) @
  24. ! P- y- v+ x" d) U
  25. #include <linux/module.h>
    0 q9 Z; e0 w. g
  26. #include <linux/init.h>
    ; c; m3 f! M: v- C  H! U7 ~7 Z
  27. #include <linux/errno.h>" n$ m4 W; I- ^3 R- G" m: `
  28. #include <linux/types.h>" s( B. W* u+ g
  29. #include <linux/interrupt.h>( [0 c& O9 k8 {5 F& u
  30. #include <asm/io.h>
    2 Q5 y1 b0 Q& s& d8 E
  31. #include <linux/moduleparam.h>
    , W+ H$ r/ y4 w/ u8 K
  32. #include <linux/sysctl.h>
    ' ^2 `% h& ~. C  X
  33. #include <linux/mm.h>
    " c; f) M1 |& b/ O4 g- z
  34. #include <linux/dma-mapping.h>
    8 r5 K% ]: J/ P% E9 ]6 m2 k* M
  35.   C' ~5 b+ D4 v
  36. #include <mach/memory.h>
    ' ?+ E6 y& D. p; c0 x2 Z
  37. #include <mach/hardware.h>* ~& r! t' t+ y" F; D- R  H
  38. #include <mach/irqs.h>/ J+ H: ~! K0 d+ I3 P
  39. #include <asm/hardware/edma.h>6 j3 J* G2 q# d

  40. . B) N1 s8 ^4 I3 o
  41. #undef EDMA3_DEBUG4 f6 x' ^8 b- T$ z7 j
  42. /*#define EDMA3_DEBUG*/
    7 e& C& q( C! k* o3 W! D

  43. 2 l3 h; _5 q6 b/ E, T
  44. #ifdef EDMA3_DEBUG( T+ d1 x* n4 b! @/ Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), X0 X- B7 j9 s+ l7 p" k. o& K: q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' @8 e& J# c' e  ]+ H. n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - v! w+ |- _  B3 M9 `, P* H
  48. #else  C+ E6 D9 d: y& K
  49. #define DMA_PRINTK( x... )& H2 Q, q2 l0 ]& I9 q5 d2 d! E
  50. #define DMA_FN_IN
    $ [2 i' ~9 p& b! ^5 [; A, j, ~
  51. #define DMA_FN_OUT
    " j  g$ D' P6 p, a, Q6 H# s
  52. #endif. w9 r! Y; P1 s/ @% n

  53. ( h" C$ d5 {" i" C. S( O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* P2 y3 J  e' `0 y5 `: N) X
  55. #define STATIC_SHIFT                3
    9 f+ I( j5 M  _4 R, Z6 ~
  56. #define TCINTEN_SHIFT               20
    * K2 ?# ~" f1 K4 Y) `) G7 Z# w& L
  57. #define ITCINTEN_SHIFT              216 T9 n- n) w" u& e! n4 s
  58. #define TCCHEN_SHIFT                22
    & F  m7 X' C6 g3 B1 w& b
  59. #define ITCCHEN_SHIFT               23
    - B3 s' }9 s9 E# k* ^: Z& A# u1 J

  60. $ s: v  z; n  x! |% K# u
  61. static volatile int irqraised1 = 0;1 Y3 K3 L& A* l  I
  62. static volatile int irqraised2 = 0;
    3 O- K6 u( R4 u/ F

  63. 6 k( l+ G' X! f& c' m3 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; j8 P8 }' h8 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      c' k$ I6 z  f( ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 _0 x$ @6 g2 f6 E% m$ X

  67. 9 c- R: T& t# _5 P
  68. dma_addr_t dmaphyssrc1 = 0;
    . j" |) h8 e! m  N+ d' @8 A
  69. dma_addr_t dmaphyssrc2 = 0;
    % U! z7 O9 c8 W& o( L
  70. dma_addr_t dmaphysdest1 = 0;
    / ]: J9 j; W" e
  71. dma_addr_t dmaphysdest2 = 0;- p+ ^3 z5 F4 P) @0 u
  72. 5 M( p( M6 n( o& f
  73. char *dmabufsrc1 = NULL;
    5 \: c" s2 D+ z9 }9 m
  74. char *dmabufsrc2 = NULL;/ ]  d/ H; l4 _+ ]  o
  75. char *dmabufdest1 = NULL;
    ) z3 H% e! m7 O* G
  76. char *dmabufdest2 = NULL;: Z+ O1 i# l# \. ^6 g& [6 @+ j% i

  77. ) E$ i. o5 U7 f. o; Q6 B
  78. static int acnt = 512;
    ' z, S7 j* |$ [+ _$ }* L0 p
  79. static int bcnt = 8;. y4 j7 U2 W; n" }; R- e! z
  80. static int ccnt = 8;
    3 W% b$ B; [1 m. G6 `) r
  81. ' Z% y3 N7 z; J. ]6 V0 j. X
  82. module_param(acnt, int, S_IRUGO);; t. w6 }) {" O
  83. module_param(bcnt, int, S_IRUGO);: y$ ~$ q$ t8 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ Y/ L! W' ]# v% A1 U

  B) h* W$ r. ?; a/ @) e6 a2 }; H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 m3 |' v6 l0 ]" {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" S! Y. f$ x1 ~. Q; y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ }5 T' W% r$ J- M

/ [# s( F" s8 s0 D9 I6 c9 K) v/ G! f3 z) q; j1 o; L' ?3 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 18:57 , Processed in 0.038939 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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