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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 \' U; t* i. H. A
  1. [code]EDMA sample test application
    " x2 L  p8 _3 `- o8 ~
  2. /*  M1 Q5 O3 i8 J- e5 A" g
  3. * edma_test.c% A% q- F5 e/ |% x& W$ x0 G
  4. *1 i" |6 m2 |1 n3 c! y
  5. * brief  EDMA3 Test Application
    ( F7 |0 e1 j1 u' N4 }
  6. *
    ; Z7 U2 W$ G9 z+ A
  7. *   This file contains EDMA3 Test code.5 p' H& c$ Q# N  I" W: K
  8. *
    / ~4 ~" k8 D5 I1 ]. {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ X2 e' q" H1 E% M4 M, {0 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 s6 l7 h2 b  _, P/ b- t: Y, z6 h: u0 I
  11. *         TO CHANGE.# ^% ~7 g! p4 G! ^$ g3 M
  12. *
    * Z1 m3 l. ~" ?# _& O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! {- G8 L4 O0 }. g6 |- n2 o# q
  14. *9 c* P5 W$ l) @% }$ T$ b
  15. * This program is free software; you can redistribute it and/or
    2 _% F2 X" m  y. W6 S% }
  16. * modify it under the terms of the GNU General Public License as2 ]  i+ n% u' {! H8 ]+ V) |
  17. * published by the Free Software Foundation version 2." `, b: k9 {$ g2 }" [$ ~5 Y# r3 Y: P% y
  18. *
    & m8 b: E6 G9 m9 H. C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' f2 c+ i% K& ?5 ^) X( X' O
  20. * kind, whether express or implied; without even the implied warranty
    8 Z7 Q' d# `* c: g! F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ }3 P& N, K; n1 A3 a, ]
  22. * GNU General Public License for more details.
    ( b6 B6 P3 s6 D
  23. */$ L4 ~1 T6 |5 d! J( O0 h2 f
  24. * b: @" I) V( X: ?( Y: {* J. {
  25. #include <linux/module.h>4 R' r0 _, m0 w) {3 q& a+ x! X
  26. #include <linux/init.h>
    ' ]( h3 H% p- u+ m
  27. #include <linux/errno.h>* Y8 H" u4 ~* @  r6 h# j; W8 ^
  28. #include <linux/types.h>
      Y7 A0 M' Q4 U3 p: x
  29. #include <linux/interrupt.h>
    8 N" Q$ z* |  z% n2 }# M6 |: J9 l
  30. #include <asm/io.h>
    ( i2 |8 ^/ C3 T* s, F, D
  31. #include <linux/moduleparam.h>
    , ^: g1 O% G7 \4 T$ }
  32. #include <linux/sysctl.h>
    8 F; U1 Y3 Z" @% c) i1 ?4 p
  33. #include <linux/mm.h>7 R9 \) J: h3 z" p3 O! P" v
  34. #include <linux/dma-mapping.h>! x' z7 L- p/ _5 S
  35. 1 y# ~5 q3 Q% C7 k$ J# t
  36. #include <mach/memory.h>
    * _* Y( S& @6 {; H% _3 K
  37. #include <mach/hardware.h>
      a' [" h- Q4 S3 F
  38. #include <mach/irqs.h>; I; y2 i0 Y2 X) A. f
  39. #include <asm/hardware/edma.h>& h; m* Z; G. W" |* l

  40. ) u" L% E% V* p& z3 G
  41. #undef EDMA3_DEBUG
    5 ]- Q; d) F" R. v  o( k
  42. /*#define EDMA3_DEBUG*/1 C  q$ M" V9 g! k
  43. % x  l& \. r) u
  44. #ifdef EDMA3_DEBUG$ [1 p7 D" c" T0 a6 b; x* I8 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ ~8 @& @% _, r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ t9 G. R) C, [- u5 u6 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). I4 x' a/ W- ]- @5 M  E
  48. #else
    $ Q% g+ r* L0 u4 u
  49. #define DMA_PRINTK( x... )
    * O/ Z2 P: J% C, ~
  50. #define DMA_FN_IN! y$ E1 f9 w+ j! _0 s4 z! e9 W5 E
  51. #define DMA_FN_OUT3 J' T: D+ r. `3 p3 ~( N; ~3 s
  52. #endif
    7 I% v" C! d, }5 t8 t

  53. ! m, I% d# D4 j5 g3 M# L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 a( w( t2 b9 f. i
  55. #define STATIC_SHIFT                3- M7 ]- g- a0 k- M- ^
  56. #define TCINTEN_SHIFT               20
    # Y- q$ u& |8 s) G/ h* [# [
  57. #define ITCINTEN_SHIFT              21+ B5 `+ F' U8 T$ E
  58. #define TCCHEN_SHIFT                22
    0 @4 ^; B$ q+ G5 u" y
  59. #define ITCCHEN_SHIFT               23! V/ x; Z2 j0 V& J5 x

  60. 9 V! O  I, F. Q0 B' p  L
  61. static volatile int irqraised1 = 0;8 g) W: M# H5 B" k
  62. static volatile int irqraised2 = 0;, U& P0 R  m1 Q7 ?  H. y+ A

  63. 4 B6 L3 p$ D8 [  G! A4 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 e  D- T( H0 j8 T  |( T4 x  q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , P  ?. B3 v) ~) Z! ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( y' l+ _% ?1 ]) W( M

  67.   ^2 T+ U* Q; E& q' i: I6 m
  68. dma_addr_t dmaphyssrc1 = 0;
    3 e+ m, b+ r! T( u3 N2 T
  69. dma_addr_t dmaphyssrc2 = 0;
    ) j$ T$ R- x) |, j+ C# h
  70. dma_addr_t dmaphysdest1 = 0;3 t: @6 ]4 Z: s) w. |
  71. dma_addr_t dmaphysdest2 = 0;
    - u4 T! L3 b/ ?' l* h

  72. : n! x3 P2 B) C. `8 `$ R& m+ T: [
  73. char *dmabufsrc1 = NULL;
    : w4 x* W) ~' z2 _+ b# z
  74. char *dmabufsrc2 = NULL;
    5 W- k& F3 t& q% O
  75. char *dmabufdest1 = NULL;
    - l, H$ j1 Q7 K8 [
  76. char *dmabufdest2 = NULL;
    : ~7 y7 ~4 e$ x1 H8 k8 Z+ X
  77. 3 m8 M, b  F2 P5 X1 Q3 K
  78. static int acnt = 512;; N/ D1 T" g! h4 A/ ^+ m+ J+ H
  79. static int bcnt = 8;
    4 w: b( C0 Q4 b) i+ p/ |/ A# D
  80. static int ccnt = 8;) i& S0 L: g: r) c6 V6 {$ x

  81. , P- C8 U7 ]# A& s/ L# M% w
  82. module_param(acnt, int, S_IRUGO);6 M" s* u$ Z- }& K
  83. module_param(bcnt, int, S_IRUGO);
    " i: }4 _9 t5 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% o4 i5 n! G) S

: }- h8 L0 Q$ x* V4 e/ Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* c& ]! h8 N" {6 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) A7 F  n6 _! f" c0 @+ h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ q; D9 V2 ^. s+ T
# a$ }  J9 ?: r& O' B- V6 B

' s) o5 z# G* w; N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 02:59 , Processed in 0.039529 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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