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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( J/ A7 T/ @+ k
  1. [code]EDMA sample test application
    ! {4 A  l2 f2 r9 k6 Q; L
  2. /*
    2 s4 f9 F0 }6 W
  3. * edma_test.c8 `) |( z# W$ Q; l' _
  4. *
    + _5 ?& F5 Y' i9 E* |, v) h/ Q
  5. * brief  EDMA3 Test Application$ T5 |0 t. a& g* u' e$ q
  6. *6 m7 ]4 ?3 p0 d" P" k4 n. e
  7. *   This file contains EDMA3 Test code.
    4 f% w$ j# o. F7 k( ~
  8. *
    ! x) M( ~+ v3 L, m7 w  Y3 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & Z# M* t8 H6 |- n2 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ l9 C4 ]4 c4 E9 o9 T  Y* g
  11. *         TO CHANGE.% N7 P# i. w& z" Z( k* {
  12. *& l- R. P5 m3 S! g" P0 l9 z1 g* V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , K# o; m: _# P- D- [* O2 c2 E5 K
  14. *8 u6 J4 c$ o% R& V8 V
  15. * This program is free software; you can redistribute it and/or
    . z: i3 W" k2 V3 _. I' |
  16. * modify it under the terms of the GNU General Public License as
    $ Q9 p$ @4 m5 d: q0 P6 n4 S( q; G
  17. * published by the Free Software Foundation version 2.( x4 P( V8 b7 r. Y: A# W
  18. *3 p" C* @2 ?/ ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # d3 I! h  o0 d: H8 Q8 `
  20. * kind, whether express or implied; without even the implied warranty
    * r$ N1 \7 ^0 C+ f- B  ]; B5 v, B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' I9 O' f  z6 x! B
  22. * GNU General Public License for more details.
    - l9 ~, V3 e' `" V
  23. */" H7 C) `! w: u0 V, }/ N8 L

  24. ; C: m( k2 w  r) ?
  25. #include <linux/module.h>7 S8 s6 _  J( V1 |
  26. #include <linux/init.h>
    / \7 F3 v7 }& \' K$ k
  27. #include <linux/errno.h>. ?# Z' W. s: |; z, F
  28. #include <linux/types.h>
    ! T! N$ Y% K# H4 ~! z$ Q# ~
  29. #include <linux/interrupt.h>
    # Z! |% h$ t4 _8 C1 W
  30. #include <asm/io.h>2 G7 D; I. \  n8 c/ I
  31. #include <linux/moduleparam.h>! d' w' R, s0 h+ C9 k$ T
  32. #include <linux/sysctl.h>& L) f& E0 p  w- e9 v5 v; t
  33. #include <linux/mm.h>: w( n* O0 @2 m# L
  34. #include <linux/dma-mapping.h>( z. S; q! ^! ?% A- B7 k
  35. ; \! j4 F1 G/ \( \# w
  36. #include <mach/memory.h>; w3 U! w% V& `+ U: k' y) Q5 O
  37. #include <mach/hardware.h>2 B* _' w( Q: k( W6 Q6 _/ L
  38. #include <mach/irqs.h>
    * Y  v# a' X, `. e. [2 \9 H! {
  39. #include <asm/hardware/edma.h>6 X6 P: b; E% v' l% `; d
  40. $ f; q# w0 |% y9 _" n
  41. #undef EDMA3_DEBUG
    % ]. i4 r, \+ X6 [" }% T
  42. /*#define EDMA3_DEBUG*/
    6 Q8 ~6 J3 X/ a* m& M' p
  43. , X  }( i' _2 f& b6 l% L7 j" G
  44. #ifdef EDMA3_DEBUG" p& q9 i! r3 q- \* z! C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): |: f- h7 g6 _/ ?8 Y, _" t6 ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# e; Q( o  Q4 D" }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- e7 i$ l9 k3 @: Y3 D: k
  48. #else
    ' F. I8 G: P" w/ [" X
  49. #define DMA_PRINTK( x... )
    2 o( g( {- z% c
  50. #define DMA_FN_IN
    9 |/ L7 w. M8 ^0 d
  51. #define DMA_FN_OUT
    & x) t8 [2 K7 `# I4 z: {, a+ @5 V
  52. #endif
    ' D: D1 D* H& G# c) ]

  53. + t1 E4 k3 B* V3 Q: N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 t9 h! x8 V! X4 ]8 u- p
  55. #define STATIC_SHIFT                32 ^. q( o- r2 p! S" U# u: r
  56. #define TCINTEN_SHIFT               20: m& H7 g. }' r9 y; p! F8 ?& |% E
  57. #define ITCINTEN_SHIFT              21
    & F8 C: r+ R% k) G* X
  58. #define TCCHEN_SHIFT                22
    ! M3 G& n5 x/ v. x1 C
  59. #define ITCCHEN_SHIFT               23- D9 N7 N* i8 s

  60. 5 z9 W- R5 q  k
  61. static volatile int irqraised1 = 0;
    " e1 h. N& K: X2 Z/ `  p& ~
  62. static volatile int irqraised2 = 0;! J+ H% r1 @9 w, s' L7 d" f8 Y

  63. ' \) X1 O& S9 V( D1 E9 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ u9 v3 \; U; s, \, _' V& a7 ?0 {; E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 [8 a1 o- g9 u/ V* e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . p; G; e* J& `; |( x! @- u
  67. * _5 ?' p( i6 B8 V$ h3 O
  68. dma_addr_t dmaphyssrc1 = 0;) l  q; p! \3 H1 ]
  69. dma_addr_t dmaphyssrc2 = 0;5 V7 V/ @& g. [7 _* t& Z/ r
  70. dma_addr_t dmaphysdest1 = 0;5 ~$ e1 L. ]* J% ]6 w$ a9 g
  71. dma_addr_t dmaphysdest2 = 0;
    0 n) n; ?( a/ C2 W

  72. 4 x: ]9 x3 }+ J1 Q8 `" t+ d
  73. char *dmabufsrc1 = NULL;
    6 ^) i9 m+ R) l: r
  74. char *dmabufsrc2 = NULL;
    - c  F6 @* c5 t0 p% r$ L+ D
  75. char *dmabufdest1 = NULL;
    # `1 S4 \- t. c& ]
  76. char *dmabufdest2 = NULL;# x4 F+ m* O6 C0 P3 W2 c( f

  77. ; g) ^& h& ?/ j4 W1 ^3 D
  78. static int acnt = 512;
    5 u! [) Y4 E% a7 @) M8 w
  79. static int bcnt = 8;
    6 c, V3 G6 _3 x# ~
  80. static int ccnt = 8;
    . R9 z6 S/ X/ ]& v% P& b% b

  81. * A3 x- f6 w2 f) [; p& V
  82. module_param(acnt, int, S_IRUGO);& h2 [6 C2 ^; F  u/ O
  83. module_param(bcnt, int, S_IRUGO);% F% A4 T5 x* M4 M$ q, }9 y0 T2 O% U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 D$ ^: g  b- B
$ _$ f& k) {& B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: v0 \/ s- t' j+ y( Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, P/ S, g+ z+ p* q; ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ ?# T5 H' H& ?2 I& C, }
: o8 |# I! m2 u: p0 {

8 C# r% V: l" @2 U0 ^7 P+ \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 14:34 , Processed in 0.045780 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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