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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " i' X9 n! |; h$ i' c
  1. [code]EDMA sample test application
    " }# l! ^/ A7 C3 \2 q/ N
  2. /*2 C+ u6 V! T, p2 R- q" Z; `- ~" \2 N
  3. * edma_test.c. L8 Z' q: h( X% D- w, n* s# Z
  4. *
    6 |2 X% h# d1 H  f+ E. I5 I
  5. * brief  EDMA3 Test Application6 w" T) x* B- f3 X, p" ~
  6. *8 @* s! d2 ?. ~" \/ _
  7. *   This file contains EDMA3 Test code.
    " k; V' s* n0 @  ?4 T# Z1 |
  8. *
    ; @$ P5 G' w0 F' f% Y1 ?1 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " x; x0 Q( t: N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 E& l* j  \- f" I) X
  11. *         TO CHANGE.2 u0 A$ h9 @; O* ^
  12. *
    - X" ]0 U2 `/ B$ g7 T9 t% i, B8 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) W: b3 @  m- k  s; P4 Z- H
  14. *
    ) Y( U7 g8 W5 v9 V$ Z& ^" `) C
  15. * This program is free software; you can redistribute it and/or
    - E. R9 f/ B8 ?  b+ `& Y
  16. * modify it under the terms of the GNU General Public License as% a, R# A! U! N. G* S
  17. * published by the Free Software Foundation version 2.7 ^' f! ~5 K  \( g  }" G$ }8 a+ I
  18. *
    # W5 n, e7 F$ k5 q# f8 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ L  I# V: w3 G$ s/ P
  20. * kind, whether express or implied; without even the implied warranty4 N  T4 e! ~- s6 @# L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% ?3 W! M, g8 h) s) o# A) P4 ^9 |0 z
  22. * GNU General Public License for more details.+ W  l$ N) R3 Z8 R
  23. */
    ; z% u/ ?& [" F; [6 r1 V5 N4 S6 S
  24.   O  j# s+ e( f  m9 s3 d4 G
  25. #include <linux/module.h>
    ' u5 V4 S, G) R1 I
  26. #include <linux/init.h>5 P! ~! G& {) M5 |- K
  27. #include <linux/errno.h>) p9 t6 }9 u4 D. J
  28. #include <linux/types.h>
    3 Q6 R  v5 ^7 ?& `
  29. #include <linux/interrupt.h>. z* a* n: E( \! C/ X' ?9 y% x/ \
  30. #include <asm/io.h>
    ( T1 e; B" L0 C+ Z& }! Z
  31. #include <linux/moduleparam.h>! R1 D0 {. q8 d
  32. #include <linux/sysctl.h>
    0 {. H! r7 `, }
  33. #include <linux/mm.h>; @3 N% F) F3 c5 Y5 l
  34. #include <linux/dma-mapping.h>& p! L- \  E# ~) T9 O4 p  B0 p

  35. 7 v- D7 s/ t9 i
  36. #include <mach/memory.h>/ S, J; I2 H7 B2 F& S; P
  37. #include <mach/hardware.h>1 L9 F1 N; W/ @7 {
  38. #include <mach/irqs.h>
    6 G) `) b2 @3 r8 X0 i' A
  39. #include <asm/hardware/edma.h>2 ^" F# V" u% F4 C0 S8 U1 e+ Q
  40. $ G) I, i7 A  t
  41. #undef EDMA3_DEBUG
    4 d6 O* |! h8 Z( t" c
  42. /*#define EDMA3_DEBUG*/
    ) @$ U4 e1 {' V* y) Q; L# n

  43. ; P4 x" v  |& Q7 h+ u0 d
  44. #ifdef EDMA3_DEBUG1 i6 l( m' Q) q0 q2 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 Q' T7 U# K/ z$ h+ q- u6 e! V+ G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 v* s- O) m7 `2 D2 t* }9 j4 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- [* [% ?. ?& w- B5 O8 a
  48. #else) ?5 W6 d1 W# E5 L) e$ K9 }+ t
  49. #define DMA_PRINTK( x... )
    7 ?/ g: Y+ z/ b1 y+ p
  50. #define DMA_FN_IN3 C& d' T. P# e: i9 y, `8 |
  51. #define DMA_FN_OUT
    : c8 D1 N& B1 e; t. F
  52. #endif: q" ]* x- i  V# ~3 `7 G& J  F

  53. * w% ?! M6 q" x+ X8 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* f5 `4 R! p4 |: }7 I" _
  55. #define STATIC_SHIFT                32 @- D) p# j; t* j
  56. #define TCINTEN_SHIFT               20
    2 d: o, |, Q7 }
  57. #define ITCINTEN_SHIFT              21& F; w* K$ \8 ]* V7 c* z  c
  58. #define TCCHEN_SHIFT                22
    ( M- f: f  C# z" p. W4 B
  59. #define ITCCHEN_SHIFT               23. S7 I) q% j5 c

  60. & c7 H# s- j# L4 |% }) R+ g1 K  q
  61. static volatile int irqraised1 = 0;
    ! ~" R+ |3 [5 n3 F( X% V2 |& v
  62. static volatile int irqraised2 = 0;; T! D9 I4 `1 o$ D, c) d( n

  63. , X) P& L) `) t% p; k6 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& g( l) d  p+ f2 E2 H' h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ p1 Y# L! @, V+ H4 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ E% G8 E7 t) z5 F- ?

  67. 4 n( P) r- X2 V3 s4 i" T
  68. dma_addr_t dmaphyssrc1 = 0;$ L2 G: V+ [+ v
  69. dma_addr_t dmaphyssrc2 = 0;
    0 n  m  T( ]6 R* x
  70. dma_addr_t dmaphysdest1 = 0;% ?6 y. N: S, z0 n% P  `
  71. dma_addr_t dmaphysdest2 = 0;
    " A9 y5 z" P9 m$ V' ^- ~

  72. & P0 [( H- j3 \
  73. char *dmabufsrc1 = NULL;# X: H; M" @: T
  74. char *dmabufsrc2 = NULL;% o  }# ^. k7 a* z7 h7 x# X, E
  75. char *dmabufdest1 = NULL;; n" [4 B* w& F% H
  76. char *dmabufdest2 = NULL;. v2 R3 I7 i/ c  H( k  R, p9 x
  77. & W' R1 B- b; j& t# E" ]; p5 ^* {% x
  78. static int acnt = 512;
    ! H5 ^# [- C- A6 A* D* }3 F' u
  79. static int bcnt = 8;
    - l' `' F9 A7 o6 \
  80. static int ccnt = 8;0 M- R5 n' U  V. A9 w, H

  81. + g; o- _9 O+ X; S
  82. module_param(acnt, int, S_IRUGO);
    9 f- W1 |5 i, @0 P
  83. module_param(bcnt, int, S_IRUGO);
    . E& m/ o! {) C# B9 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# ?& O% l$ U+ m, L) Z" v6 I6 ?# A
. r8 V- `+ L2 u6 B5 T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* v, x6 _6 C: Z4 R( larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 h3 r% p+ i2 ]: R. z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ u) N3 w2 m  @" s! T3 s: T0 t$ g  r/ [: @$ |
8 ?* v, P2 o: @( n8 K. U6 Y4 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 17:52 , Processed in 0.040702 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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