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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - f) w! T. z/ [) N7 }5 n. K* X
  1. [code]EDMA sample test application
    ) h( L1 P3 P: Y* L: v7 [* Q" x
  2. /*0 R+ ?" K! u* r; g  r
  3. * edma_test.c
    8 i  G& j* J0 Q! F- G% c( K8 z$ t
  4. *
    * _4 V0 ^) \: E2 o5 @+ J/ u
  5. * brief  EDMA3 Test Application
    0 N8 p& V2 b; N7 _% [4 o$ p% @6 W
  6. *
    6 d* c% ^  ~$ K% K- n/ F$ N
  7. *   This file contains EDMA3 Test code./ ^3 w5 k+ K7 r3 a, C# ^& q
  8. *
    / y5 m% ^9 w7 T1 V+ `2 [( }6 U/ K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : C: {0 Y. U+ y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 K5 O8 }$ r0 P" P: |9 ?0 L
  11. *         TO CHANGE.
    ( P* e& g; M. g$ i# i8 A
  12. *! [4 \! G& E6 F2 Q' h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 j: i  t3 T  T4 _. O
  14. *
    1 Q, u; O. g, Z3 e( m2 N; w
  15. * This program is free software; you can redistribute it and/or7 |4 y5 Q" E* q+ f
  16. * modify it under the terms of the GNU General Public License as
    9 e! Q! a  C/ ~7 T4 |: k) t
  17. * published by the Free Software Foundation version 2.! i, i0 N5 c4 l) J0 |5 t
  18. *
    7 [; H" m4 X6 d. q* b  F. P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- L( Q( L! S! W/ G; ~! b
  20. * kind, whether express or implied; without even the implied warranty+ m; R* v- G/ A0 E) e) ^6 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 H: G1 n1 }1 l! g
  22. * GNU General Public License for more details.
    , D' a$ P( A1 e% i$ ]3 M/ D; c
  23. */9 n+ B5 a7 h+ m  @

  24. ! M! S7 n  X. |  G
  25. #include <linux/module.h>( C( j0 s5 m; K. M# p& |
  26. #include <linux/init.h>) Q4 I4 T3 o, ?& ]
  27. #include <linux/errno.h>+ S/ D5 z5 k* i+ B
  28. #include <linux/types.h>
      g7 ?4 a, O, _
  29. #include <linux/interrupt.h>6 G4 t% ^. k* C" u* a6 Y  l
  30. #include <asm/io.h>( X) b0 [/ r% W) N* d' h2 N
  31. #include <linux/moduleparam.h>
    : ?5 y' u% t8 C) @) j8 b
  32. #include <linux/sysctl.h>
    0 G3 m8 \4 \8 u; G4 ]
  33. #include <linux/mm.h>( O/ s  p, ^. @& n0 h6 d" r
  34. #include <linux/dma-mapping.h>
    0 B6 |- F& U$ p

  35. 2 t( E- L2 D* ^
  36. #include <mach/memory.h>
    5 L7 [% S8 A9 K$ x0 r( G3 D  `+ u
  37. #include <mach/hardware.h>
    ( l. o8 ~% J4 @. j% |' d' O0 k
  38. #include <mach/irqs.h>
    0 F0 ]. u+ q3 L8 |6 P9 P" ~, Z3 J
  39. #include <asm/hardware/edma.h>! S$ l7 U2 }- \3 r
  40. ; }, ^9 Y8 W2 d7 M
  41. #undef EDMA3_DEBUG8 ?3 _: n8 o5 I* M0 L$ j
  42. /*#define EDMA3_DEBUG*/% u' o7 Y. r" ?& B
  43. 6 Q  g# m/ J) a% O9 n: e
  44. #ifdef EDMA3_DEBUG+ J3 k  B1 V$ ]  i7 M0 S4 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 ^  A( U) B4 b5 _9 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & N+ \0 c" I; P: `8 F; N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & V/ T' w% g" p5 P( |  V. p
  48. #else% C/ {( {$ p2 J! Q% @" W: ?5 a
  49. #define DMA_PRINTK( x... )2 g% h+ q2 W2 E* b; F- l
  50. #define DMA_FN_IN
    3 J' A/ }$ ]- k
  51. #define DMA_FN_OUT
    2 w; _" p3 O0 L, y0 m# x. H/ u
  52. #endif
    5 \" Y; h. T, u3 d$ b6 X0 S. q
  53. : u) W( T8 Q3 u; ^1 ~  |9 M. Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* ~3 B; C7 Y' d8 r* w; O/ x/ q$ N- h0 Y% @
  55. #define STATIC_SHIFT                3. L  r, g" X- b5 H
  56. #define TCINTEN_SHIFT               20
    9 p0 Z. M( R1 ~1 D: X
  57. #define ITCINTEN_SHIFT              21
    + r7 L7 q/ b% X4 |! G3 w
  58. #define TCCHEN_SHIFT                22
    9 ~+ ^' E: _, X7 E5 m. X  K+ Z
  59. #define ITCCHEN_SHIFT               232 y7 g5 c3 O  k: t+ L
  60. / r$ g9 |; M: ~# }
  61. static volatile int irqraised1 = 0;
    2 R6 j. U/ N/ z6 {( s1 f
  62. static volatile int irqraised2 = 0;
    . x9 z& {' [! D" h& x, ?
  63. ) n" u( I7 P/ [2 b  M3 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . U9 J+ f: E" z* N0 ?4 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( I) Z$ q5 l+ }0 b" ?: w" f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ~& a$ F0 E8 z( _: ?
  67. 1 @% V) G/ i5 {  n, F
  68. dma_addr_t dmaphyssrc1 = 0;
    & X: ^9 x5 `3 i, J
  69. dma_addr_t dmaphyssrc2 = 0;
    . n3 @, W) F1 U2 _/ F% I2 s1 }& }
  70. dma_addr_t dmaphysdest1 = 0;
    & A1 j: z5 m  p' X3 I5 j4 ~: \
  71. dma_addr_t dmaphysdest2 = 0;
    + z$ ~: y: X* t9 B+ [" s4 O# h1 M/ w; l
  72. * p! p: \0 @& S) ?0 V
  73. char *dmabufsrc1 = NULL;
    - i6 d% e3 F% H9 _
  74. char *dmabufsrc2 = NULL;/ }0 N* W1 b3 Y
  75. char *dmabufdest1 = NULL;
    - z( }. B! m  ^& e. ^8 N4 o2 p  r
  76. char *dmabufdest2 = NULL;
    ; U- u' T0 j- R5 J; l) k, ?

  77. 6 v. ?9 S& [& {2 V, r* m
  78. static int acnt = 512;) a+ X! w2 \, b. [3 O+ x+ \. J
  79. static int bcnt = 8;
      v. I: E& j& C
  80. static int ccnt = 8;
    0 d2 }0 X( S% P# Q) f* p

  81. ! m0 V% z8 W# q6 P6 Z
  82. module_param(acnt, int, S_IRUGO);
    8 s4 c2 N( J6 ~0 o9 `
  83. module_param(bcnt, int, S_IRUGO);
    ) v  S/ s) t2 j6 a9 E2 }# w8 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 G0 H4 w" E0 y9 Y9 L

9 y$ D5 ~9 U; J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" o$ H6 c/ @; V  P$ y+ T! \# uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 L/ R4 b' O( B; |0 z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) w* T% o: M" q

# v- Z5 W& U: R8 e1 E, k- ^* U% \# L6 ]: K' n/ ?( v3 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 22:03 , Processed in 0.040282 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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