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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 u$ R7 o9 i( @7 k# p! x
  1. [code]EDMA sample test application6 J. Y& y( I$ |0 _. c" K
  2. /*
    ' U$ s, E4 L6 x* I
  3. * edma_test.c
    & h9 K3 o+ ^2 U/ O+ R( a
  4. *
    - p1 C5 Y! ^) {  U5 W$ S
  5. * brief  EDMA3 Test Application4 d% X6 @! Q4 g% y& {. }
  6. *2 o; z/ Y! Y1 q; A. R6 R* D
  7. *   This file contains EDMA3 Test code.. e" S( s+ o1 r# l) [) I! l4 d, r- ~
  8. *
    3 U  P1 `- {" Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 m5 s; q" u  [4 ^* W  H) g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 w+ W+ T4 J# k. c& ]; X
  11. *         TO CHANGE.
    / Q) C: p  @4 D% u/ _5 U4 q" S
  12. *
    , `6 S, }) P' w. I1 T9 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( D4 E4 d) O( v7 c6 W
  14. *- C5 E0 B% [! f3 Y/ x
  15. * This program is free software; you can redistribute it and/or
    ; l; B$ b; g+ e
  16. * modify it under the terms of the GNU General Public License as+ v3 u5 n" s! K) ]' F
  17. * published by the Free Software Foundation version 2.: H5 P: ^' b3 I  T) Z% L6 r
  18. *8 J: U0 J- D, u, S% E# H$ D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! P) d% t# Q8 I# A0 }8 H3 \8 F
  20. * kind, whether express or implied; without even the implied warranty# Q5 T0 v; S; Y/ \/ `2 N, i8 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 f/ k) y% w% o: ^
  22. * GNU General Public License for more details.
    ! d6 }2 ?+ e; g& I
  23. */
      H8 E, P- z2 }; e. t- L8 C
  24. 2 V0 t) n; g$ b+ n
  25. #include <linux/module.h>& `- X! i  ^& H4 Q7 ?. h
  26. #include <linux/init.h>& d- }/ T; h4 a
  27. #include <linux/errno.h>) c& A- N0 Y5 d9 F/ A
  28. #include <linux/types.h>
    : ]6 z% q6 y2 O
  29. #include <linux/interrupt.h>& C$ B- U) C7 I) I
  30. #include <asm/io.h>( @3 g9 ]& _2 B' h6 A6 O
  31. #include <linux/moduleparam.h>4 M1 q* U8 B$ ^
  32. #include <linux/sysctl.h>
    , J$ B9 r4 b$ i  X. [
  33. #include <linux/mm.h>3 v& P* t% g# I
  34. #include <linux/dma-mapping.h>
    0 h* v& U  G& Y, m1 O. i0 R5 I% s
  35.   @& S" l- g- J% n. n0 k: Q
  36. #include <mach/memory.h>" p( q: F9 v" U% l- P- `* W
  37. #include <mach/hardware.h>
    - s, j! y9 v1 z5 i9 `+ }* O8 f& \  N4 E
  38. #include <mach/irqs.h>
    ( r( o: g9 ~1 f: V
  39. #include <asm/hardware/edma.h>1 a# p: ], ~$ e  z( M

  40. 6 m1 b. {7 J1 Z' d' z
  41. #undef EDMA3_DEBUG; {; H/ _. f! B' Z
  42. /*#define EDMA3_DEBUG*/
    4 v5 W" Z* V  G; _
  43. + q. X" E/ ?* W4 x- \8 \. w
  44. #ifdef EDMA3_DEBUG5 h, |- L7 i1 l" t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 s+ j, m, |# k0 ^, k2 P8 |% O  i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 n' G) F+ K1 k0 F. u- Q5 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 i3 x5 d8 ]3 r5 f: P
  48. #else
    : t2 p, y; C  g7 ?  U9 z
  49. #define DMA_PRINTK( x... )) w% K: _, a. C8 v
  50. #define DMA_FN_IN
    0 [# g" M/ R! c+ U! t! V
  51. #define DMA_FN_OUT
    ( G9 \+ Y! Z9 }0 i
  52. #endif
    * w& g) M, r6 c7 N) W

  53. 0 k# K  Y8 N8 ^  y; }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 J; f- K7 r+ Q" y
  55. #define STATIC_SHIFT                3
    0 b" O, d; W5 j& N% D- d* J$ V
  56. #define TCINTEN_SHIFT               201 i7 G( M6 e) b+ r
  57. #define ITCINTEN_SHIFT              21: Y. f3 \# q5 ~% C
  58. #define TCCHEN_SHIFT                22
    9 }% q2 ~" \( ~
  59. #define ITCCHEN_SHIFT               234 Z- [) |) `6 C* l- {/ q6 H

  60. ' ?7 o8 K8 Z- T
  61. static volatile int irqraised1 = 0;6 C: t+ }1 E" {- R- _; D1 L
  62. static volatile int irqraised2 = 0;
    ) n+ D* m8 J: ^1 C9 E* ]: \" ~. B

  63. & A! L2 {  E; W+ O/ G! q8 L/ d: q) E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 k' |7 t/ a* X2 X2 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% b+ E; }. Q0 \/ C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " u) K8 j: r3 d* o7 Z5 b

  67. / d3 ?; o2 D' I5 K- C+ }
  68. dma_addr_t dmaphyssrc1 = 0;
    ( {4 J& O" s( }: _4 s
  69. dma_addr_t dmaphyssrc2 = 0;
    4 F7 O, i& x/ L0 |4 W+ j# T
  70. dma_addr_t dmaphysdest1 = 0;1 a/ g  }9 V' Q: W, \+ Q
  71. dma_addr_t dmaphysdest2 = 0;+ x( K/ y, h- x& V3 G4 |9 F
  72. + G9 {  J% q  U% J4 g  z! L  q
  73. char *dmabufsrc1 = NULL;6 `/ f! H4 `5 z* E
  74. char *dmabufsrc2 = NULL;" h+ V. K. {: V& s' J
  75. char *dmabufdest1 = NULL;' c! p7 v4 C+ R# s  j* R, Z
  76. char *dmabufdest2 = NULL;* _: D' }- @/ `6 h- Y" n: s0 Y

  77. * y$ T4 c% h# r
  78. static int acnt = 512;" l/ [; K( q! \9 t
  79. static int bcnt = 8;( m) s  r  K' a, i+ Q
  80. static int ccnt = 8;
    ' Q$ J7 U/ N5 j1 g

  81. 0 Z* l- h% e, M9 q) d
  82. module_param(acnt, int, S_IRUGO);
    % B; H2 ~/ D# ?4 j, M) U
  83. module_param(bcnt, int, S_IRUGO);
    # ]8 c: d% O# i; m# n/ J1 L8 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 i0 I$ B7 A7 A% }5 C
8 Q, [- f+ b" S4 A. S; c1 r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ Z1 F0 T: T! u& G) T8 Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' v! _) }0 ~6 u! a! _/ R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 c: O& @# f8 [/ H. N
( X2 Q* d2 }( ^, S0 B

0 Y: Q) \9 d9 W, L' X* P0 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-12-6 20:45 , Processed in 0.046806 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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