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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # \6 z$ \* H% }1 u
  1. [code]EDMA sample test application6 u: G$ [9 n7 B% O3 h1 q( @
  2. /*: b( g0 e: B- R( g; C1 o7 |  e% ~
  3. * edma_test.c
    4 P8 [# v8 r( c
  4. *( L- Q. L  M+ Q/ b( M
  5. * brief  EDMA3 Test Application% \3 {  H, ]3 P* c) c0 v
  6. *0 k' \; w3 R# i4 M# Z4 w
  7. *   This file contains EDMA3 Test code.
    $ W. H+ `' ?2 j; D9 B
  8. *
    : k. i( o, R2 _! Z1 ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) ^* C& \9 I  o3 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      M; F* k$ c/ b/ G% D
  11. *         TO CHANGE.
    9 Y% u* F  `& H1 u/ u. e( K  ^
  12. *
    9 s, z6 N9 s0 o" p, M: o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 a4 G& t; q: ?/ X% z
  14. *
    5 g# B  c. Z' T  g8 J
  15. * This program is free software; you can redistribute it and/or
    7 d; @8 w( c) E& e" z
  16. * modify it under the terms of the GNU General Public License as* |3 y; V: Q2 _# V2 v9 Z% T
  17. * published by the Free Software Foundation version 2.
    / u7 T: u# f7 o2 |: d1 A
  18. *" B: O3 Z* X& X5 t0 x0 g0 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 Y3 z: X" g1 @8 x7 u+ q
  20. * kind, whether express or implied; without even the implied warranty
    . |0 O# R5 U/ v% X2 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ g/ r$ ?' {* f9 |6 S" ^. z
  22. * GNU General Public License for more details.3 ~% U! p: T" b& R4 g" p- `4 u
  23. */
    : M8 _% t- V" `/ q0 v

  24. + R4 L# ?9 g6 |$ h7 l4 q. p5 Z
  25. #include <linux/module.h>
    7 I% N2 ]1 x8 I$ h2 K, `
  26. #include <linux/init.h>1 W% F* q4 `" w! I. \' c6 P& a1 m
  27. #include <linux/errno.h>  P1 i9 _2 [9 W& ?0 u2 y. R
  28. #include <linux/types.h>$ ]; N3 C1 R* q) N
  29. #include <linux/interrupt.h>
    & N- I6 q  c5 _4 o
  30. #include <asm/io.h>
    % `- C# f/ J: B+ b" y3 ]3 t
  31. #include <linux/moduleparam.h>
    / A, r  A& n8 u/ Z7 r' W( n
  32. #include <linux/sysctl.h>. M5 M& M0 s3 a- D3 v) G3 Q0 F, R* U% i
  33. #include <linux/mm.h>
    ; a) [' O3 w9 f- v
  34. #include <linux/dma-mapping.h>- {, A" |1 e3 u
  35. 6 |# Z! ?: r' z: R
  36. #include <mach/memory.h>2 r7 V3 I6 f1 h& L5 v7 m
  37. #include <mach/hardware.h>
    ) e+ e, x5 ~: d& C0 ^
  38. #include <mach/irqs.h>5 N$ K9 V/ H8 H" r
  39. #include <asm/hardware/edma.h>
    - X% V- w' D: K
  40. $ W- \0 p# [$ o- c' c8 k. v# g
  41. #undef EDMA3_DEBUG8 {  X% p3 @, `! y* v) x
  42. /*#define EDMA3_DEBUG*/
    0 V* t: y/ t& |) r

  43. 4 J* q. a* D& i: d3 s- N
  44. #ifdef EDMA3_DEBUG
    / E5 r5 B4 x1 K* ]$ G+ l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( g5 s7 p9 M/ Z: f& L6 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). D# a1 ~$ A- a6 B4 d8 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # i/ S0 @! r6 j% D! c
  48. #else- B, e; i7 j8 ?- E
  49. #define DMA_PRINTK( x... )! {: L. P& p) Q% @
  50. #define DMA_FN_IN  `( o1 ~0 K) e% }
  51. #define DMA_FN_OUT# K) ~: ~; _1 G! N
  52. #endif% e6 ^4 z4 b7 _1 ~6 U
  53. " S" ^2 m& m9 d2 j7 B$ B! h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 ]4 [& [( F2 @, F+ k5 ^2 `8 ^8 g
  55. #define STATIC_SHIFT                3- l& D3 n# @7 J, c. M/ ^
  56. #define TCINTEN_SHIFT               20/ L' r7 ?' E; G# J
  57. #define ITCINTEN_SHIFT              21
    2 F: P- y: O: H" @
  58. #define TCCHEN_SHIFT                22
    ' ^# k$ `- h2 J$ _# ~
  59. #define ITCCHEN_SHIFT               23# F1 J9 b2 a% X) G" M$ A8 l

  60. + Q6 U: t6 I, U  U5 ^7 y- e
  61. static volatile int irqraised1 = 0;4 _* \7 x- w1 x8 E1 E' Q8 q, g
  62. static volatile int irqraised2 = 0;
    , V) v4 ^' w5 b5 F( M  a$ T" O
  63. ; M6 a9 C# b" v) X3 y5 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 t  X8 i3 `# T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 D. N' q1 e/ C+ D* g# i/ L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 K$ m% s  p* W% L% b6 R) x; C) _/ y
  67. 7 O& q, I) b% S: C+ \
  68. dma_addr_t dmaphyssrc1 = 0;
    ( z8 G. A5 }# l' H2 J0 u3 P
  69. dma_addr_t dmaphyssrc2 = 0;* P2 H; A* `$ G" r6 L
  70. dma_addr_t dmaphysdest1 = 0;5 O7 c- S- `8 H
  71. dma_addr_t dmaphysdest2 = 0;
      v1 e0 J3 Y! b/ Z  t

  72. * t. D9 b; c* U! E
  73. char *dmabufsrc1 = NULL;
    3 b! r, @5 c# i. c
  74. char *dmabufsrc2 = NULL;9 c; m" L) B( o& G) r+ X
  75. char *dmabufdest1 = NULL;' `+ l8 \, y0 r0 R. o
  76. char *dmabufdest2 = NULL;$ g, O( {6 M0 g! E

  77. 3 ?$ J2 _3 ^2 @4 y& R
  78. static int acnt = 512;- R$ Z1 F% Y; l8 E! {. y
  79. static int bcnt = 8;( o% L: p/ g8 I+ \. ?
  80. static int ccnt = 8;
    4 |. s8 w2 ^( y7 U7 u! @

  81. / |7 v( Y- g* e$ Q0 C; c
  82. module_param(acnt, int, S_IRUGO);% x0 ?4 J  q; M
  83. module_param(bcnt, int, S_IRUGO);$ g# c# `7 z! j  c  p2 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; F+ t4 w! K/ i' t4 ?# m6 x7 P! N2 K# y$ \8 @+ |  _; X, K! ?% Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. b" F% s9 _# O7 F$ R: \& Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  g6 w  q' Q/ ^& Q, l; E% l' k: @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: T1 G& G1 a% i$ n$ D4 J; v. ^/ Z; B. v5 f) W
9 @1 j! q$ D5 Z4 J. O( x: H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-28 21:59 , Processed in 0.037186 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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