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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( F  u7 Q# |/ S  j; w0 z
  1. [code]EDMA sample test application3 Y+ w. E$ m) l/ r8 }
  2. /*
    . m- Q$ @# d3 r2 ^1 K( g- R
  3. * edma_test.c
    / D* a- V5 |+ i: z( w3 j) \
  4. *
    - Z' R1 H6 p9 G$ f: Z
  5. * brief  EDMA3 Test Application1 M. v0 z: a4 X/ b3 ^6 k
  6. *
    ; D! n# p+ q" I* x5 B
  7. *   This file contains EDMA3 Test code.3 g" [9 q$ \2 A3 i7 ]
  8. *& q1 h( m) s# v% B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 O) R. [/ n1 A$ I# g! y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 d' p( S. |; X0 Q0 e% m/ b
  11. *         TO CHANGE.9 g9 Y7 K6 J9 p, a% Y1 l
  12. *8 P# C2 R* u, v6 ?* @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, P9 W# A; v6 U* Z  r( [$ p# y0 K
  14. *( J( n& Y6 @4 x9 a* d9 r
  15. * This program is free software; you can redistribute it and/or
    6 C) w/ d+ Z/ X. |4 g
  16. * modify it under the terms of the GNU General Public License as
    ( |& d0 R& n8 U* n, E
  17. * published by the Free Software Foundation version 2.' n# j6 Q, t% T- {/ }
  18. *' E& m4 N+ Y' Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- J( b. b& w5 Q) E
  20. * kind, whether express or implied; without even the implied warranty
    2 P/ ?6 C& ?( Q% \# r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , V; C( F  {; C! M7 L/ u9 y' ~
  22. * GNU General Public License for more details.
    " v5 s! b1 Q) h3 F$ {
  23. */
    , T/ s4 L! e# R3 D) _3 f2 s/ _; \
  24. 4 z  e* @& b- V
  25. #include <linux/module.h>& Z" w" j* D0 {9 u8 A+ n
  26. #include <linux/init.h>
      c. R( A  p! l9 H$ I
  27. #include <linux/errno.h>& ]9 a, Q: i) n3 ~
  28. #include <linux/types.h>+ q  w6 A! J$ L/ N
  29. #include <linux/interrupt.h>
    , |: z9 o) D+ F) z6 [' \
  30. #include <asm/io.h>5 u$ W" U- ?$ H2 O
  31. #include <linux/moduleparam.h>
    1 I/ r! c$ j$ r: a& d
  32. #include <linux/sysctl.h>
    : U, X/ Y' L/ P
  33. #include <linux/mm.h>
    ; d8 W5 g- b% b- R4 O
  34. #include <linux/dma-mapping.h>
    : `5 D( O) X- y9 U, ?$ V
  35. 9 }$ z: x* n4 E* x
  36. #include <mach/memory.h>
    5 R7 x6 k1 g+ |8 b. r, d3 W" Q
  37. #include <mach/hardware.h>. {+ k# P  W1 v. G# N- H6 O
  38. #include <mach/irqs.h>
    3 b& x  \; G# ~) A; N
  39. #include <asm/hardware/edma.h>( A! }3 p+ O  O4 b9 q, S; `% l0 f

  40. 3 y2 a0 e) D3 a5 N( j
  41. #undef EDMA3_DEBUG
    ' T, ~* H/ c7 C& }- u' R( k
  42. /*#define EDMA3_DEBUG*/& t8 I8 w+ Y. ~3 D6 z7 S3 F

  43. 4 r5 j/ N) f& Q3 {4 K- w$ h8 w& m
  44. #ifdef EDMA3_DEBUG
    " U& l/ ]3 j0 P! g, U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # r$ S- k% Y+ u3 V* Q1 E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & Q( x/ B/ I; ]. V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- D. z2 Z3 ]3 p7 @/ D, E
  48. #else7 N1 Y( Y' n/ _1 d
  49. #define DMA_PRINTK( x... )
    / V+ ~. C2 }; E$ N: ?- p
  50. #define DMA_FN_IN
    ! {' R" A2 t7 r5 y" n- r
  51. #define DMA_FN_OUT
    ; b4 p5 N) a+ K; y2 s% w
  52. #endif2 E' f  f: B7 l( O) a- }9 r
  53. 9 x' l8 s4 m2 f& L0 C, ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . `: S. _5 d  h' Y% e; H( E/ ^1 m5 C
  55. #define STATIC_SHIFT                3
    3 E/ T1 X$ T2 U. W6 {) ^
  56. #define TCINTEN_SHIFT               20
    2 e' X; q) W8 ~! a# ~
  57. #define ITCINTEN_SHIFT              21
    : n6 f. ~3 V5 q# z- ]0 P
  58. #define TCCHEN_SHIFT                227 w9 j& Q" E& `4 i0 ]' w# H
  59. #define ITCCHEN_SHIFT               23
    * O! f, Z9 Y& |
  60. 2 r7 w9 G) j. S1 Y$ [4 l
  61. static volatile int irqraised1 = 0;
    8 U! I% M$ x6 R, l& a( p. m+ b
  62. static volatile int irqraised2 = 0;
    ! o0 o4 n$ x9 P% G
  63. % k. S+ \# T5 h9 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + v. x) ?0 b: ~* A8 m! f7 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . o- S- ]( D2 c( [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Z+ \2 ^/ m9 c% T( w
  67. / o+ B2 K# C/ r6 N
  68. dma_addr_t dmaphyssrc1 = 0;" ]1 s$ U6 j- W
  69. dma_addr_t dmaphyssrc2 = 0;7 S, U& N+ V! |" C( ^
  70. dma_addr_t dmaphysdest1 = 0;# ^& x' Q6 j1 M/ r
  71. dma_addr_t dmaphysdest2 = 0;9 x/ I& j) C; [
  72. 3 v( W, {/ C! f) q" c
  73. char *dmabufsrc1 = NULL;* [0 G; b& X2 c. m% p
  74. char *dmabufsrc2 = NULL;
    ) o* [) y2 T. r, m( n. a6 Q; R
  75. char *dmabufdest1 = NULL;
    1 r/ G; [% k% b7 h: S1 f: b
  76. char *dmabufdest2 = NULL;9 j7 \8 Q9 G( Q* o( B* k& `  v8 h# `$ f

  77. 6 D5 l" g/ X- j! R6 r
  78. static int acnt = 512;7 o5 V; K6 Y( E; D
  79. static int bcnt = 8;
    0 ]# ^* f/ C& H6 t" L+ }
  80. static int ccnt = 8;
    3 M0 }/ C% s( _3 \( p' p6 _

  81. / g- |  o2 i( b0 d7 S7 ~( k! W
  82. module_param(acnt, int, S_IRUGO);
      \1 u+ `6 x4 I
  83. module_param(bcnt, int, S_IRUGO);7 B; A  t# m5 K" k9 q3 B7 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* p' s' g4 B! Y1 C' i
, r- [0 ~/ j: p( Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. R, X% N( ?9 J# s; Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! p* n" p* ^  l' I6 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ t# s5 i* J2 G0 S) r6 J) @3 A# o( P4 }' Q6 h1 n
0 u0 @  P* `) e; A+ y. W7 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 00:12 , Processed in 0.038776 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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