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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 `! K" a+ a$ U! `2 \4 I1 ~
  1. [code]EDMA sample test application
    - P% Q3 T( a" F1 m' P( t& D1 s
  2. /*8 R; V5 a. [  t) Q- T6 h
  3. * edma_test.c
    , b9 p0 q4 Y2 J0 t) ]8 Z& {
  4. *
    . |( N6 q6 I8 b1 T0 I' h% A# j0 ?$ n
  5. * brief  EDMA3 Test Application! e" i1 Z" A$ E
  6. *; `: K: P+ Q: z
  7. *   This file contains EDMA3 Test code.( p( i+ V) V3 z8 Y1 Y0 [/ ^
  8. *
    3 z' c2 }$ S  t! ~; Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 N2 V% d, F8 u* e. V2 ]# H0 o' T/ Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ b2 B. j5 q" s+ h" b8 @
  11. *         TO CHANGE.
    ; ]# D$ b" a8 U0 B/ n+ f4 Q& X
  12. *) ]+ n- y) H) q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" [" q# I6 m/ R
  14. *
    " ~& _5 H) o6 u8 j4 G' s  H& k* e( p
  15. * This program is free software; you can redistribute it and/or
    $ k" O3 C* x4 V- }( Y
  16. * modify it under the terms of the GNU General Public License as
    / L" H" X2 ~% ]( z- a3 H" v
  17. * published by the Free Software Foundation version 2.; l; w) }6 v: I
  18. *8 n& L4 c+ S& l8 r( U$ j% b3 w" s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 [/ J% N  n, V
  20. * kind, whether express or implied; without even the implied warranty
    5 P$ ~2 }5 W9 {+ }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) U* r, e' \+ y5 f
  22. * GNU General Public License for more details.* \. R) R' d  p% I: @  s; Q9 H
  23. */
    3 S- _2 A$ h5 t1 L/ o) h

  24. ) \1 x: N6 b% _
  25. #include <linux/module.h>
    4 l8 w, |" \9 E  o( B2 T% k" D
  26. #include <linux/init.h>! P3 H0 }1 e9 J+ w1 e
  27. #include <linux/errno.h>
    : t" C; o) y, j* K# k5 n+ T
  28. #include <linux/types.h>/ a5 {# F; P1 U3 u3 C3 U
  29. #include <linux/interrupt.h>5 U# l+ H8 b, }  U) s  h
  30. #include <asm/io.h>. W( f! y2 b; S6 `2 i& @6 Z& b" S
  31. #include <linux/moduleparam.h>
    $ X) W5 q# s" d; T! F0 q
  32. #include <linux/sysctl.h>; d. N7 F6 L: D0 Q5 e, k5 `* v% _9 _
  33. #include <linux/mm.h>
    # T8 }0 G; s  h0 L) _
  34. #include <linux/dma-mapping.h>
      i, F2 \9 L  m4 J4 w' d

  35. ' J! X  t3 M- p! W, v7 g8 \+ M
  36. #include <mach/memory.h>
    - X: K7 j; M( i# R5 _2 [
  37. #include <mach/hardware.h>
    - N* F+ O) A+ D* r- h7 d
  38. #include <mach/irqs.h>
    + @. k9 M0 ~: V2 |
  39. #include <asm/hardware/edma.h>
    1 @' L. r& L9 ?4 [, K0 x3 ?# W
  40. $ p7 R, q: l% E; ?  k
  41. #undef EDMA3_DEBUG* ^5 m8 X/ S. n% J
  42. /*#define EDMA3_DEBUG*/
    - a* h. j) r' i$ M9 N, L

  43.   S8 G4 S2 `0 h# c+ f4 L, a
  44. #ifdef EDMA3_DEBUG
    & p0 N* f% c% P: j9 I: Q% b1 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): S, s" ?. i& s  P/ T, u/ `+ Y% }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& F' ?4 @+ D+ p; Q5 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' I( }/ t# |. B0 j3 m" D8 L
  48. #else3 ]4 n9 a1 l; ?' f3 x7 }2 h& U4 J$ O: q
  49. #define DMA_PRINTK( x... )
    $ p( S0 R( w, b( ^8 N4 T
  50. #define DMA_FN_IN. D4 E; Q# X4 A2 g  I/ o
  51. #define DMA_FN_OUT
    " _9 E* T+ Q: E1 b& Y- H6 c5 W
  52. #endif3 z* `& d  f8 R2 \  ?  f+ h; W9 d

  53. $ z! `# F( V0 T; [% P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , c% @- f+ }/ E1 J( c
  55. #define STATIC_SHIFT                3
    8 S2 c! I* K1 p9 ?) F' j1 z% O
  56. #define TCINTEN_SHIFT               204 g3 ], s9 w+ b6 @! z5 L2 a" A- O) P
  57. #define ITCINTEN_SHIFT              21" [+ i# y+ v# `( d
  58. #define TCCHEN_SHIFT                22
    ( H$ ~/ L8 `/ Z2 `% Q3 z3 y  ?' w) X
  59. #define ITCCHEN_SHIFT               231 U9 p# P" b2 C( W, W
  60. . \% k  w0 H& x# t9 U$ I. I. ~
  61. static volatile int irqraised1 = 0;
    2 d7 \' y- Y3 F" j4 t9 {
  62. static volatile int irqraised2 = 0;' _3 v( W8 ?* T! T% R  |

  63. & w4 r* U. |" ~6 y+ g* |# y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . j: L# C" z- d1 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. t/ D4 {) p; }$ K2 \5 t% X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 T  o3 q& S, P) j, p, ?

  67. / n/ z. w: }, s, {1 |1 r9 U
  68. dma_addr_t dmaphyssrc1 = 0;
    6 T& b  O$ m& b
  69. dma_addr_t dmaphyssrc2 = 0;
    ; Y7 Y: m; _9 E" q0 T0 P
  70. dma_addr_t dmaphysdest1 = 0;1 D; _( G0 v! I# v$ |
  71. dma_addr_t dmaphysdest2 = 0;) e+ ?, s3 H! k" [' _% j
  72. " X% e4 |. E9 W* P, _
  73. char *dmabufsrc1 = NULL;
    # x5 W# s' `7 t4 p3 w/ F$ u, p+ L
  74. char *dmabufsrc2 = NULL;* N0 ^, t% }5 Y7 L5 M: k+ U& }0 z
  75. char *dmabufdest1 = NULL;
    * C/ ], q0 q& [
  76. char *dmabufdest2 = NULL;0 X; `  i: ^- ?2 x+ l) P8 _
  77. * ~8 I. ]1 K% H2 _* D
  78. static int acnt = 512;; z. l5 K( B3 S, B/ Y' C
  79. static int bcnt = 8;- d: |" `& {0 i7 Y. c! d
  80. static int ccnt = 8;
    : I; n3 \2 @$ c5 o/ ~, k! n
  81. . E, N' M5 _% l6 i: `) O# d# f$ }
  82. module_param(acnt, int, S_IRUGO);6 ^& B" L6 L6 _5 g
  83. module_param(bcnt, int, S_IRUGO);
    3 |5 N# }3 D% R) S1 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ J+ A2 ~" }5 p9 _& v4 E; ]) L

3 n1 \# B  o6 W. P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 u! w1 T# d; k8 Q5 z3 Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 R1 @) I4 E. p9 P: V  m5 E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" a% x2 K* q- ^; M, L! r8 o. j$ t; l7 }' [; @) q
* x, W( w' E) w( a: R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 16:05 , Processed in 0.040809 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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