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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , q7 l7 u4 R5 Y: c
  1. [code]EDMA sample test application
    : p8 b" m$ b" G& u1 [- n, T
  2. /*
    , A# f5 p" E/ A& X) h" Y( W, ?) d1 x
  3. * edma_test.c
    ' g! `7 G7 C* Q0 g
  4. *- z7 e- b% D+ [: ^
  5. * brief  EDMA3 Test Application
    3 \7 y/ n6 v5 m- R+ }% F# ~( r
  6. *
    " {! ^4 N& t) B, N
  7. *   This file contains EDMA3 Test code.3 G+ q  F9 ?- @
  8. *( Q/ \3 E$ @% }& k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! A' ]& W/ C7 p" I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% M, E4 R; [' l* V% j. A9 k
  11. *         TO CHANGE.
    / B+ i: @* k) W+ z4 G6 |' o: v$ C" Q" H
  12. *! T& k2 z- ?- a% c! l5 j/ C  ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: @5 T+ r% E& |+ g7 B
  14. *
    ( x) f7 ], S& r  |2 K
  15. * This program is free software; you can redistribute it and/or
    + [$ `6 j4 F3 P$ I2 D7 p6 O
  16. * modify it under the terms of the GNU General Public License as
    $ d/ K( y3 p6 r. Z7 c4 E" H( o
  17. * published by the Free Software Foundation version 2.6 g; M- z9 W5 y, Z" p/ s! }: y
  18. *
    % C2 N' T) b, w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 U* J' k" l, M$ F
  20. * kind, whether express or implied; without even the implied warranty  f1 \' }  E( {8 N. \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . h& r; O$ y! ]1 U% C3 O% h% b
  22. * GNU General Public License for more details.  u: R8 @" O. h- T. D
  23. */3 R7 l+ [4 c- ~: U+ g; y

  24. 1 @# T" U. V6 k0 ~  L5 T
  25. #include <linux/module.h>
    0 X: u; k1 Q' D4 J% D- ~+ |
  26. #include <linux/init.h>2 Q) s$ i: U" l* d9 j) C3 d( R
  27. #include <linux/errno.h>
    ' B9 H/ f/ I% T/ d: N- @: Z
  28. #include <linux/types.h>
    ' D, w& k0 M2 M- t/ Y$ |' ^
  29. #include <linux/interrupt.h>
    8 g9 x& Y2 R, y0 I
  30. #include <asm/io.h>
    , w2 u. Z! U0 H' D! N' k# D
  31. #include <linux/moduleparam.h>5 u" j* y- @  A' |! S4 X( n0 g# f
  32. #include <linux/sysctl.h>- Z# \5 x+ J; e2 p5 o5 t
  33. #include <linux/mm.h>8 V  X/ `& T' f+ p1 @' Y, ?
  34. #include <linux/dma-mapping.h>
    : J9 k0 J2 ~! M7 W% V' p1 z% x6 n% l
  35.   r$ Y* m9 U1 M' \( K+ u" t  E
  36. #include <mach/memory.h>
    " _  C2 L  C# @2 K: L6 Y$ R
  37. #include <mach/hardware.h>  A1 k& E# ~2 K6 C8 D
  38. #include <mach/irqs.h>
    5 \$ ]( N' P; K; R$ y4 i, V
  39. #include <asm/hardware/edma.h>
    + Q0 E9 i5 z8 z# z6 }
  40. & |. T( c+ {9 A9 w
  41. #undef EDMA3_DEBUG. o+ E/ P% @6 ~% m/ |2 L3 b
  42. /*#define EDMA3_DEBUG*/
    9 B% k- \. t* M; E
  43. 3 I2 Z' r" w/ M. S5 M) U
  44. #ifdef EDMA3_DEBUG
    4 m6 t3 p! l7 k$ m5 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! [. e9 r# q3 W; G( W# V* }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( k" |& X# d; S6 d% M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), O- \! J; V$ V5 V# e( _
  48. #else
    9 f6 ]6 _, U2 W3 f
  49. #define DMA_PRINTK( x... )2 K% T7 U& y8 l! {3 F' g" ]! \8 I
  50. #define DMA_FN_IN
    ! T' S& Y  n9 Q# K) m
  51. #define DMA_FN_OUT; q! q: i1 }4 k6 g  H
  52. #endif
    3 C- u+ s$ _  ^5 ~2 q- E6 O
  53. 2 e/ l: a0 |( F, W5 c+ n7 u1 V: v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 g+ ]* h. e3 E4 o* X
  55. #define STATIC_SHIFT                3
      r& v% g) }2 A4 [2 s0 U- Z6 B
  56. #define TCINTEN_SHIFT               20
    2 W* ^) H& j  t# \& O: o, ^& H, o
  57. #define ITCINTEN_SHIFT              212 S- y1 D( B5 ?, r% d) M+ u  i+ H6 c
  58. #define TCCHEN_SHIFT                225 n3 N7 `2 y% [5 _% j4 |# ]
  59. #define ITCCHEN_SHIFT               230 y! s2 w6 h3 Q/ t0 I9 B

  60. . T6 k# K4 o1 c9 ?
  61. static volatile int irqraised1 = 0;$ D# w3 @: V" c  t8 [+ l, ?4 {6 y
  62. static volatile int irqraised2 = 0;2 A1 f3 X5 M/ b* G  Z9 i! T- t

  63. 0 V2 @; U' ~+ P/ B1 F7 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" X5 n7 y" g% r. m! V0 }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 }4 {9 @6 q+ T& ^; U+ m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: x3 ]/ L; R2 `% u$ W0 [
  67. " _; i) s+ ]  @8 ?9 w; o3 H$ u
  68. dma_addr_t dmaphyssrc1 = 0;
      h6 c+ q* I! a- [$ O# y8 S- ]
  69. dma_addr_t dmaphyssrc2 = 0;
    3 Z5 x+ |2 t/ M. x! R0 h& B* d
  70. dma_addr_t dmaphysdest1 = 0;
      Y4 b; {' a# k
  71. dma_addr_t dmaphysdest2 = 0;, z& \. K6 y# o, K7 P; A
  72. 6 d0 h- b/ Y/ A% r  ^
  73. char *dmabufsrc1 = NULL;
    5 l4 k6 k# R# z' q
  74. char *dmabufsrc2 = NULL;
    9 v+ f# x$ p9 I- m
  75. char *dmabufdest1 = NULL;
    % K$ K+ q1 A& C3 q; p& `) ]0 ]
  76. char *dmabufdest2 = NULL;
      Z/ J* W  ]- F; Y5 W
  77. , r& m4 W, q) p4 W
  78. static int acnt = 512;* S, V1 d! q2 @1 ^7 M( m
  79. static int bcnt = 8;
    : c: K1 c/ r5 Q+ [1 Y0 V1 `
  80. static int ccnt = 8;
    : Q% g& ?- L7 b3 N
  81. 3 m- ?) Q; o  r* W
  82. module_param(acnt, int, S_IRUGO);1 i, H  {4 z7 i# Q0 b$ h3 R
  83. module_param(bcnt, int, S_IRUGO);
    / x; L0 q$ @6 w0 l# [1 O( b8 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ c7 a% @, A2 p

/ z# W  B2 w. l) V+ W$ T8 y5 K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% S4 H- p+ P* ~$ {' narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ O. @  X, G" l' j! {5 A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ P% p- ^/ K' v4 r/ ]5 Z0 ~6 _
- p: j8 B* y6 c% V

- _$ z6 i2 @6 E- J& d0 |; @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 01:40 , Processed in 0.040158 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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