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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 p5 d4 w" a' ?& A  u! Q+ X1 ]- ?$ ], e
  1. [code]EDMA sample test application
    # h  k' Y. M. j
  2. /*
    " h8 K- h/ q: k% [8 k
  3. * edma_test.c4 q: N9 k/ A2 T  F
  4. *
    ! g( \  Y& q* o- W5 }6 y
  5. * brief  EDMA3 Test Application4 \+ m$ A# j, N- `
  6. *
      |5 @% v8 B1 l2 d: `1 m
  7. *   This file contains EDMA3 Test code.
    & r% m8 g! J; A3 K; t0 q
  8. *% k0 k$ g+ j* X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 x2 s/ U* z. C9 T; m0 P' k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' w/ J+ s5 \! ^" }
  11. *         TO CHANGE.) x* \# i! }$ Z: b  \9 V! }
  12. *
    " f) E+ i! P& g5 n6 S2 w" x, s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  u1 V6 `7 T/ h6 y0 j/ v
  14. *
    8 J" \& [7 U3 |) U$ |
  15. * This program is free software; you can redistribute it and/or
      Q8 `6 S! \2 I" i
  16. * modify it under the terms of the GNU General Public License as
    1 ^' J) ^) e* j' l6 e# T
  17. * published by the Free Software Foundation version 2.
    ! U. E8 x1 k4 u% E" F
  18. *
    ! {5 y: I% m" S( h- t* Q3 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 E: |% L3 o% t" r' i
  20. * kind, whether express or implied; without even the implied warranty
    1 i% I# T& r- n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % k# Z( h5 [: \; Z
  22. * GNU General Public License for more details.5 Q" @- I8 H0 A/ J. S# k! \! N
  23. */6 {3 i) r( V8 `( h4 f
  24. . M$ Z# p7 m' [- F" A5 X2 G( e
  25. #include <linux/module.h>
    & s' w/ {6 `% x3 D. @
  26. #include <linux/init.h>
    4 f7 l, D0 i9 g7 W$ G6 [: P
  27. #include <linux/errno.h>
    / t$ M; e. u: H  s  \/ [
  28. #include <linux/types.h>
    8 {9 Q# X9 X# o- g+ B: t: t# {2 U5 l
  29. #include <linux/interrupt.h>( A+ ~% B( N4 \! l7 p1 V. y4 H' ]
  30. #include <asm/io.h>; A6 G9 G9 ~% o1 U. S& `
  31. #include <linux/moduleparam.h>  o) s" |* U% B, G" u. e* m7 B. Z& ?
  32. #include <linux/sysctl.h>: p) N5 D; {) T' _* N) ?) M
  33. #include <linux/mm.h>
    ( t% s8 t3 _, W# r3 B1 K4 B
  34. #include <linux/dma-mapping.h>. K  k5 K  X0 p% S

  35. . R/ s6 m. t7 t+ F0 I3 T
  36. #include <mach/memory.h>$ k: j- ?/ y% u* X+ u3 Y
  37. #include <mach/hardware.h>
    " W" s. M/ G+ J: p' i
  38. #include <mach/irqs.h>/ |( }! o1 v) B  P
  39. #include <asm/hardware/edma.h>! L2 e& |8 U+ B! E3 x, m  V

  40. 9 k1 Q3 ~0 H+ B/ d% y  L! r5 E
  41. #undef EDMA3_DEBUG5 @( ?4 F" p. f4 s1 T9 [$ y8 Y
  42. /*#define EDMA3_DEBUG*/
    ' O. @- Z' y2 M

  43. / R6 Q/ f$ g7 v2 F
  44. #ifdef EDMA3_DEBUG
    5 Q/ z4 ]+ U0 r9 K6 V- s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 k" \1 o+ ?* m% w8 V# s9 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ s$ I: M' h  v3 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 p' G3 ?3 K% q* l* W) O
  48. #else- \* G$ |5 b9 X& L2 c- o6 v, {
  49. #define DMA_PRINTK( x... )
    - }! G1 j% a3 j& C+ S' ?6 g
  50. #define DMA_FN_IN
    8 l" D  l" |  e. d
  51. #define DMA_FN_OUT
    6 b' R) A* S0 M' L+ B
  52. #endif
    1 ~. e4 ^, u- ~9 J
  53. 4 ]  T8 s/ \% U7 l* V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 `/ v' n  l0 ]6 f
  55. #define STATIC_SHIFT                3/ K3 l3 A/ I7 K
  56. #define TCINTEN_SHIFT               20
    . t4 k" d, h& Y" h/ n9 D- m, x
  57. #define ITCINTEN_SHIFT              21% G1 q  d& X% X( Y8 o& Q9 |
  58. #define TCCHEN_SHIFT                22
    * q* l/ @/ n+ a/ Q4 g
  59. #define ITCCHEN_SHIFT               238 G3 b9 _& f  W& V0 a8 ~

  60. ; g% ~3 D' R4 Z2 I  s# D+ |8 X
  61. static volatile int irqraised1 = 0;
    2 A1 o& g0 g4 x) V3 p
  62. static volatile int irqraised2 = 0;
    7 t/ E! E: h$ [, A, P- m" A. U2 f

  63. ' z6 T+ z, |) P9 y: H4 b( M# }$ V8 W! P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' M) s" {& }2 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ]4 ~* V; |+ n% @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % d- v' H! d# V9 z( A5 ]
  67. ) ^! X& s3 n9 k
  68. dma_addr_t dmaphyssrc1 = 0;
    8 Y8 E6 ~4 D! M2 q5 m
  69. dma_addr_t dmaphyssrc2 = 0;( }6 k/ k+ @4 p* |. d, w
  70. dma_addr_t dmaphysdest1 = 0;
    % W$ X0 S0 ]( u& s0 C5 d
  71. dma_addr_t dmaphysdest2 = 0;! c! y0 T+ s7 x4 I& Q6 o. X% @
  72. . B* s  D0 S; z7 s  a+ W& m8 t0 e
  73. char *dmabufsrc1 = NULL;3 |* Y# B- @. L9 b. q! ]
  74. char *dmabufsrc2 = NULL;
    # O% L$ K# H7 v9 F4 _6 ]
  75. char *dmabufdest1 = NULL;+ b0 E- a3 e  \; m7 v
  76. char *dmabufdest2 = NULL;' Y9 i4 M: c" C' H: `9 ~) M

  77. $ n5 ]& p/ ~1 E& `
  78. static int acnt = 512;  Z! \9 E$ e. v* l3 \" I
  79. static int bcnt = 8;
    ; F; p# d, g; a9 d6 W1 e
  80. static int ccnt = 8;
    ! |( ^; u; ]. M) E2 F
  81. ' r. b1 [6 p# h, F: e5 w
  82. module_param(acnt, int, S_IRUGO);
    ' G9 d* A3 @2 L4 A. R
  83. module_param(bcnt, int, S_IRUGO);/ \1 Y! |& N- Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' j. {/ t' l$ }0 V4 P/ N

% m9 F1 a2 c$ U# A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  X" v; m& k! N: p: U. h4 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' Y% r- E, R! e, X, N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 ]( V# Y/ {2 D
: H# ^: n) Q4 m' Y6 x' M2 U' m% |! E; u8 G8 {& z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 20:50 , Processed in 0.035913 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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