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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# d6 Z! U- a' _& ?6 W) ~
  1. [code]EDMA sample test application
    $ D8 w7 d2 d" w: G: ?& k  {; j. @& Q
  2. /*4 _6 c, f  }3 n
  3. * edma_test.c& L1 u3 G+ }- B8 O6 W  Z
  4. *
    / x7 G& K& S. M1 c/ \* C
  5. * brief  EDMA3 Test Application
    . q6 q0 [# z) G
  6. *
    + T9 @9 F2 g$ u1 |) E& z* Q- `4 N
  7. *   This file contains EDMA3 Test code.
    & f% W8 D$ a; E2 |8 h: N1 e
  8. *. C+ x7 i3 t1 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% v: j  b% o3 Z6 D+ M% D) Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 W5 D3 C) ~2 ?
  11. *         TO CHANGE.
    9 \( x) f3 J* j; O
  12. *
    - G# x* n; z& n' ^8 X7 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: I+ B$ C" t# l' \5 M
  14. *2 \/ L8 r5 W. b/ f% V8 H4 x
  15. * This program is free software; you can redistribute it and/or3 i1 f6 ~2 K3 [/ ^' x
  16. * modify it under the terms of the GNU General Public License as% R6 w$ z  J6 s" Y- r- N
  17. * published by the Free Software Foundation version 2.
    * Y1 h5 t8 c7 T3 x. C  V
  18. *
    , m: Y( c  C2 t# k$ b6 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# u( `: I% i# w0 c$ O/ l
  20. * kind, whether express or implied; without even the implied warranty
    . O+ \& y2 ~1 }& ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 g& B4 j# a7 _  e" I
  22. * GNU General Public License for more details.
    $ f0 f( j- q$ C4 x
  23. */" y2 E0 ^0 B, g8 d. ]
  24. / X) S2 J- i' j4 ~) Z
  25. #include <linux/module.h>& R! R8 V8 L" n; m4 h8 I
  26. #include <linux/init.h>
    4 S  n; b, u% m
  27. #include <linux/errno.h>
      o" r9 i" ?7 o$ X, y# |. }. j/ c
  28. #include <linux/types.h>; y5 b6 D7 y, h! w8 t4 g
  29. #include <linux/interrupt.h>
    5 Z! M" U) V7 |( R0 \. ]) [8 K
  30. #include <asm/io.h>
    % s5 m+ O# E/ \) @0 z8 {
  31. #include <linux/moduleparam.h>6 a- a% x1 M% ?
  32. #include <linux/sysctl.h>
    9 G9 o6 g2 B7 m. V, T9 C8 N% a4 F
  33. #include <linux/mm.h>
    # D$ D. z) q* c  v: {7 p6 U2 K
  34. #include <linux/dma-mapping.h>1 M+ h8 J) C; L- \2 L) w5 d* g
  35. 9 h0 t# V# X7 ?: `  q# [3 _. `
  36. #include <mach/memory.h>
    ! ^* |  g4 n4 T8 v
  37. #include <mach/hardware.h>' c% f3 n% c8 {: X; Q3 }+ k' ~5 a
  38. #include <mach/irqs.h>
    2 B7 I9 Y3 q& H/ x1 j
  39. #include <asm/hardware/edma.h>
    ; M' I& K4 g, ^1 @' \& N3 O1 A
  40.   l1 K+ Q( S& o7 C  g& a
  41. #undef EDMA3_DEBUG$ [; P2 k- Y8 f" l) o4 j! u
  42. /*#define EDMA3_DEBUG*/8 a6 {, X8 h$ X4 K+ U6 z
  43. 8 S. k) }7 |4 R2 x- p2 x
  44. #ifdef EDMA3_DEBUG3 X, e+ @( }1 D" P6 x8 A8 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 b0 N3 \% X5 D" O, w, I! M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " f2 h0 u6 A& [& h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 ~8 o5 \$ M7 E" X. y0 [, I, [
  48. #else. @/ c, r4 f4 v7 r7 |, F$ [
  49. #define DMA_PRINTK( x... )2 y& @( A4 E4 l! A( ?9 p( |
  50. #define DMA_FN_IN
    5 H2 h, J/ |$ y( ~9 N
  51. #define DMA_FN_OUT9 X9 B1 W: Z+ Y" n
  52. #endif
    7 \, c6 k* l- i% @4 ?1 O& Y* V. s

  53. 9 ?7 G. T- R$ v' u  s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ P" Y: W% H2 W5 F& {; K" `
  55. #define STATIC_SHIFT                3) W( [9 p, n3 e/ ~% U* E
  56. #define TCINTEN_SHIFT               20
    , u9 t4 O( @, K
  57. #define ITCINTEN_SHIFT              213 o# @9 y' P: x9 n
  58. #define TCCHEN_SHIFT                22( M9 \- x8 L7 j  q, H
  59. #define ITCCHEN_SHIFT               23' m9 e  j& o# K/ t. Z7 d

  60. 8 g! i  y& l& ^  m! O
  61. static volatile int irqraised1 = 0;5 x7 D5 b& L4 `8 b2 f: u( _4 M
  62. static volatile int irqraised2 = 0;* q& m4 l0 Q7 U/ N+ y

  63. 9 H" ?0 N0 a9 k4 k3 K% f! f( I& H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 U& b5 Z8 ]! u' r+ T& g5 ]) U4 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . H8 J* d" d, x* e2 [' g5 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : j' u8 }' }$ V. _+ N1 W7 G8 \

  67. $ k; k/ S7 n# H
  68. dma_addr_t dmaphyssrc1 = 0;* F6 ?6 L1 ?% ~( O' U1 P
  69. dma_addr_t dmaphyssrc2 = 0;
    4 p1 n& ?! e% S  \- P4 \" @1 s8 J
  70. dma_addr_t dmaphysdest1 = 0;
    & S9 i* K+ A! q
  71. dma_addr_t dmaphysdest2 = 0;% E- Q$ \. D$ ?

  72. & o, ]1 ^6 L' H( u7 h. H
  73. char *dmabufsrc1 = NULL;
    ) v( }" `" F" h' W9 X/ G) r
  74. char *dmabufsrc2 = NULL;
    ' [+ ~) K3 R1 Z$ O& t9 D# t* m
  75. char *dmabufdest1 = NULL;, i1 g- ]- {4 ~( f0 l) A* r
  76. char *dmabufdest2 = NULL;
    % S( g" \9 I: y' G! i
  77. 8 c) Q) R5 t. C0 X, P! S
  78. static int acnt = 512;. ]" a5 v6 [0 m8 o% t
  79. static int bcnt = 8;8 J, t2 c7 m0 O( l) n
  80. static int ccnt = 8;
    0 j% e. M7 f5 t

  81. & F6 ?  [0 O: E$ N4 u5 m+ a
  82. module_param(acnt, int, S_IRUGO);1 k* G7 G2 X- \, {
  83. module_param(bcnt, int, S_IRUGO);  C5 e! h9 A/ Q+ v7 v- N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- \; f% p/ l- T; g7 N
7 R( H. N. ]$ @; Y7 L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& U: r+ z0 @: X2 R9 F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' Q- e5 d# d$ G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: k: p5 ?( w* c1 F' G: E& \  J& n+ ]# Q" r  n6 M$ A6 q. k( I

5 v3 j/ L1 W, B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 20:53 , Processed in 0.040163 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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