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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 D: I% |" M( N9 u
  1. [code]EDMA sample test application4 h7 T$ ?( g9 ]. _$ ~
  2. /*+ [0 V7 s" Z( y
  3. * edma_test.c
    - ?, F" p. x. b
  4. *
    * @% j1 o+ b( y4 q7 C; a' m
  5. * brief  EDMA3 Test Application# U, f7 j$ h+ {% w
  6. *
    % L8 z3 r' M: A: u2 i
  7. *   This file contains EDMA3 Test code.
    2 e4 m; V1 j7 \9 C9 s1 A
  8. *
    3 v+ b0 ?* Y0 i5 T+ J/ Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 N, n5 H, R% L5 f2 ?* Z) [! A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % p' g4 a/ j: d' t/ F5 t
  11. *         TO CHANGE.
    / m; w# {9 \- y& W* g
  12. *% n6 S, I( I7 M: O* J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 V. c/ J  \- m
  14. */ x2 o$ \+ R! W2 C
  15. * This program is free software; you can redistribute it and/or
    / G2 a8 ]5 l1 ~# W/ C
  16. * modify it under the terms of the GNU General Public License as: `3 h3 ~& m" c( Z3 v# c; a; d
  17. * published by the Free Software Foundation version 2.- x) C6 f7 T7 s
  18. *7 k' P5 A1 G, h! y( ?$ p1 _6 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) q* ]1 c- V  v( j
  20. * kind, whether express or implied; without even the implied warranty% |+ {, ]  l5 o$ I, _/ m0 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * d, f) ]; c1 X% ?0 |1 L' Q
  22. * GNU General Public License for more details.
    - L+ A; E# G8 j6 `* O; t
  23. */
    0 I) w5 g$ `7 ?8 U( S
  24. - F3 d6 O& f3 a+ ~2 w
  25. #include <linux/module.h>
    0 Z' z" A5 z4 j( `
  26. #include <linux/init.h>" S* _+ N9 ~8 d, G( \
  27. #include <linux/errno.h>& k6 w% c8 y: n6 U, b* z, M
  28. #include <linux/types.h>- o, a, D$ [9 p7 Q  \
  29. #include <linux/interrupt.h>
    8 E( O- o  `$ V- D0 A
  30. #include <asm/io.h>
    # }) _6 w3 U% \5 b
  31. #include <linux/moduleparam.h>2 P7 G0 q! V' b
  32. #include <linux/sysctl.h>
    / v7 `8 k( h% S: C0 i3 v
  33. #include <linux/mm.h>' Q7 T+ j0 e, L5 I5 u4 t2 g$ N, H- u4 c
  34. #include <linux/dma-mapping.h>$ s5 z- t+ E% z3 i! v9 K
  35.   n" e: N5 G; z$ O! Z6 k0 w
  36. #include <mach/memory.h>! k. {+ M, a9 @$ |1 H9 O/ g
  37. #include <mach/hardware.h>
    ! z* d- T0 t: W- Y1 L: \7 @
  38. #include <mach/irqs.h>6 F2 c% E! ^& B6 B) C6 y9 e
  39. #include <asm/hardware/edma.h>
    ! h6 ?2 j6 d: k: h- O

  40. " I2 K- T( S6 a4 V9 D
  41. #undef EDMA3_DEBUG
    ! @$ z7 d& e7 C; s+ v" T
  42. /*#define EDMA3_DEBUG*/
    & D* v# r  S! j% R7 m# l* ^

  43. % b( N; g, F. X1 e* H. G2 d7 ?/ B
  44. #ifdef EDMA3_DEBUG
    / D: T; p$ C* I7 l3 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; J& _  m2 U" j" q2 G  m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : ?* q2 [- U4 k  `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 ?! y2 m6 S1 v+ Y
  48. #else# ~( g' X& U/ T/ F
  49. #define DMA_PRINTK( x... )& C  t* ^; t7 l$ D6 l. g
  50. #define DMA_FN_IN
    7 j: k. N6 u$ D
  51. #define DMA_FN_OUT
    - x" }3 Y1 j$ J9 h, Y
  52. #endif
    - N- B- G5 _: O, ?
  53. 5 t9 X6 v9 N! t) F- s3 N& I; C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ |2 Z0 y- P* H$ }
  55. #define STATIC_SHIFT                3
    + w1 W8 l) \; L0 ?! k. ]4 O
  56. #define TCINTEN_SHIFT               204 F' Q5 T4 W7 {& U" c5 A( @5 U8 `
  57. #define ITCINTEN_SHIFT              21/ k" ^1 Q: U! S
  58. #define TCCHEN_SHIFT                22
    . B- b  o) p, n, }8 H; q# }( I- F6 |
  59. #define ITCCHEN_SHIFT               23
    ) u: y& J* p% f! O4 @& J6 R
  60. # n# c8 N  C( ^8 }" \4 s9 v" L2 X
  61. static volatile int irqraised1 = 0;6 Q2 j3 k7 l5 J- h+ S7 v
  62. static volatile int irqraised2 = 0;' g2 W- i. b( {

  63. ' w8 w( t# h5 c# _) T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, O6 Q$ D5 B& c, e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. N. Q! B! N' m- [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, I- p% |; x! G+ G* s$ h

  67. 1 ~; g$ |" W* N
  68. dma_addr_t dmaphyssrc1 = 0;
      N2 K: N& U  |3 \
  69. dma_addr_t dmaphyssrc2 = 0;' b& H/ u% T2 k/ C
  70. dma_addr_t dmaphysdest1 = 0;6 [/ z5 _7 |- |/ F& |" U
  71. dma_addr_t dmaphysdest2 = 0;) }5 }: z6 ~$ a6 j3 i2 v

  72.   M8 P% a+ L# e  n4 G
  73. char *dmabufsrc1 = NULL;
    ) j! R# m$ l+ D5 a8 G3 T2 r
  74. char *dmabufsrc2 = NULL;
    ' e1 J5 @. }! F- b7 ]- i2 d
  75. char *dmabufdest1 = NULL;6 Q  ?$ |7 ]; b: l- A
  76. char *dmabufdest2 = NULL;
    ' d( n0 H% J* C7 `1 d% U
  77. 1 n& H# c. h9 [) E% i# {0 H# v! x
  78. static int acnt = 512;
      o5 \- S% w0 ^) E
  79. static int bcnt = 8;7 E& |( [6 \* S0 a
  80. static int ccnt = 8;/ z! C- p- w, `- f( B/ M

  81. ( h& L* q% H- Z; I  X7 v3 z9 |
  82. module_param(acnt, int, S_IRUGO);
    : y3 V/ L" G+ b
  83. module_param(bcnt, int, S_IRUGO);; t+ y, e7 [+ E" f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; A. W  x9 Y" x% |  ~
- k. e) H4 v# B% n/ F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! Z# ]& z+ C$ W9 J9 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. X7 S' X/ p' x5 u# ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 T9 Z0 g5 c6 |& J- Z/ |4 q9 V; c  t2 ?/ I9 L. U2 C$ J! j

) u5 G: G+ T* S$ i1 E& X4 M3 F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-11 06:40 , Processed in 0.040505 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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