OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - q' m& w' l7 _1 G4 E# J
  1. [code]EDMA sample test application! c1 M( j& }1 _3 {
  2. /*, g. I2 c! j! Z; }. J
  3. * edma_test.c
    $ J+ g4 s. E* I9 m) P0 k
  4. *# n/ Q3 B6 u" u) `7 i5 p) b
  5. * brief  EDMA3 Test Application
    ; c$ ?& Y5 s4 W  |
  6. *; [. [* Q! |$ t& R( E
  7. *   This file contains EDMA3 Test code.
    6 R. ]; g& z+ k6 q
  8. *7 l* f0 G' b7 t  [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 x: k- ]9 [: g! \, m9 q8 \6 l( V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 W( _# w, |- u3 }9 g
  11. *         TO CHANGE.
    7 S% Y& j7 b' y
  12. *
    + M) B: p5 ^$ U( M0 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# ~! @" P: C% [- ^
  14. *# C# r6 d, I. ~+ {
  15. * This program is free software; you can redistribute it and/or
    5 @# U8 r& L* P+ D  x
  16. * modify it under the terms of the GNU General Public License as1 v0 O, `" g  |" G  e
  17. * published by the Free Software Foundation version 2.3 E& F  W6 ^* C& l' w2 o# ?
  18. *
    : U7 }: u( s, Z1 d& k3 e4 W6 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # x4 e6 j2 s7 |# I9 l! Z3 Y
  20. * kind, whether express or implied; without even the implied warranty
    3 a+ C* Y* U' @5 J5 j% Z2 g# X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 _6 W2 L& J! M* ?$ f
  22. * GNU General Public License for more details.; J8 d) ]) A$ I7 O
  23. */
      v0 Z* S( y4 |

  24. " e% x+ j4 y- d- k1 a2 a
  25. #include <linux/module.h>
    9 Y- D1 a1 e7 e
  26. #include <linux/init.h>
    # A- K& \# `: E& n/ S; e& }* j6 k
  27. #include <linux/errno.h>/ _, T9 q, w4 P$ M' X! T
  28. #include <linux/types.h># @' D# z9 n/ J, m# n: Z% l
  29. #include <linux/interrupt.h>
    ' e- w$ I  n% A
  30. #include <asm/io.h>' t$ C& }! X; r3 H4 E
  31. #include <linux/moduleparam.h>
    # c8 x0 |! @" z, A' g: @$ k
  32. #include <linux/sysctl.h>
    0 {1 i" {: n$ N
  33. #include <linux/mm.h>
    , `% V" o' j/ F" {8 `
  34. #include <linux/dma-mapping.h>
    - y7 p' @" {* ^. ^: B3 B/ |! _
  35. - ?$ i0 y! U; B1 x' _( {1 I( G
  36. #include <mach/memory.h>% s' M/ L2 \- e0 A  B
  37. #include <mach/hardware.h>( y0 Z% M8 m1 d( B# E: \. F, w
  38. #include <mach/irqs.h>
    * D" s6 C  I/ {0 _8 W
  39. #include <asm/hardware/edma.h>8 i1 h/ F1 h2 C9 Y) U! R
  40. + b+ C0 R( Q" s6 y
  41. #undef EDMA3_DEBUG# N& N: v# m. f) P7 M
  42. /*#define EDMA3_DEBUG*// A& o: H: U2 A( f
  43. ' X( t) _  L, y1 {' g" j
  44. #ifdef EDMA3_DEBUG
    ) K. Q4 P8 M2 v. e( Y: k5 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): T  c2 E6 b# I  t, t/ ]- R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      H- J) P0 O$ E& i9 O, `- ?! s1 P: S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - d& q" y3 m- {' K
  48. #else
    ( Z  c9 P  j  R; W
  49. #define DMA_PRINTK( x... ): I0 J8 f2 {+ s/ v5 Q% K
  50. #define DMA_FN_IN& Y2 Z& I) R0 U
  51. #define DMA_FN_OUT# N4 R8 v5 z6 p
  52. #endif) m1 t' V+ q3 H
  53. $ _" m- ~5 b% m3 N) l" |/ ?# F6 j9 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 z8 D" r* C2 Q2 i5 L4 i& z, F, _
  55. #define STATIC_SHIFT                3) }$ E1 X, l. q! C$ w, @
  56. #define TCINTEN_SHIFT               20: K. b" C# P1 X; r
  57. #define ITCINTEN_SHIFT              21! Y) _' k+ ]5 x6 o' L" D
  58. #define TCCHEN_SHIFT                22& u8 ~( G, ^& i2 C. {* ]  j
  59. #define ITCCHEN_SHIFT               23
    - R! o) P3 w7 ~- j! A: f2 P
  60. : H$ K+ D* @  ?: P0 m1 h2 }
  61. static volatile int irqraised1 = 0;+ Q' {1 r5 u/ _: Y' K& G! K
  62. static volatile int irqraised2 = 0;
    * |0 n0 o1 o. F3 p5 d, d
  63. $ Z! s$ [: [& E6 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 a7 s% v% Y+ ?$ y- m* d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . I, v, q2 V' s' N  a4 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      f5 b0 y# i6 z
  67. 8 r! m- Q$ d' G( r" y; ?5 X
  68. dma_addr_t dmaphyssrc1 = 0;
    , l8 E9 l+ P- \1 Q
  69. dma_addr_t dmaphyssrc2 = 0;
    ( r4 E; Y/ s2 }' q: d' ?2 o9 G: x
  70. dma_addr_t dmaphysdest1 = 0;
    8 s6 y" J- k/ p, D
  71. dma_addr_t dmaphysdest2 = 0;
    3 k* H: m" ^. b* R0 w

  72. % S" F6 q8 y. Y8 C" |
  73. char *dmabufsrc1 = NULL;9 E  ?2 p( Y9 s" A+ b0 m3 @
  74. char *dmabufsrc2 = NULL;( g  `2 d+ _2 ~8 T+ ?
  75. char *dmabufdest1 = NULL;
    0 S! P$ Y4 @+ o$ U6 J9 t
  76. char *dmabufdest2 = NULL;
    - A0 v6 H+ p. _, \

  77. 1 y& ?( ~9 V( @9 H
  78. static int acnt = 512;
    6 S( d6 _( y7 \9 C+ e* x" Q
  79. static int bcnt = 8;+ z: m( y5 V7 a* D- h- c* s
  80. static int ccnt = 8;
    : F# \) K9 N7 j4 |# |1 k8 Y
  81. 8 ]5 s! W6 n9 l
  82. module_param(acnt, int, S_IRUGO);' p& P8 `1 {0 N: P, D& r$ I7 F
  83. module_param(bcnt, int, S_IRUGO);* \, ]; C! D* v  e2 _+ g, E0 e2 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 A5 q* t: _9 ?* j( R% l3 i! j: F0 ^' A# P1 U: v) W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ K- d2 @/ P4 \% V$ m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 Z7 k2 L( i- p7 ?  P( u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' G8 L! h* t( P: r* S: o

+ ^. e1 u; e$ {( B' z4 w: g) H
( Q, i# Q% Z; j( t( R/ ~3 V8 J1 R$ v" O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 07:32 , Processed in 0.040148 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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