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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 n. `% w! ?% ]" s
  1. [code]EDMA sample test application1 u" I% _3 C5 w! X- f& u8 \
  2. /*
    $ G1 ^  t1 \5 ?1 E1 j. l; a
  3. * edma_test.c' S& ^1 T% E+ G- r" Z
  4. *
    % K- x& G. E9 u2 |
  5. * brief  EDMA3 Test Application
    + g& r; O& W) |5 v6 y/ A
  6. *
    . d* a4 I- |3 [: a, X
  7. *   This file contains EDMA3 Test code.) o' c3 w7 E1 j" z, d! V8 J% K
  8. *( x4 A  v& s# }" X$ h4 V  Q7 l% e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , l7 L3 F# O( b1 t/ S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 o7 I2 U2 q4 [
  11. *         TO CHANGE.. B+ i6 u+ z1 X. l, R3 j1 B
  12. *
    " J- o# ]3 u; B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, m6 M7 D. Q' A4 V) Y1 u1 s
  14. */ y; ]6 ?* p( L7 Z
  15. * This program is free software; you can redistribute it and/or
    . ^4 @0 ?3 Y+ N7 x6 o
  16. * modify it under the terms of the GNU General Public License as9 T1 c! m! c' D% b1 R# `+ x: T$ W
  17. * published by the Free Software Foundation version 2.
    4 N* j) J" V( p& j/ k4 V: A" a
  18. *" w  v) A  Z" B, d: |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; O* N& q( @7 I9 F/ j  \
  20. * kind, whether express or implied; without even the implied warranty
    - T& j) \6 l* |' w2 H& Y1 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + N6 F) Q# k' w6 p
  22. * GNU General Public License for more details.! e% M. z. m1 p+ c3 D! |" B
  23. */6 e: o3 L8 |7 Q* F1 v$ z

  24. ! [; l( j7 }: ?% D# O& V
  25. #include <linux/module.h>
    7 B7 k3 w( l+ U5 }, ~
  26. #include <linux/init.h>
    . H7 X2 I; E- D9 I9 Y- t
  27. #include <linux/errno.h>
    ( e2 i9 W: l/ \# ?2 q# H
  28. #include <linux/types.h>
    # R: D0 J8 c/ T$ E* t/ K/ L
  29. #include <linux/interrupt.h>+ ]' R, `4 l, v. f* J& \6 @
  30. #include <asm/io.h>  r" M% X& d* S, ^! ~( Q
  31. #include <linux/moduleparam.h>
    ' ]4 c; B, C4 L8 c
  32. #include <linux/sysctl.h>8 A$ K& }  B7 S0 h. U
  33. #include <linux/mm.h>
    ( K, E. A  l& y" a* P8 C
  34. #include <linux/dma-mapping.h>
    . w3 S4 t5 H7 H* L) Q: \

  35. / W- V- Z8 J& g" z
  36. #include <mach/memory.h>
    4 R; r+ s# C" b
  37. #include <mach/hardware.h>
    . Y3 X, l  R9 \: J; B
  38. #include <mach/irqs.h>
    3 w' @5 Z3 P) L1 N& E1 R( p
  39. #include <asm/hardware/edma.h>9 J. s- B3 _7 T. B
  40. $ v# ^4 N! v) ^" N, z
  41. #undef EDMA3_DEBUG& t0 }  v6 x/ M
  42. /*#define EDMA3_DEBUG*/; n2 B# d. Z' Z* p* b: L
  43. ( V, M7 f# H5 t" F: h
  44. #ifdef EDMA3_DEBUG
    4 h3 E. W$ V* Q& S7 a8 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 K7 h3 c  k3 n: [3 G+ a6 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 T: r! ?. u& q( x$ j  R: e# v4 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 |& `6 @, C1 A/ e! |
  48. #else
    ) `) E5 }# O) O9 B
  49. #define DMA_PRINTK( x... )( F2 W# Y$ A7 f- _6 B' r- U5 N7 N  Y
  50. #define DMA_FN_IN
    ' e+ v5 W+ A2 a* [
  51. #define DMA_FN_OUT" e' f" Q5 u& p, M
  52. #endif
    ' [+ Y! p$ H5 u& T  y  G7 E
  53. 2 i; n& B* I* P6 n- w/ {* u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ I; n1 Q  Y$ K4 |2 f0 C
  55. #define STATIC_SHIFT                33 n  T) _% H' {$ Q1 r
  56. #define TCINTEN_SHIFT               20, b2 \$ M# a6 o8 s& o
  57. #define ITCINTEN_SHIFT              21* A* S$ P  s& Z* {9 O8 X2 |
  58. #define TCCHEN_SHIFT                224 r& P: N0 f7 Y8 c! O3 M
  59. #define ITCCHEN_SHIFT               233 v4 J, n7 K5 M: ?& r3 D

  60. 6 t' t; S, l/ B
  61. static volatile int irqraised1 = 0;5 _3 O+ w  s8 U! }3 L
  62. static volatile int irqraised2 = 0;2 A! ^' a' f& T/ K6 W3 N8 [

  63. 9 V+ p* T' k+ l. r" F4 B+ K( d- F, k3 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # @6 a/ a* r9 M! R7 [) w% Q' d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 m0 W( T( h1 b9 E2 @" R% L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , j5 l# E- w* S6 d) f

  67. * n; x+ j1 t  S* R! K
  68. dma_addr_t dmaphyssrc1 = 0;; T( z. k. L2 O2 l0 O
  69. dma_addr_t dmaphyssrc2 = 0;' D6 K& b' Z6 t+ Z+ w
  70. dma_addr_t dmaphysdest1 = 0;3 u# h5 V* A6 J- m$ c3 u
  71. dma_addr_t dmaphysdest2 = 0;) D# E0 u, x) l$ }. q+ C7 k
  72. $ r" Q3 i8 e* t) q+ }$ q% D
  73. char *dmabufsrc1 = NULL;6 ^( y  g8 z1 `: j1 M
  74. char *dmabufsrc2 = NULL;
    : ~$ O: p+ a# _
  75. char *dmabufdest1 = NULL;" X" E( {+ e6 v) P, Z: L
  76. char *dmabufdest2 = NULL;* E) n  `/ v& ~! `) A8 a& C
  77. 7 U, O& c0 z! S
  78. static int acnt = 512;- [/ h% `" e6 x. O  T
  79. static int bcnt = 8;
    + D( s8 E4 x6 b/ J8 A% {% }
  80. static int ccnt = 8;9 c9 j. {1 {/ M9 I) @: g% W" W
  81. ! R2 C7 b0 X7 _: d. A: q
  82. module_param(acnt, int, S_IRUGO);
    * |5 x3 Z3 C& V, h4 f$ O; v+ O
  83. module_param(bcnt, int, S_IRUGO);
    ' Y  ?& T5 w2 j1 n; ^/ ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ `9 k* E3 |" R2 ^9 _3 y
& ^/ P8 Y& I# _+ b. N& P$ T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( E$ ]  R2 p$ s' F8 T8 marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 K% E; Z  J6 D# o: k1 Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 L- }8 B* |* ~1 J
1 n' p, e8 S2 O" r- B: \9 E8 E) ?9 j! j4 J3 ^& q  U/ \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 15:20 , Processed in 0.051683 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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