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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 q5 R8 E) l4 G/ i. p; ^/ o
  1. [code]EDMA sample test application
    / s: ^2 t# W* d
  2. /*
      i$ @  Z( X; ?
  3. * edma_test.c
    / g2 K0 a( E( w# w0 m
  4. *8 L6 k+ a! E1 Y  o$ D# N
  5. * brief  EDMA3 Test Application
    8 o* S3 p  w, A; [
  6. *
    " [0 I: [2 `/ N. K, e" Z
  7. *   This file contains EDMA3 Test code.
      T" H- w# y4 V4 K
  8. *( V' f6 g) |, }) M9 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) ~. R1 Z6 J0 r, ]4 G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* n3 A; s* `% M3 B
  11. *         TO CHANGE.
    5 }" p0 u# }' S  W/ G6 _$ V$ E
  12. *
    . }5 G! c$ z: n' e( y# i- y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 E5 e& l: X+ s, r2 X) l
  14. *6 G) h5 n' w# W) m4 V4 }' i
  15. * This program is free software; you can redistribute it and/or
    ( I* J2 D  Y/ h
  16. * modify it under the terms of the GNU General Public License as
    : H. I  v% i# e1 P5 N( B: A1 G
  17. * published by the Free Software Foundation version 2.
    - J* e1 {5 i8 |7 R3 z) \
  18. *8 i( S- |& U, o; E1 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ j" P2 }6 ?+ h9 }; H
  20. * kind, whether express or implied; without even the implied warranty
    : N4 B0 G0 V- a" Y+ U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " ]- {$ o" G  j: j
  22. * GNU General Public License for more details.1 O( `# g# y/ b/ ]0 F
  23. */
    $ N3 ~& O7 t$ q+ P, V4 E+ f
  24. 7 U' E% g( n" }: ^
  25. #include <linux/module.h>, p" Y( F  j0 Y9 d; g
  26. #include <linux/init.h>! O7 K! L' j7 T# l' q0 P( e
  27. #include <linux/errno.h>
    7 ^; W& @, c/ I; Z0 u9 f
  28. #include <linux/types.h>2 h# {- D: T% b# M7 e
  29. #include <linux/interrupt.h>" p" Y/ z: m5 }2 ~$ k" B0 g
  30. #include <asm/io.h>% _0 n) i/ n0 K' n7 J3 S
  31. #include <linux/moduleparam.h>
      v- o" n5 D: c( J8 @' I
  32. #include <linux/sysctl.h>7 T9 _5 h2 N# i( F. p
  33. #include <linux/mm.h>/ s  y( ]9 H. @% S9 R
  34. #include <linux/dma-mapping.h>7 `$ T9 Q1 i9 O8 z' h$ _: r5 V7 D

  35. . }3 t( q) c; k9 o5 y
  36. #include <mach/memory.h>
    6 O- ?# S3 t. ?% k* g, X% r7 y& w
  37. #include <mach/hardware.h>
    ) g: |. O& a0 H/ W4 U
  38. #include <mach/irqs.h>$ n( j$ _! [2 M" p. G% I7 Z: ~" x
  39. #include <asm/hardware/edma.h># y0 y' @+ @+ L5 ~1 y

  40. " ?. u. y, K- I& J# G. e6 D
  41. #undef EDMA3_DEBUG
    % s# p9 P( n( C8 v0 k
  42. /*#define EDMA3_DEBUG*/  }# i. G2 m- ~. E7 R% Y  X& G
  43. ! C9 ?% S8 ?* x' X
  44. #ifdef EDMA3_DEBUG
    % o! [2 T5 O4 Z$ g) v  k+ n9 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ L- t/ J' Y2 ], g, {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      V: ?) d, q# n; N5 `, w8 f6 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): W/ O! n& n  ~: D) D# `9 }+ e
  48. #else
    2 @- y1 z9 a/ w: d
  49. #define DMA_PRINTK( x... )
    4 Q" F0 M& m/ h$ _/ y
  50. #define DMA_FN_IN
    5 ~9 w! Z3 @0 w& Y
  51. #define DMA_FN_OUT# p9 F9 L! K# [1 O& L! P7 L
  52. #endif
    0 m$ {+ v! P) K8 T# _$ @

  53. 4 Y8 J# K# X5 g" f  |# D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! L' S/ D* R2 ^) o/ B
  55. #define STATIC_SHIFT                3
    $ _; a9 ^6 q: H
  56. #define TCINTEN_SHIFT               20+ `) Q/ o* P2 W, S8 o% N
  57. #define ITCINTEN_SHIFT              212 X% x8 q. P( @
  58. #define TCCHEN_SHIFT                22
    4 P0 ^' o' k  t% }# Q
  59. #define ITCCHEN_SHIFT               23
    & }$ @& p. O3 |

  60. 5 n/ r: a8 d& k$ o0 ^
  61. static volatile int irqraised1 = 0;
    . e* Z8 g" B$ ~7 f5 V% C. ?3 J
  62. static volatile int irqraised2 = 0;
    $ w7 i& j. M- O% V( T

  63. " R, r) A: a8 H& p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; E. U% [8 t0 c; P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Y- U' ]6 C0 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" |) k% ?3 n! z6 C" P( ^/ H

  67. ! E7 b- _4 B3 @( l5 t! ]' c
  68. dma_addr_t dmaphyssrc1 = 0;6 S$ Q* L5 ?/ t1 i9 G
  69. dma_addr_t dmaphyssrc2 = 0;8 P* {( g3 s2 |1 h7 U
  70. dma_addr_t dmaphysdest1 = 0;8 W5 Y" I8 H9 d- W" P# K3 R/ d6 S
  71. dma_addr_t dmaphysdest2 = 0;9 z% Z& \8 O2 ?( F3 c  K
  72. % L3 ~" `3 S! U, I- l5 z
  73. char *dmabufsrc1 = NULL;
    & ]& ]& R) H6 {9 `# P) u# M
  74. char *dmabufsrc2 = NULL;
    ' R6 U6 x( o: k
  75. char *dmabufdest1 = NULL;
    1 A7 x  ^+ G) p: `
  76. char *dmabufdest2 = NULL;
    : |* F+ g: t0 P/ E
  77. ; l9 s: O3 _' E8 q0 m- H
  78. static int acnt = 512;
    4 G  U; B. z% I; A' h' q
  79. static int bcnt = 8;% e; b4 L) D+ ^2 m6 O
  80. static int ccnt = 8;
    - Q/ y8 y) a4 k) @2 V
  81. : R; c- l* }9 q6 u( P
  82. module_param(acnt, int, S_IRUGO);
    , s5 I; r6 F  p
  83. module_param(bcnt, int, S_IRUGO);
    ) s, _3 e" J4 z( Y2 M" L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( E0 \& Q. w$ ~' [

7 J2 Z7 W1 n3 }+ x$ e* v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 W. e8 o9 s# O7 L& a. t% Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" S( B4 f- V  k3 d, S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 }% n" ?, u; y- {4 @/ O: V  [! P" i# y! U& Z$ a" x8 D

4 L' m2 E9 C8 G+ h! _/ C9 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-24 05:52 , Processed in 0.041073 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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