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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 H' W( l: U2 Q$ Q
  1. [code]EDMA sample test application
    6 N0 B! R8 p/ M% |; P" d
  2. /*
    2 U# F& m% n) m
  3. * edma_test.c+ J! ~% R6 C- @) K# k2 y; w" @
  4. *
    ' c. K7 `1 m$ D* }3 ?
  5. * brief  EDMA3 Test Application
    $ O/ v& M4 _5 B  V) u1 ]$ _
  6. *
    * o1 G4 E; \% s( b
  7. *   This file contains EDMA3 Test code.
    9 r+ V' U) f8 K7 x& ?) d* J! s5 D
  8. *( M) y% Q; r$ [  Z% I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! @4 B3 O6 v9 V: p1 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. H7 W3 |/ G# U, x8 n( w
  11. *         TO CHANGE.
    & C5 @; `1 @' [. q. C& [
  12. *8 U& {/ u) G4 R1 O' N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" P5 r/ Q2 _" U2 ]; F
  14. *! h" ^; N4 i5 h; K; L
  15. * This program is free software; you can redistribute it and/or
    + ]% X: m7 a$ v  L
  16. * modify it under the terms of the GNU General Public License as
    3 `$ y3 @/ Q$ d9 M' z
  17. * published by the Free Software Foundation version 2.
    ) e9 ?) Y! v2 l; S
  18. *( s7 ^( q9 d3 `, ?  ?: t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 f3 s- w4 H, x( _  k" e
  20. * kind, whether express or implied; without even the implied warranty$ u2 ~! }$ c# v% A% B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( n# g; ]1 a( L5 j* g! y! ~+ R
  22. * GNU General Public License for more details.
    9 U1 N9 H4 @6 c1 _  G7 y0 r
  23. */
    * o- |: V% p: L% u
  24. ; ^/ x" f8 r3 r" @& P9 F! A
  25. #include <linux/module.h>8 S" N4 t0 s5 j* X6 ^
  26. #include <linux/init.h>
    : A: ]: j  }8 E. H
  27. #include <linux/errno.h>$ y( S# I4 c- a% }9 w2 \
  28. #include <linux/types.h>
    6 t' k* M5 S# I4 \
  29. #include <linux/interrupt.h>
    " k7 }/ |& F8 ]7 G- o
  30. #include <asm/io.h>. M! @' n5 \# d$ ?4 B
  31. #include <linux/moduleparam.h>& r. Y* ^( P* Q" e
  32. #include <linux/sysctl.h>
    ) Q$ p6 L  V1 |
  33. #include <linux/mm.h>: w; Y; d, `  `( T2 P  F* Z( `& J
  34. #include <linux/dma-mapping.h>
    7 B& e  M& n7 l! U: C
  35. 8 s: i) i/ ]  z% o) x9 e# Y7 G
  36. #include <mach/memory.h>
    $ G8 X8 \1 R0 C# I0 K
  37. #include <mach/hardware.h>7 I/ [3 r0 P0 `& [2 s
  38. #include <mach/irqs.h># T: M/ k$ K8 T4 q( |! L1 A
  39. #include <asm/hardware/edma.h>! d, A1 A. I6 F( I7 `/ c
  40. & O. \# {4 v9 q# F" K
  41. #undef EDMA3_DEBUG
    % o# v* p1 |* K+ d. }8 ]! U* f3 [
  42. /*#define EDMA3_DEBUG*/
    ' C. `, |2 ?! O/ h" k; _0 z) h( h
  43.   d/ D" R! X4 N) J5 X; B: O6 t
  44. #ifdef EDMA3_DEBUG
      t$ y% G7 }2 p3 B6 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& v5 G6 B4 Q9 Z  X  O6 K5 N' q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ [( ~$ |( L: l; M6 u& @4 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 k  E; ?  B. U, p3 o
  48. #else
    ; |: x. p* K7 g
  49. #define DMA_PRINTK( x... )
    2 f1 O$ a$ p2 [  f( k7 h/ X
  50. #define DMA_FN_IN
    3 p1 J/ S! l4 Y- u, V4 [& _1 }% x
  51. #define DMA_FN_OUT
    0 h  R: [( J4 y" k5 o
  52. #endif: f$ u, E6 ^& ?- E" E

  53. * d9 ?. ?5 @0 X( ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 {! t2 o& ?) @1 T0 f2 R
  55. #define STATIC_SHIFT                3
    ' S, f+ ~: j1 b  \& e6 t0 A; y4 ]
  56. #define TCINTEN_SHIFT               204 l1 t# e% y5 i3 }: b9 l% r
  57. #define ITCINTEN_SHIFT              21/ P, N+ y$ n' [( |- K4 O0 U7 [
  58. #define TCCHEN_SHIFT                22: d3 T! Q/ h# ]6 Y1 G
  59. #define ITCCHEN_SHIFT               23
    - U4 M/ a' B' ]7 f

  60. 2 ^! t, |5 C' k0 x0 h
  61. static volatile int irqraised1 = 0;
    5 T7 j2 q, n% c0 N) ~
  62. static volatile int irqraised2 = 0;
    ; M. z! X/ \$ c- r! u8 N

  63. / z$ e/ o( ?. i0 B# T" g  n4 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! `- W! ^$ v: W) L) {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * |; S4 W' k( d2 a3 _2 o/ p4 e7 p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , _6 P4 i( ~8 m2 [. l

  67. - p7 n  g7 X) W, I
  68. dma_addr_t dmaphyssrc1 = 0;
    : B1 `8 H0 k2 c
  69. dma_addr_t dmaphyssrc2 = 0;1 H' S2 Z3 Z2 P9 x
  70. dma_addr_t dmaphysdest1 = 0;5 p- x  V3 h% W! P0 N* m
  71. dma_addr_t dmaphysdest2 = 0;5 K! l# Y& ~+ ^& ]' _3 R
  72. ' b2 c/ [3 N* ?% q8 A- Q% S5 F  z
  73. char *dmabufsrc1 = NULL;
    " V$ g, _+ \) t1 g; x# M
  74. char *dmabufsrc2 = NULL;
    3 H, f# j2 u1 w/ a. P6 q
  75. char *dmabufdest1 = NULL;
    * X; B- e. d8 s7 X0 C2 y% L
  76. char *dmabufdest2 = NULL;8 O9 b2 z  c! `& K9 n  g0 |

  77. 9 L- K# O' o. U3 a6 x! ~
  78. static int acnt = 512;
    0 g- E! \; g: p
  79. static int bcnt = 8;
    . ~' }/ _# q4 d9 D& @0 n7 u
  80. static int ccnt = 8;: S% n5 _: J/ B# v
  81. # m" J" U2 L" ]: s* Z' G/ h
  82. module_param(acnt, int, S_IRUGO);
    9 P( q  L+ C" I5 a
  83. module_param(bcnt, int, S_IRUGO);) U% v+ B% o# ]- S' W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 \0 ?- e4 X* _9 `* \" U+ P
- q% ?7 v5 b- W( R6 ?8 Z# Y3 R9 n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" @# _5 E) J3 a, R8 j) b5 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: i" U- a8 X& V: j7 _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 Q5 O7 \. k6 \" K4 b! U# l
* q( c; K0 l/ w" D  b+ A% n$ C0 _

: o! \7 d- s. W( J  ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 09:07 , Processed in 0.039105 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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