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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 S' d: f2 X% U1 E1 l
  1. [code]EDMA sample test application0 L& {* j) U3 _+ d. s
  2. /*2 i, l  s6 J' Z  r9 |
  3. * edma_test.c* S. m! @0 E: v; I! j0 W
  4. *+ S6 F; r% w% N4 S, s! l
  5. * brief  EDMA3 Test Application9 J- X( k9 l6 i3 S$ F4 ]6 V8 F
  6. *! c9 o. x: j0 _: J8 q
  7. *   This file contains EDMA3 Test code.
    + b. ^' i/ p6 T% g, _  W8 p. N7 s
  8. *
    & K- O: R2 _2 ?; }0 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 p0 r' V9 N% Y* r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. X, l" t/ b8 r/ b2 Y
  11. *         TO CHANGE.
    & N& c0 r& p% Q/ e1 Z
  12. *
    ! k0 C$ B. T' V& I0 d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ \0 B) B4 X5 _2 W
  14. *
    # p  h  g; x2 j% }3 B
  15. * This program is free software; you can redistribute it and/or  J; B: g' s9 ?9 y7 K: ]
  16. * modify it under the terms of the GNU General Public License as: S4 e- w9 `7 z, [5 K
  17. * published by the Free Software Foundation version 2.2 Y  M8 K' ?0 K7 U* R- _
  18. *
      f  o8 X$ t9 i# i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 G! b! A; P' \( C
  20. * kind, whether express or implied; without even the implied warranty; L3 ]1 L) K+ k* l* t( B( n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ A) [8 T, ^* |  N) Z
  22. * GNU General Public License for more details.4 x  e! W, _6 B: @$ O& U
  23. */
    8 K; e0 G% \2 J

  24. / A. O  G, m/ S$ n" M( A$ u- m
  25. #include <linux/module.h>7 p' x; N" q& U, g; d  l
  26. #include <linux/init.h>
    9 k) _; q5 b' Y
  27. #include <linux/errno.h>
    + S2 W) J; B2 D8 u; f
  28. #include <linux/types.h>
    8 |$ m0 r7 o9 Q" m; t5 m
  29. #include <linux/interrupt.h>
    6 ]/ l' W" d/ f6 e6 B
  30. #include <asm/io.h>
    ! Y+ i% ?  c/ B$ Z
  31. #include <linux/moduleparam.h>
    ( i* m* M: t. j1 o' \7 H8 h
  32. #include <linux/sysctl.h>
    6 z+ B" W+ V. g8 ?" Z, P
  33. #include <linux/mm.h>6 j4 a3 g( s! ?* a1 W
  34. #include <linux/dma-mapping.h>2 X+ g4 L1 J8 R; |7 p

  35. ; i7 m, J" s3 ?6 A+ b2 Z
  36. #include <mach/memory.h>" V0 K" ]1 T, \" q2 x& P3 u
  37. #include <mach/hardware.h>" ^2 J  @4 k$ o
  38. #include <mach/irqs.h>
    2 f# o% \) V; ?; j% S2 r
  39. #include <asm/hardware/edma.h>
      W9 P' J) U$ j' @3 `5 f# x2 P
  40. & M5 G9 J4 z9 Y/ ^4 k# j
  41. #undef EDMA3_DEBUG
    # G. n4 @/ M; g1 {% d, I
  42. /*#define EDMA3_DEBUG*/
    0 i/ A6 G( M, A' t

  43. + t# Y9 A% a1 b* E9 p0 T3 ]
  44. #ifdef EDMA3_DEBUG
    1 f$ u. ^' C9 p5 J# k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! m" q: ~; u9 Z6 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- S  I% O) _4 y1 k5 Y4 Q! |  ^. b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), }6 P* j" g  B) d; H( e
  48. #else
    9 Z; L7 }; `- z5 q; S1 p
  49. #define DMA_PRINTK( x... )2 I8 }1 x6 T+ G' f
  50. #define DMA_FN_IN  }5 }6 N  U2 Q, D- ]0 S8 M8 W1 H' A  {
  51. #define DMA_FN_OUT
    2 q4 a- Z! x" k' h5 g
  52. #endif+ @- Y" {9 w* ~* b  }9 e5 \- }% j
  53. ' Q3 y4 c$ a6 e8 F$ C0 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 E' e2 \- W' w
  55. #define STATIC_SHIFT                3/ i9 |# V1 X/ ~. v, |7 S
  56. #define TCINTEN_SHIFT               20
    * @2 {! k. y) _: z; m
  57. #define ITCINTEN_SHIFT              21
    + s* a* y' P0 O1 p8 T/ Q! b
  58. #define TCCHEN_SHIFT                22
    7 E) ~* ~( R5 D3 {6 ?2 `
  59. #define ITCCHEN_SHIFT               23
    ( X, f5 f' d1 z9 W
  60. . I. _3 k2 }4 Z9 [- H
  61. static volatile int irqraised1 = 0;8 v, g7 L# l& |9 X
  62. static volatile int irqraised2 = 0;
    $ B5 z; e4 [( {' m+ c
  63. % \0 L& x3 r$ T( Q" s$ M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) i# Y+ i/ U3 u) x& [: [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 V* k& l  g: B" M' `) `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Y. L9 v) t+ h/ M* v5 Y( _4 j) `- h
  67. 2 h( h7 r9 j0 b, S8 S, D
  68. dma_addr_t dmaphyssrc1 = 0;, R* k  _6 Y: R4 Z
  69. dma_addr_t dmaphyssrc2 = 0;
    ) }6 b$ ], Z% G3 h# Q5 B/ C
  70. dma_addr_t dmaphysdest1 = 0;
    . _1 ]' I: a* v7 C+ L  F% u
  71. dma_addr_t dmaphysdest2 = 0;8 V- a4 g4 ^' w

  72. 3 U0 O# i* f' z' `. b$ D6 w
  73. char *dmabufsrc1 = NULL;7 D! w  R8 M  `
  74. char *dmabufsrc2 = NULL;  ^* H& D( f' W- d! Y9 _
  75. char *dmabufdest1 = NULL;
    8 n" S- Z2 L; W1 f8 d( Z
  76. char *dmabufdest2 = NULL;
    8 ?' j8 C$ b% C0 f; y

  77. 7 c& N; D" ~4 v0 X, p4 m7 k
  78. static int acnt = 512;
    ! ?5 r- |$ d8 U! t! P
  79. static int bcnt = 8;6 G3 t+ f3 O5 Z5 [3 q
  80. static int ccnt = 8;& x% G$ G& d5 t/ b$ x) q
  81. $ G5 I: n1 b. z. r% `
  82. module_param(acnt, int, S_IRUGO);# g; }9 A1 c4 a) b# M! F
  83. module_param(bcnt, int, S_IRUGO);& H+ _6 @* {$ W+ A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  L" G+ N' k' k4 ^7 @$ |& C

/ r9 r# g  g" X  t6 \/ w0 J  Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% g6 b' z/ {5 d/ N% q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 P; `2 i  }! y2 a! J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 p1 Z9 P5 y$ D# X

7 G- Q1 J2 a0 A1 F# b' Z* B8 L9 y4 ~: ]* c/ G- Y2 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-10 16:53 , Processed in 0.039937 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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