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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. \1 `4 N' |" Z# _8 `
  1. [code]EDMA sample test application# s" V) S! n/ r& m$ y1 W: c
  2. /*  i; {) V% V; D, p* Y1 A0 R3 f
  3. * edma_test.c) h% V4 q9 g" t5 X1 c3 V
  4. *7 ~9 W$ ~- E" }  C: ]& e
  5. * brief  EDMA3 Test Application
    - `7 [: c" {" b7 N; _) p
  6. *
    4 ?& s6 _% N; U% F' q3 n2 q" H
  7. *   This file contains EDMA3 Test code.
    & O3 B& J. B0 g
  8. *- f1 r* Q7 J$ u( T! ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 S2 f1 R( e- z8 v" f; w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - m: n/ t& J2 s. Q2 f
  11. *         TO CHANGE.
    - i- e$ y9 G2 O! b. K; `: t
  12. *
    7 r/ N# q. k5 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! H; l! M) o: u. j0 C
  14. *
    - I0 s( X7 V' F: [
  15. * This program is free software; you can redistribute it and/or
    8 e8 \4 ~8 g; D. A, q
  16. * modify it under the terms of the GNU General Public License as$ r$ g" V7 I' }! z2 t9 l; g6 P, ?
  17. * published by the Free Software Foundation version 2.
    * v/ A, \2 M4 w
  18. *
    4 y6 z- B8 U! D, B+ A7 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + a2 I& n5 p- \5 P
  20. * kind, whether express or implied; without even the implied warranty
    . H+ I: q& `9 H; P5 U) }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 H  K# K' I' l
  22. * GNU General Public License for more details.# b, O0 H: m8 M  }
  23. */
    : j' O2 N1 F1 T# O& c+ H7 F: h6 S( P
  24. 5 F- Z" \) T$ R* q/ y# w* v
  25. #include <linux/module.h>
    1 L. Z" L/ [) U; |6 j/ M
  26. #include <linux/init.h>
    2 H, p* g; _: N
  27. #include <linux/errno.h>% V. Y1 l5 e  y1 a' J* ?- t0 p
  28. #include <linux/types.h>( T) y' m* E; I" T5 Z
  29. #include <linux/interrupt.h>
    . b' N) b0 M5 ~9 y
  30. #include <asm/io.h>
    1 n$ ^6 {1 @: V7 z
  31. #include <linux/moduleparam.h>
    * W: K4 {' |/ e: x4 b% O
  32. #include <linux/sysctl.h>
    4 V0 a. f) u+ y
  33. #include <linux/mm.h>
    ; I. W- _9 w3 F9 U
  34. #include <linux/dma-mapping.h>/ _- M* w) o$ M& Z

  35. 8 f/ f2 ~2 u8 @: a+ B
  36. #include <mach/memory.h>
    2 r% Q4 s: y8 a0 s6 E! G
  37. #include <mach/hardware.h>) D+ A5 q; [) G2 [: t' e9 c1 r
  38. #include <mach/irqs.h>
    2 w0 G, x* Y" P' w  P. ?( F. ~5 v
  39. #include <asm/hardware/edma.h>
    9 R0 n1 |) ~" y) w$ G* |3 z& T; `
  40. " Y8 h( H% {1 C7 g
  41. #undef EDMA3_DEBUG& @3 q4 A4 A1 F( |* y
  42. /*#define EDMA3_DEBUG*/
    ) Z, i/ M! g( j5 f8 x; v1 C

  43. 7 L' @7 t" A, L& k7 ]6 S$ X0 a! O
  44. #ifdef EDMA3_DEBUG  V) u2 c$ Y: V$ H+ Y2 b7 \- _/ Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- ?* k$ e: c" X9 H! @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' s$ s4 B4 W1 j) E5 @, ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) G8 g8 y- f' i( l8 i% N( Y
  48. #else
    " V" w* P- |) ?1 s4 x
  49. #define DMA_PRINTK( x... )1 ~% ?( X3 d- A6 q# }
  50. #define DMA_FN_IN
    / G& g* i/ y6 J4 I% E. J
  51. #define DMA_FN_OUT
    ! c$ _, B9 O3 M: K7 k
  52. #endif
    ( Y2 h. }- s* `/ j9 N% @

  53. 9 K# y8 w7 E8 ~+ u0 J9 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  F6 O0 i* y( y  @: y$ l, F: O. _
  55. #define STATIC_SHIFT                3
    4 z1 _  r& p0 ^/ B+ C
  56. #define TCINTEN_SHIFT               20) T* r. ?( S( l+ ^- N2 T0 h0 I; @
  57. #define ITCINTEN_SHIFT              21
    ( y& _' [+ \' D& W. v6 q! T: x- Y
  58. #define TCCHEN_SHIFT                22
    . e5 l; n& q  J5 z
  59. #define ITCCHEN_SHIFT               232 E6 l# m1 X' y, I8 R) J7 [0 L

  60. $ O. q* _* h7 k- j9 Y" D
  61. static volatile int irqraised1 = 0;
    2 B3 `2 x9 `$ v' W0 i  n; x8 s9 C
  62. static volatile int irqraised2 = 0;0 A  A3 r" q1 m1 a& J/ H: R" A
  63. , r7 F' R+ E3 s. G' V- F8 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      D( \1 J, Y# W* |! m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' c  ?$ {( [4 L. t; F  R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & R2 l5 C  _. w. R5 |& x
  67. " H1 u' _' F7 ^! _3 n
  68. dma_addr_t dmaphyssrc1 = 0;6 D3 W' D4 A; m
  69. dma_addr_t dmaphyssrc2 = 0;
    ) Z9 Y; Y0 D: v3 [4 W% L& U" p4 H
  70. dma_addr_t dmaphysdest1 = 0;" K6 K9 ]4 B8 s' |
  71. dma_addr_t dmaphysdest2 = 0;5 W6 b* Z/ {. h* S0 q: W: m* j

  72. 7 ?# L+ Y4 d+ `+ {  @9 K
  73. char *dmabufsrc1 = NULL;
    6 t! B% k: V" t. k& H5 a
  74. char *dmabufsrc2 = NULL;( p* H$ j$ k' A$ R& u% ]7 x3 O; j( ?
  75. char *dmabufdest1 = NULL;
    / _5 y' [! v2 v) x; B
  76. char *dmabufdest2 = NULL;
    2 U& b1 M3 }: t" h1 j% F0 `
  77. 4 d5 b3 u8 y, b: U9 {+ R' j) h
  78. static int acnt = 512;1 _0 @. W5 g* f5 L& X. C" F
  79. static int bcnt = 8;
    5 J  j4 ^" ]& m+ ]) n5 Q, U
  80. static int ccnt = 8;
    . d/ u9 ?$ h$ C8 H; V' V9 m
  81. ; D+ t4 ^; `  U$ ~5 q% U; G+ k  n* q
  82. module_param(acnt, int, S_IRUGO);
    8 k9 J7 k% k7 _. D9 F- G5 I: i' M' A
  83. module_param(bcnt, int, S_IRUGO);
    ' x% R+ X2 |3 S0 p, b; S0 ~/ Q" o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 u9 M' ~7 L9 Y. X! j

2 q/ E; E# t7 e' c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( S9 ~9 {" Q0 w% k4 U- Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: b$ T6 a  V; y6 @3 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! F' I% L6 F* d9 I$ f4 m
' M) s0 A* v) \4 ~% {8 c) i2 A, A
7 D; k- k  v7 J% p. e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 10:19 , Processed in 0.040749 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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