OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" \# M- A( T+ Q% K$ F
  1. [code]EDMA sample test application
    6 M& C/ i2 ]0 E) v. v
  2. /*
    9 l% }0 M% _5 P+ P- L: t$ j5 v
  3. * edma_test.c1 j  Y- h2 m( e
  4. *
    2 W' U" E. h3 A, X' i
  5. * brief  EDMA3 Test Application
    2 S" K7 G' Y" ]3 _4 @, M0 q- A4 Q- b& s
  6. *
    0 V9 M0 J; O7 ?& O
  7. *   This file contains EDMA3 Test code.( {9 q* V, M  d5 z( O8 M. B
  8. *, v% ?2 N7 V# ^: }0 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      x3 ?5 {, F5 |6 t  ]# i5 Q5 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( `  @0 {% A3 p0 L% g# {6 r
  11. *         TO CHANGE.
    . ^1 _2 R: g1 G
  12. *
    2 U, Y, C0 G) d! K& B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 ^5 e# s7 {! A2 w- J
  14. *9 b* Y0 L8 X" e) N% W
  15. * This program is free software; you can redistribute it and/or
    : D) E5 `0 h0 ]. e+ S7 `
  16. * modify it under the terms of the GNU General Public License as5 z& D7 U* Q+ n' N1 Z; a8 ?; [9 ?( _
  17. * published by the Free Software Foundation version 2.
    . \0 B% {* c9 ]4 I# z, m
  18. *
    . ^2 n5 r( s9 H8 n/ D9 K# T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 u- f* ~: c, ?) R6 e, P
  20. * kind, whether express or implied; without even the implied warranty. b) {# J- R* Q+ M: {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- D2 p4 g4 b" ?, t
  22. * GNU General Public License for more details.7 m  j6 n! ~  l9 C4 V; I
  23. */- W) b, z; i' i7 ?5 M8 w  S

  24. : D8 \9 j  w# w4 O
  25. #include <linux/module.h>" Q- U3 n, a0 E2 N& }" A' n1 J$ ]
  26. #include <linux/init.h>
    . J9 m, U! J7 q0 `) A9 K
  27. #include <linux/errno.h>
    % j& c% A$ l/ ]* n5 ?. K
  28. #include <linux/types.h>
    7 ^6 A7 Z; C5 @0 d8 p
  29. #include <linux/interrupt.h>
    : T  {$ z3 _# t- q) a' M* n
  30. #include <asm/io.h>0 I4 a( B& ?7 I" ~3 @1 |
  31. #include <linux/moduleparam.h>
    4 n0 l4 V3 C0 D! h7 M- m
  32. #include <linux/sysctl.h>6 z# Y* t% u& h. }( u" O
  33. #include <linux/mm.h>% k& o; a7 ?  T" S" L
  34. #include <linux/dma-mapping.h>* U  @* D9 Y# r% q
  35. - q9 M3 j) l3 i0 M4 S) Q( K
  36. #include <mach/memory.h>
    - x: p+ H. a9 Z# ~6 b( ~
  37. #include <mach/hardware.h>2 `0 q/ p$ |- V6 o
  38. #include <mach/irqs.h>" p/ I' \$ A: N  \9 w3 i' X
  39. #include <asm/hardware/edma.h>1 r, V. f# c. ~, `
  40. % S2 d! P! k5 \6 z2 n) |( h' g
  41. #undef EDMA3_DEBUG2 e/ R% J6 X/ ^
  42. /*#define EDMA3_DEBUG*/# |) ?  @5 }5 d/ E7 V5 `

  43. ( v" t8 O; b1 C2 b$ r
  44. #ifdef EDMA3_DEBUG5 G* ^. E9 e9 ~% w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( z! h! O$ B$ d" t7 f. C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) \2 ]: w" `$ M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + W" C3 J6 i2 t; J: J$ [  {2 k' w
  48. #else
    6 c% k6 w9 C( M1 I
  49. #define DMA_PRINTK( x... )
    2 ]7 ~+ f" t/ D7 x+ q8 c
  50. #define DMA_FN_IN
    8 r0 A# ]4 `- w) v) }' ^
  51. #define DMA_FN_OUT- T# Q; K& N/ r
  52. #endif
    6 r  s9 v5 T1 s* O+ x
  53. 5 h3 N* X6 u' P$ C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  K/ s1 \. z8 \3 O
  55. #define STATIC_SHIFT                39 L( w! `* e) c; l. H8 |
  56. #define TCINTEN_SHIFT               20. }8 _6 m0 W: N( y3 D
  57. #define ITCINTEN_SHIFT              21
    " c8 F# O2 Y- T( q
  58. #define TCCHEN_SHIFT                22. M7 o6 Z+ p( J9 z$ z, V
  59. #define ITCCHEN_SHIFT               238 q/ _: t1 E% w# o
  60. : C0 ?; V7 w$ B4 Y4 a
  61. static volatile int irqraised1 = 0;
    6 c1 W3 v: q, J& T1 U
  62. static volatile int irqraised2 = 0;+ N  i! Q' x6 j1 z) O% G

  63. 8 G5 H- u! K) X6 i+ c% d4 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , [/ K; I+ T: G' X" D+ e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, R' b" T# Y" y% }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + c9 ?  h3 ?; p, @$ s

  67. 1 S  i, r$ d" ^1 @# B8 Z$ C
  68. dma_addr_t dmaphyssrc1 = 0;" T8 t# \& Y* _( I1 `; G
  69. dma_addr_t dmaphyssrc2 = 0;
    , u3 ]! w$ t5 B7 l2 n
  70. dma_addr_t dmaphysdest1 = 0;7 H! M/ f8 @. M' E2 l0 K6 o) s, R: [
  71. dma_addr_t dmaphysdest2 = 0;
    $ \1 J9 t/ ~. ]  i8 O. l

  72.   U2 G% {: E; j# G
  73. char *dmabufsrc1 = NULL;
    9 _( c+ ]/ P4 b. t+ Q
  74. char *dmabufsrc2 = NULL;% m0 U, z$ e0 x! A; n7 i
  75. char *dmabufdest1 = NULL;
    . e, q& y, i- S
  76. char *dmabufdest2 = NULL;
    0 o1 }" u; K& i8 y) J
  77. 2 Q+ N1 Y' D1 H- }2 Y8 S( e  K# K
  78. static int acnt = 512;
      Q) Z0 V# j* Z8 m8 a4 J+ F
  79. static int bcnt = 8;
    , L7 e* B: B- K) Q4 b
  80. static int ccnt = 8;1 R& I. C8 A, D; K+ M1 R
  81. ' |' q3 E- N( F- ]! m
  82. module_param(acnt, int, S_IRUGO);; _2 b3 m6 j- X) L
  83. module_param(bcnt, int, S_IRUGO);) K; r' x( o- m+ ]0 \) p$ `, K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  l5 s' A, S/ h1 d0 e' j0 L# l0 a
% X/ E# w7 j$ ^: R" L. ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 K! S* J9 c: s6 Z, q3 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ M1 O3 @; g/ K8 e4 k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 i8 O5 C& x5 Q3 _( w* w. N* V9 K' ]
# b: l8 y' q8 g3 h; w9 ]1 ^: h
& ?$ I/ s1 Y( u1 s0 w/ }/ c/ r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-2 19:54 , Processed in 0.035894 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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