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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : t* C9 `: k% Y3 O5 H( l
  1. [code]EDMA sample test application# {* |! b5 |9 O3 |
  2. /*
    ; x* K/ q0 b5 ]$ R: p. d
  3. * edma_test.c
      `3 q) X- f2 a
  4. *
    * \1 Q: M9 ?& ^/ F5 |
  5. * brief  EDMA3 Test Application  E' a! W7 P- y6 ?
  6. *6 ^, ?& j/ h" V5 D
  7. *   This file contains EDMA3 Test code.% t5 q$ g# W8 Y! @  D) ^
  8. *
    5 S7 [# D! \6 h' O8 a1 }: \1 Y- D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 S0 Z* p7 o. [+ N7 p4 |- f$ ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 Y7 m. a8 ?. n8 b
  11. *         TO CHANGE.
    ( C# W3 X1 K# ^# q  Y4 Q- s$ |
  12. *7 S4 B1 b, B! s: c; z1 P" o3 ]( T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, s. o; U8 H3 x$ ^" G  A! C2 d
  14. *
    1 d( U1 O/ m9 [: P% x- \2 {
  15. * This program is free software; you can redistribute it and/or
    . ~  n/ m5 P% {/ a" `
  16. * modify it under the terms of the GNU General Public License as, J3 x! G2 G4 C% @" B, Q* Q) D
  17. * published by the Free Software Foundation version 2.* ?( w2 A  h) H1 `: Z. R6 G1 r" ^
  18. *2 X3 F  f1 j* |# N+ ]  j9 A' h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ ~% a8 E3 w% i# d
  20. * kind, whether express or implied; without even the implied warranty
    6 {; R  o, N: U( V( F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" P, y9 A$ a- s! N' t/ B3 k2 N. g
  22. * GNU General Public License for more details.1 C6 ]+ C: b, R# ^; u
  23. */3 n3 w# q! m1 |% T$ W+ \

  24. : h: J: q, _9 b: v5 K. Z
  25. #include <linux/module.h>7 t3 F- D$ h5 J( J# }% R2 T, y! U
  26. #include <linux/init.h>
    $ }+ H- B# u& u7 e' D; D
  27. #include <linux/errno.h>5 {% I- H2 h2 {6 I
  28. #include <linux/types.h>
    1 I* \6 D0 r' L1 M8 S, R
  29. #include <linux/interrupt.h>0 W: i4 p4 o* n
  30. #include <asm/io.h>5 p! [/ V, s( q: q" a, {6 _
  31. #include <linux/moduleparam.h>* }- b2 ^* ]9 A: N; p
  32. #include <linux/sysctl.h>  g3 _# x1 o' W7 |8 L. a. }
  33. #include <linux/mm.h>
    * K2 ?0 W$ K5 F! C- D
  34. #include <linux/dma-mapping.h>
    ; [. F$ Q+ Q" x1 F  i" k0 y  F
  35. ) Z& o2 I; E2 ~1 w$ C' b% }
  36. #include <mach/memory.h>
    8 x. z6 Z" @4 _; ~) b3 v
  37. #include <mach/hardware.h>' x+ J  ~0 K; n4 q
  38. #include <mach/irqs.h>9 [$ b3 W* b0 {6 H0 Y8 C& I4 y
  39. #include <asm/hardware/edma.h>' m9 C! J0 F( S6 B

  40. & Q( g1 e- b! G+ Z) I4 e
  41. #undef EDMA3_DEBUG
    # {4 `5 C! c8 r4 X3 W! O$ f5 N
  42. /*#define EDMA3_DEBUG*/
    5 P: {" K0 m: G7 p# A

  43. " v9 T, y' R. o4 t6 ^
  44. #ifdef EDMA3_DEBUG* t. k( _* Z2 T: {4 |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ h' Z& H0 l8 n& R" N8 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " Y8 D3 u6 o  ?9 O! {) K% I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 }3 K8 O$ X# Q/ j
  48. #else7 w6 m* \, H1 ~, z
  49. #define DMA_PRINTK( x... )
    : E, x9 U9 R/ u, Z
  50. #define DMA_FN_IN! I! T9 r' C  d& d4 m/ V
  51. #define DMA_FN_OUT
    ( @" \; x" E! X
  52. #endif5 N/ i- @6 Q9 {6 C: W# T
  53.   V8 j; O8 I. p2 k7 t4 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; \5 r3 H% D2 x9 S& ^: d
  55. #define STATIC_SHIFT                3
    ( Y2 x( [" v, Z. o, A! C. j
  56. #define TCINTEN_SHIFT               20/ V$ l/ ?" Z' N) w3 e7 W
  57. #define ITCINTEN_SHIFT              21+ M) c  c8 R  M
  58. #define TCCHEN_SHIFT                22* j5 F2 \/ k9 j  Y# P2 b& l
  59. #define ITCCHEN_SHIFT               23; u. `# @0 Y/ `! a8 {" m: F
  60. 6 L# j$ W0 A! ^) u3 x
  61. static volatile int irqraised1 = 0;
    ! t# p) g3 i( Y: E) a
  62. static volatile int irqraised2 = 0;! A& M3 G$ ]0 g
  63. ! @! ]$ G' @" Y$ ?3 b- J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ^) R) y/ }6 j2 e2 P5 u2 i7 a% ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - t' R3 v( q/ F4 i5 h' _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . ^- X: C6 o2 T/ b7 q1 h4 l
  67. 7 N, v6 M# N+ z/ b: O
  68. dma_addr_t dmaphyssrc1 = 0;& i6 U3 P7 K3 t$ x* x, [
  69. dma_addr_t dmaphyssrc2 = 0;
    2 r' I  O% j; |; L& J
  70. dma_addr_t dmaphysdest1 = 0;: I, Z; C/ O/ s: d3 M
  71. dma_addr_t dmaphysdest2 = 0;- k/ D& L- C: y" [8 F* y
  72. . h+ A0 y1 G% u1 t8 c, ~; ^
  73. char *dmabufsrc1 = NULL;0 `; L: T5 E$ d% D
  74. char *dmabufsrc2 = NULL;
    / V7 e  L5 K+ j  [# p
  75. char *dmabufdest1 = NULL;
      F6 o! Q. \9 _9 w
  76. char *dmabufdest2 = NULL;/ S! J/ ?& W7 x$ z4 g' L  o

  77. + k. \$ l% T6 D4 v4 C0 Y
  78. static int acnt = 512;
    $ l& X3 ?5 W+ q& s% R% X6 [4 @$ L
  79. static int bcnt = 8;" H; p7 n" ]9 s  j8 g8 F
  80. static int ccnt = 8;- ]: g1 H8 {% G

  81. / z  u- E' }# Y
  82. module_param(acnt, int, S_IRUGO);
    5 V9 U: j7 A+ N0 a$ M: y! L% o6 t6 u) V
  83. module_param(bcnt, int, S_IRUGO);
    9 T# X( x7 f2 Z0 w) e% ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 `2 `0 y) G2 z3 i, k5 `$ L% m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! [9 C4 O+ a- K8 V" ~4 D' h" P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 S5 P3 z3 P  [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 b& U5 o7 I" C  w1 u; J8 d8 p5 s7 d" r7 i! b; @5 ~$ b

3 {' c; d* o6 p' l/ l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-24 08:11 , Processed in 0.037099 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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