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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; M: |( B& C, D
  1. [code]EDMA sample test application
    ' |; c1 |' b, X- f
  2. /*
    ' W9 s1 p( d% v6 {
  3. * edma_test.c
      c1 ]. {4 W  r  P4 X
  4. *
    . W0 `( c! z9 {$ t' S
  5. * brief  EDMA3 Test Application* t4 J' q( A. ]1 _4 N3 N6 K& X
  6. *+ I* a# T8 A) U* P0 T; f
  7. *   This file contains EDMA3 Test code.
    $ J2 A9 p5 ?" g+ X+ S  n, W9 h
  8. *
    . g# w. g: A* l" t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 {# t  k+ W% {" S- ]# }; {* l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" l2 r, K( m& L3 t
  11. *         TO CHANGE.3 n0 x# e# h+ @
  12. *3 S% }& G3 M3 b) S, m2 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  ], H9 t- @; q) m
  14. *
    ( c9 h. i/ k' R: ~  U
  15. * This program is free software; you can redistribute it and/or  z' s* k" I  A6 c/ o: A
  16. * modify it under the terms of the GNU General Public License as0 k% F0 u5 X5 w; s4 W7 E, ]! P, e
  17. * published by the Free Software Foundation version 2./ }) o* o9 j- I# c/ B. G* f( `  O+ p
  18. *# m7 _) g5 }  ]; P: Y8 T) N# A# Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 `0 @' @- v* S& w: V: }/ j7 o* P
  20. * kind, whether express or implied; without even the implied warranty7 _1 D' i7 e. A9 K4 F& i* ]$ o7 u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & ]* r* b: K  D3 A
  22. * GNU General Public License for more details./ i+ [: ]& N3 s, G& J& o
  23. */
    . y2 \* J1 P! m, j" x

  24. & G5 C% w$ X+ `' Y
  25. #include <linux/module.h>+ s' k+ P" i' a
  26. #include <linux/init.h>4 }3 k3 s: f( V  e5 Q" L
  27. #include <linux/errno.h>
    0 w$ ]6 a( T6 g: {; t  d+ I, j
  28. #include <linux/types.h>
      T6 w" M6 V) J/ `
  29. #include <linux/interrupt.h>
    * z1 E; C7 O' v% r
  30. #include <asm/io.h>
    : s: K+ \& W) B7 i4 ]2 t& p
  31. #include <linux/moduleparam.h>( H& E# r. ]8 f! }) h' x
  32. #include <linux/sysctl.h>" N6 h. m+ p6 ]& o2 G6 x' u
  33. #include <linux/mm.h>
    # y, p% Z6 q5 Z  d$ V2 i
  34. #include <linux/dma-mapping.h>6 q% R1 [9 C0 W3 P/ Y" @
  35. ) Y8 B0 b' B8 m) j# [
  36. #include <mach/memory.h>7 R; s! x6 V  E  {& K% r4 u2 y" Y
  37. #include <mach/hardware.h>5 u" i+ N5 Y0 c+ A' I3 r8 t
  38. #include <mach/irqs.h>, J& p1 C& Q" f- S9 S3 }  G5 o/ A
  39. #include <asm/hardware/edma.h>
    0 i- p0 `! f+ }4 v& K
  40. 9 }5 ]! U$ k- x
  41. #undef EDMA3_DEBUG
    + A  w& D$ B7 d: _& P; I
  42. /*#define EDMA3_DEBUG*/
    % P$ `  `/ H9 \7 U

  43. - k/ P+ R5 P4 Y, N8 a
  44. #ifdef EDMA3_DEBUG; K' d& z) E8 Y* ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 L( E+ g/ Q, R+ Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; T) U; `  ]' i, ^: S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ c5 @5 x( M- [
  48. #else& L3 K/ F, p9 z3 ?  W2 f
  49. #define DMA_PRINTK( x... )
    9 q" f6 n! j1 X4 k2 ~5 m$ |
  50. #define DMA_FN_IN( R% j1 N5 z% a/ S- K: ~1 J% j
  51. #define DMA_FN_OUT6 a! ]+ @2 }( W0 T9 O* `
  52. #endif
    ) T( d7 \4 m9 S  _* S9 `
  53. + ~7 c' O, g% ^9 j8 q! y% [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 n! Z7 M6 l7 e: i8 P
  55. #define STATIC_SHIFT                3! \) r3 n1 x* e. @; J( O
  56. #define TCINTEN_SHIFT               20' h* F: Q" P- w. _( H1 ]# F
  57. #define ITCINTEN_SHIFT              21
    / u  V! q# V0 B. s/ V+ c% p
  58. #define TCCHEN_SHIFT                22
    6 T* r( k# a0 @2 s* b# Y4 W* |" g" B
  59. #define ITCCHEN_SHIFT               23
    1 ?6 X' j; \1 Y9 y2 a1 N
  60. / c/ J! J( n1 p5 s
  61. static volatile int irqraised1 = 0;
    + E$ s/ I$ J- @( O. _
  62. static volatile int irqraised2 = 0;6 i) K0 c* L  s% P7 w" q! i

  63. # G1 |2 ~  G4 D* i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 |4 U/ ~( J3 k# q9 z9 y: C: L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 v- r: ?7 G' I3 }4 t. i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' V. d5 U! B  x- c2 M

  67. 2 v, p, T+ l0 M9 R
  68. dma_addr_t dmaphyssrc1 = 0;
    . f& o  S9 x7 X% ]
  69. dma_addr_t dmaphyssrc2 = 0;  [6 v9 @8 C8 Q) X3 g
  70. dma_addr_t dmaphysdest1 = 0;7 A: e2 [& p1 R% K0 `) I
  71. dma_addr_t dmaphysdest2 = 0;6 z- h1 c/ B. H* l( G+ j3 b$ Y, q

  72. & Y! R! Q4 G1 y; J+ O
  73. char *dmabufsrc1 = NULL;' [7 }5 v. y% U% e' h
  74. char *dmabufsrc2 = NULL;
    ) q4 p6 o8 R( A# Q: g& M* V. H+ X. c
  75. char *dmabufdest1 = NULL;
    3 T1 y/ e; v/ R( K. X- @
  76. char *dmabufdest2 = NULL;1 Q$ K2 Y) b  {4 I9 k' G9 X
  77. , Q% s7 A+ L' F, d3 H
  78. static int acnt = 512;" O, M: L! L; d0 |5 \9 g$ c) Z
  79. static int bcnt = 8;+ w8 b( N& Z  ]9 |0 \
  80. static int ccnt = 8;3 `- ~$ x. V. l+ j

  81. % |, x; x9 ^: v0 U9 r8 T: k) C
  82. module_param(acnt, int, S_IRUGO);
    2 u! |) N3 y+ Y2 e' x; W5 e
  83. module_param(bcnt, int, S_IRUGO);
    # d+ m3 O2 Z& Q4 q9 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 m- z" @- q; e9 [7 G) b" l8 n, ~
* O3 V$ Z1 L( l' K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 M' ]3 o0 o1 x* ?# U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# I9 e6 x5 v  P8 F4 P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ ]% J7 {) D0 @0 l0 o: i. N
; r' ^# K6 X6 s& m! S7 E" l

8 G( Y3 i* o/ t# z( f+ {5 R, B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 02:03 , Processed in 0.104214 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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