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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 k/ Q8 X' P$ a- ?2 C. O
  1. [code]EDMA sample test application- I7 Y1 ]( I% E4 a
  2. /*
    2 H  M$ ]8 A2 X( q# b/ S
  3. * edma_test.c
    * }- L; E4 p9 p3 p/ `! M; D7 e
  4. *
    5 k( S, H9 L5 u0 w1 t
  5. * brief  EDMA3 Test Application
    0 x; X; B" j8 b- N. W( U
  6. *
    : _% S) B( z$ Y3 f4 E; X) x
  7. *   This file contains EDMA3 Test code.
    : [1 F% H" ^. D/ z
  8. *
    . d* |8 q+ E# S* d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# q8 e! p2 `) Z$ p/ ]5 j7 p# r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( w8 d9 k* G* a
  11. *         TO CHANGE.+ x7 u- H- H- m2 W+ s6 h& |5 [
  12. *7 A3 s& \/ B! S- i1 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: M/ t( K- i; W( h' Y& \
  14. *# A9 I$ c# U& ^9 W" I' K3 l
  15. * This program is free software; you can redistribute it and/or
    ; f+ {# D% p- s/ n
  16. * modify it under the terms of the GNU General Public License as* `2 c+ @3 K5 k, c, W
  17. * published by the Free Software Foundation version 2.
    9 i* w! c8 R% r$ ]! ^; V
  18. *- m: d0 k/ R8 O7 k& r- I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 n) m5 X) [! U, Z" A9 s* M
  20. * kind, whether express or implied; without even the implied warranty
    6 i) l* Z# _: c/ V3 h  |0 U3 ^3 \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 n/ u3 {1 X$ d( @4 O7 V2 Z
  22. * GNU General Public License for more details.
    2 m% m7 {/ ^3 H: k; V2 D% A4 U
  23. */
    ' [& j, K7 s! W9 ^
  24. % R# p! G. s4 K8 ]+ k/ F
  25. #include <linux/module.h>5 m6 [" I) }; X0 w
  26. #include <linux/init.h>$ ?( Y" z5 x2 `7 {$ K
  27. #include <linux/errno.h>
    5 u6 H( t- ?8 ?! y2 P
  28. #include <linux/types.h>, j' B  l2 |1 t. Y7 I* }% w3 o) o
  29. #include <linux/interrupt.h>
    3 O  D1 K, Q! ?- R' ?* [! S% C
  30. #include <asm/io.h>
    . I2 W7 a4 N* q: f8 G; \0 w
  31. #include <linux/moduleparam.h>
    & I4 g, I& C0 b, C
  32. #include <linux/sysctl.h>5 ~7 Z+ Y1 p9 Z1 W8 _' _1 I
  33. #include <linux/mm.h>
    / _7 V8 r; k' L% }$ g4 v; N
  34. #include <linux/dma-mapping.h>: b& m0 A% Z% M3 Q+ n! \1 G/ `
  35. 6 ?) }' K0 ~( V4 m. ~
  36. #include <mach/memory.h>0 E: y) e7 x0 k
  37. #include <mach/hardware.h>
    6 Q# x2 G5 u: L5 W0 e- e1 u
  38. #include <mach/irqs.h>  T6 ^* k/ b/ H
  39. #include <asm/hardware/edma.h>
    " m" T' e0 O1 h& p7 W$ T4 |% {& E

  40. 1 w4 O/ ], o( w
  41. #undef EDMA3_DEBUG. G4 G5 F" x. P6 s# T
  42. /*#define EDMA3_DEBUG*/
    & ~0 k# ?/ \$ K5 p9 Q

  43. % G. B9 T+ N: E3 @
  44. #ifdef EDMA3_DEBUG/ j$ u5 W. ]6 ?2 E) P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 ^' f  ^- Q: w1 I' t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* n. c9 K# \- r0 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ x' F8 Z* t! Y" h
  48. #else+ d6 s" _# I% z' r1 b% n  y
  49. #define DMA_PRINTK( x... )
    ( t. d0 A# E, w5 n- u" k- ?/ }( s
  50. #define DMA_FN_IN4 q4 ?7 l  a2 w7 G9 {) o
  51. #define DMA_FN_OUT: j: z& v. X# C- r
  52. #endif* @- p, O9 E0 |8 }  K: ]0 }
  53. * }/ e* _* g% c: W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& `5 C3 F$ R9 J5 }
  55. #define STATIC_SHIFT                3+ t- W: I: X1 Z8 X, `6 Z. ]
  56. #define TCINTEN_SHIFT               20% I( F9 p! |7 M3 C" g6 P
  57. #define ITCINTEN_SHIFT              219 N% y1 A* i- h$ Z6 y: m" z
  58. #define TCCHEN_SHIFT                227 w, [+ G' `0 H  }( z- r7 {5 a
  59. #define ITCCHEN_SHIFT               231 m8 A& s" H' l/ M8 f

  60. ! m/ F6 K5 a9 l) H  `5 R
  61. static volatile int irqraised1 = 0;
    % m) X9 ~8 e* n! L" R3 l
  62. static volatile int irqraised2 = 0;$ }% t3 t3 M0 ]( @& n" L7 u% n

  63. # g% T5 s0 y' @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 A+ t+ ^* F% s, {% n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 I% A  K( G' s4 t2 O9 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ \3 f7 [# S  U# o. x3 t! p% ^3 u

  67. % u$ N$ e: G$ ^6 R& |! B3 W
  68. dma_addr_t dmaphyssrc1 = 0;/ G1 x% l5 [/ W9 Y
  69. dma_addr_t dmaphyssrc2 = 0;( @2 O9 j- ?# e9 I; L7 n2 }/ Q2 \
  70. dma_addr_t dmaphysdest1 = 0;
    . K6 l, d2 G8 B5 s8 u$ ^4 l" E
  71. dma_addr_t dmaphysdest2 = 0;3 F) w+ S; G9 v# \; @: w8 Q/ t
  72. 0 x% ]7 ^1 c& Q
  73. char *dmabufsrc1 = NULL;
    * E7 [# U+ b  }+ i: ~
  74. char *dmabufsrc2 = NULL;1 I$ m* o  f3 y& B  ^3 j
  75. char *dmabufdest1 = NULL;
    & p  M0 G: R: A! X
  76. char *dmabufdest2 = NULL;& t5 Y$ o5 f/ l+ J/ g! [
  77. 2 f: g) _3 ~0 R( C( R* m
  78. static int acnt = 512;/ ^3 ~# l( Z* {2 F! G# \
  79. static int bcnt = 8;
    . v: r8 j3 E$ q( t% j  s! U
  80. static int ccnt = 8;. x6 n- C) l, |# w- U0 P
  81. ( w8 L+ x! V) o  A  Z& I
  82. module_param(acnt, int, S_IRUGO);* x; W0 V- U4 O; r) l" Y# ^+ q+ s+ [
  83. module_param(bcnt, int, S_IRUGO);
    : O. w# A' S  H+ ~: @4 ~$ p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. ~2 E  ^. M4 \$ q% q, b; Y2 @+ P
5 B0 {3 t8 i! Y9 Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 ]/ i1 ^& D6 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 j# W5 T8 v7 s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ B8 Y" m+ f2 }. c# Y9 V! W, [9 ?. d0 J; F5 X% h- W

8 J, P) S; m' A2 u# {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-30 14:51 , Processed in 0.038245 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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