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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 i" t; \, D- n" Q; F3 M% D
  1. [code]EDMA sample test application
    * M; p4 {. k3 ]
  2. /*4 F0 A0 I9 P- l5 r& u
  3. * edma_test.c4 @$ ^$ U. `/ T& ^
  4. *: g6 n2 \: S$ W8 T: c8 F4 }; ?: J
  5. * brief  EDMA3 Test Application3 N; w" h6 K  \+ |
  6. *& B3 S% D% a) ~  T
  7. *   This file contains EDMA3 Test code.( f, t3 M5 O  M% Y' k
  8. *- l+ j, W5 v' m" l: j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 k" f# Y' n# Z- ~  ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  R  {) q( P- j2 w* h
  11. *         TO CHANGE.
    . {& i4 e  h$ h5 \# C
  12. *4 Z0 M7 `* R8 F$ K  B7 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* b- g% P3 \: _* K- M
  14. *
    4 m1 E( e2 q0 |' L2 q9 W+ \: M
  15. * This program is free software; you can redistribute it and/or
    ) u+ K  j5 d' Q1 k
  16. * modify it under the terms of the GNU General Public License as1 f" i" I) ^2 P' v, x3 ]5 x
  17. * published by the Free Software Foundation version 2.* K5 ^( l4 R* D! V4 `
  18. *
    1 R! r/ y5 V- u( V, t9 o& d0 W( C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( e& f7 D. R) v# J
  20. * kind, whether express or implied; without even the implied warranty3 M6 v9 W& o& ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 z% k( k$ x. X" d; K, ~" X$ k
  22. * GNU General Public License for more details.2 [1 M0 L" p6 @8 |% O1 a+ a, ^
  23. */2 b& _2 B! a% f1 O
  24. ! H' p) i0 ^: x# E) J6 h( t
  25. #include <linux/module.h>
    7 V9 `/ c/ Y4 N
  26. #include <linux/init.h>- e' R: m( f7 c8 O' k! I
  27. #include <linux/errno.h>
    2 i/ D5 t& \% t% K
  28. #include <linux/types.h>7 l" g7 g3 E- i: `# D! Q
  29. #include <linux/interrupt.h>& \8 Q2 _% C0 g, A. B; K# k! T
  30. #include <asm/io.h>
    7 V3 I( q9 t- Y9 J; F) U0 V6 d" y
  31. #include <linux/moduleparam.h>
    ! o+ h& Q) [5 Q: m2 o" z
  32. #include <linux/sysctl.h>, @! v- C) [- {2 }6 E6 E' J
  33. #include <linux/mm.h>  z9 G6 [3 `1 \6 o
  34. #include <linux/dma-mapping.h>
    9 J7 {5 I; b- H  V7 M. T9 `
  35. - C) I' R6 B& q. J
  36. #include <mach/memory.h>* G: ~3 G, E. S6 F2 J0 o
  37. #include <mach/hardware.h>
    1 C6 Q' v( K$ C% e9 N4 u
  38. #include <mach/irqs.h>
    : ~: k- h: q! s& C
  39. #include <asm/hardware/edma.h>
    . O& H9 c1 ~7 b8 K" |8 w
  40. 4 ]! Z8 d) f' t* N2 @$ f- A$ W. V9 e
  41. #undef EDMA3_DEBUG0 B, h4 B( v  f" i6 R1 u
  42. /*#define EDMA3_DEBUG*/
    5 V- ~3 C* a: N5 V8 }3 `% J: Q

  43. 8 Q1 e  F( j/ K' L. r: f
  44. #ifdef EDMA3_DEBUG
    + t3 I, ?% x: [. [1 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + n* {( Y& q( V1 s& q  c4 o; d' K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  w# A7 {- `" d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 T: H8 _* S  s0 j
  48. #else! [8 k; u- l0 j
  49. #define DMA_PRINTK( x... )
    4 c: A& X% q9 r, U- L
  50. #define DMA_FN_IN, x/ y% Y8 L" C, v9 m5 c3 ]% A
  51. #define DMA_FN_OUT- d5 D6 j* w8 Z) ]; I4 |1 `3 ?6 n5 V
  52. #endif
    - M! i, }# b2 A# x4 o0 Z; v

  53. , Y1 A: I; ?: D9 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - F9 E4 r4 l2 |( k8 ]: b
  55. #define STATIC_SHIFT                3. F8 k2 _. Z, N$ W! [: \$ K5 P
  56. #define TCINTEN_SHIFT               20% Y; r/ N; l0 E
  57. #define ITCINTEN_SHIFT              21
    # C. U7 w( c1 v+ p+ t
  58. #define TCCHEN_SHIFT                224 b& _+ |2 \  b; u, v' Y
  59. #define ITCCHEN_SHIFT               23
    " j& r# a& j% g& y( k; x

  60. " W; w( l9 ^; o0 @
  61. static volatile int irqraised1 = 0;+ M' s9 `6 E% x) p* b
  62. static volatile int irqraised2 = 0;; x2 e1 b/ D# U. P" q- E' q$ a& L  g
  63. - ~( r5 c) [! M. a4 y% h4 I9 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S" p! c6 o+ ^( Q& j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 p( i, L* l$ h  k# m: c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " Z) M! r. c$ V5 @! @: s8 ?9 B
  67. & z* d9 P5 R' Y! T+ Z. R
  68. dma_addr_t dmaphyssrc1 = 0;
    9 w) t9 h! f# t. X
  69. dma_addr_t dmaphyssrc2 = 0;" b# o; l. s* t8 K( J  g7 J7 R+ s
  70. dma_addr_t dmaphysdest1 = 0;
    . ]" q. P% ?, r  Z3 g0 L, q* U
  71. dma_addr_t dmaphysdest2 = 0;5 S* R5 |- i/ D2 a1 h# c, |

  72. 8 L6 S# }8 P* D* \8 h
  73. char *dmabufsrc1 = NULL;+ i$ V/ I+ K' \
  74. char *dmabufsrc2 = NULL;
    - {$ ~' I8 _* K+ _, @$ H4 ~: h' J
  75. char *dmabufdest1 = NULL;" c1 f6 S  g: U% \- F7 w
  76. char *dmabufdest2 = NULL;/ W% t4 D! }7 f9 e

  77. 3 Y. J( I5 @/ ^  i
  78. static int acnt = 512;
    ) k& t' L) [+ W) q5 T6 u
  79. static int bcnt = 8;, t) ~- }% B6 T6 O" O+ {
  80. static int ccnt = 8;  E) Q4 @% \' b% M/ X% M

  81. 4 H) M! k: G. i! x
  82. module_param(acnt, int, S_IRUGO);
    2 N  d& ?$ K+ I' X* t" ?& Y, _+ l
  83. module_param(bcnt, int, S_IRUGO);: P5 u3 H4 e; ~2 k% X5 J, _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  w( y: h! ~2 F& k4 W/ j1 q% a. F% S  g8 h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% n+ R1 l0 E2 p7 b6 E1 S, m! h6 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) `) z7 H/ U5 I4 {: @5 ^$ v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ Y+ \& }$ c( K, |& c( @
7 C6 @" e; S* _0 p2 R' P/ Q% G# F+ {( `$ K& [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-7 15:26 , Processed in 0.040565 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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