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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   k6 i* Z  f5 H1 O! @
  1. [code]EDMA sample test application6 |* O& }' k2 U; J; @9 E0 `& v- G
  2. /*; e# q: _1 n) R0 D; u
  3. * edma_test.c
    , P7 ]# R+ k1 I+ _* x! }
  4. *! I: C  ?. P$ s! z, m# y  G
  5. * brief  EDMA3 Test Application0 R/ i8 S. v2 x  u
  6. *
    / N6 u8 ]9 e3 j( I' H1 {
  7. *   This file contains EDMA3 Test code.( I3 k* a; u8 N: s+ _
  8. *
    ) {* J- O& A3 T. h& D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) F7 u+ M9 {2 u  n9 |/ u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# v) x  H8 }  U! \  X
  11. *         TO CHANGE.
    - H3 I" o2 j% F8 [# L  H' M, [
  12. *! M# M+ Y. p! y" i6 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 i7 S0 j2 m0 G9 O! Y& y# A) `
  14. *
    1 I. _- ?- C) g$ d* o
  15. * This program is free software; you can redistribute it and/or
    $ z4 n# W" P) F3 C0 s
  16. * modify it under the terms of the GNU General Public License as: O4 X3 `7 }; o+ a: @
  17. * published by the Free Software Foundation version 2.
    + R4 Y3 i9 Y7 z! S$ ], x* A5 U7 A
  18. *+ b  q% ]1 u: _1 J% |# E) j  N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 a' c1 Z) O6 d8 m2 k! J
  20. * kind, whether express or implied; without even the implied warranty1 w* _- h* _+ I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 z( ~7 ~8 z) [3 K, {  Z
  22. * GNU General Public License for more details.
    0 f2 d. Q, J7 B. o
  23. */! D( D0 u- \% ^3 K
  24. 0 m  j* m5 j. c1 H
  25. #include <linux/module.h>7 q, p9 A5 |  ]& J0 ?  |1 u2 I, N; y
  26. #include <linux/init.h>- s+ {. n/ O6 n* y. G/ C
  27. #include <linux/errno.h>
    - N( A! ~1 d% d2 C
  28. #include <linux/types.h># x* l8 p( d# Z* G& Q+ T3 e
  29. #include <linux/interrupt.h>
    " f& P  K  U- c3 A
  30. #include <asm/io.h>
    1 v) D8 l/ |& f# X0 x
  31. #include <linux/moduleparam.h>. ]% W, f) T! T  {8 U+ G
  32. #include <linux/sysctl.h>
      m2 d, L! c7 K1 i: G+ t2 `
  33. #include <linux/mm.h>
    7 R0 E1 n6 S5 Y: J3 b8 o
  34. #include <linux/dma-mapping.h>8 A8 Y' T7 C7 P' \8 ~
  35. ( [6 W; Q0 G& f, E
  36. #include <mach/memory.h>( `& {- i& T+ M4 S' P' N8 }2 g4 w3 d
  37. #include <mach/hardware.h>
    ( v7 g% R) T2 H9 A+ N, d3 a4 I
  38. #include <mach/irqs.h>
    - C. k2 U" R8 H$ a, {
  39. #include <asm/hardware/edma.h>2 ?5 k" S2 ^: j( R, \+ Z

  40. 2 Y9 \' M' l/ H1 {
  41. #undef EDMA3_DEBUG
    . ]5 H- Z% J  A) S
  42. /*#define EDMA3_DEBUG*/' ]9 F0 P9 [- U' K) V+ z6 Z  \
  43. " P9 w+ j1 H% o6 S" o( A0 P+ K
  44. #ifdef EDMA3_DEBUG( L. m9 }) K0 @1 a5 z+ F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 D; H4 u) A7 S6 Z0 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 a* V' x& F7 Z3 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 a1 {/ Y, A& K# ^8 X/ i0 D/ h
  48. #else
    ' N/ `" k" P0 R2 X( w
  49. #define DMA_PRINTK( x... )
    3 a+ Q& Y- M5 ~" z% g
  50. #define DMA_FN_IN
    * R/ Z" ?0 y' x/ j4 y1 O+ ?
  51. #define DMA_FN_OUT* T% h& i8 n7 h8 U8 J" ~8 A, a
  52. #endif2 A% B7 B, b$ x/ H( E& B) \
  53. 4 @& ~$ l0 Z  X  B. A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 ~/ Y$ N' d+ F1 K% V) L
  55. #define STATIC_SHIFT                3
    / E+ B7 h: \3 Q7 @( t0 a
  56. #define TCINTEN_SHIFT               20$ Q5 n: Q& }8 f& |' q+ W$ y4 K
  57. #define ITCINTEN_SHIFT              21- |" ?/ w% R0 h( I
  58. #define TCCHEN_SHIFT                22
    ) ~- z* Y" C: i; _1 E( i
  59. #define ITCCHEN_SHIFT               23
    $ }9 X. T5 M" H' ~

  60. 6 S- y) d6 p6 K& W1 j9 n
  61. static volatile int irqraised1 = 0;
    ( R, l' w: O: ]6 g5 I3 _
  62. static volatile int irqraised2 = 0;
    % h0 I6 t: k7 ^0 _  Y  A
  63. * b' z1 `5 J& Z! T; T+ J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 x# W7 h# M( ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + j  ~, o: _6 u& H, L; H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 }6 d+ g& y4 J: D# x( e. f5 G( w
  67. ) X6 `8 w$ i3 V# ]
  68. dma_addr_t dmaphyssrc1 = 0;
    3 b4 i# K! S6 U
  69. dma_addr_t dmaphyssrc2 = 0;
    1 z2 Y( K+ y  T5 r" ^9 W# l
  70. dma_addr_t dmaphysdest1 = 0;% X+ G( N, L# V8 r% f% ]# }
  71. dma_addr_t dmaphysdest2 = 0;
    0 |- i7 |; n0 b0 X

  72. - }6 m! h9 Q' N5 z& j* k) l
  73. char *dmabufsrc1 = NULL;' x1 _, @1 z/ Z4 Q) p
  74. char *dmabufsrc2 = NULL;
    4 |8 g) X4 ~% Z" X& y9 C
  75. char *dmabufdest1 = NULL;8 x* |) C! Z( C, r
  76. char *dmabufdest2 = NULL;
    $ l9 y+ z& ^5 b: f( g& \0 U
  77. , c# Q: ?5 Q. W8 y! z
  78. static int acnt = 512;
    - ]3 d3 u$ Q' m0 K* J# b6 s2 K
  79. static int bcnt = 8;
    7 s" C1 \9 l, N2 O
  80. static int ccnt = 8;
    2 I4 `+ P/ X- h  v# Z9 s

  81. 6 ?. M: ~  V. q9 F+ k
  82. module_param(acnt, int, S_IRUGO);; `) I2 W4 c0 ~( i+ V
  83. module_param(bcnt, int, S_IRUGO);
    6 Z1 ~6 h/ w- K; s  w, D" K0 D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 `* d# {. y, p% _: U5 n% w" H, q+ z6 f+ {/ Q4 [( b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, S. H; M9 ~7 _2 e% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! i) X+ ?& c( C/ j( d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" B- P% F: J9 R! H; f
. e4 R# r1 ^: x) ~. [
2 j* I$ G: Z+ e; ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 14:12 , Processed in 0.042830 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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