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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% I7 U& e6 @+ ~6 ]- Q" b9 A2 c
  1. [code]EDMA sample test application
    5 x6 p4 J( F4 g/ ^* N
  2. /*
    ) I- @, v$ j$ C- x" K
  3. * edma_test.c8 a8 q" U5 F! O
  4. */ j7 i$ o0 t# _; Z  x
  5. * brief  EDMA3 Test Application
    1 \+ C, L. l4 q4 L
  6. *
    ) j* U/ _; y2 b
  7. *   This file contains EDMA3 Test code.
    & e4 j" E9 L  z4 ~
  8. *( [8 y4 r3 H* }. {5 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# d% I$ ?1 C& M) Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 W  J6 Z& ?- d6 @  ~5 Y+ F
  11. *         TO CHANGE.0 {4 s: X+ b9 o) S/ d" @: p
  12. *
    5 e5 t( P: O  N, l/ W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 ]( m( D# T% x0 X% P; x
  14. *
    2 i( c4 U& q4 |- m2 B. k) t. x
  15. * This program is free software; you can redistribute it and/or
    9 g! b+ e& i( d7 i7 t. S
  16. * modify it under the terms of the GNU General Public License as
    4 J& H) z$ V+ D
  17. * published by the Free Software Foundation version 2.) b" u! ^, o" l( W
  18. *
    " ^5 p' Q& s8 [0 @! F, V$ T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' `) f  [) A! G1 j+ x8 ?
  20. * kind, whether express or implied; without even the implied warranty
    ( O5 s: H5 q: T" U, C& W  X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* O: c; G; c- `2 N3 g3 J
  22. * GNU General Public License for more details.( r4 ^6 Q5 O' }/ r
  23. */8 U' N7 B. M5 H! s# X
  24. ( C" s3 z! M9 n$ b* m$ W0 M
  25. #include <linux/module.h>* I/ ?( ~( Z. b& L* r
  26. #include <linux/init.h>4 _$ M8 \9 O- G8 Y
  27. #include <linux/errno.h>: K3 v7 m1 B* x4 _# D
  28. #include <linux/types.h>9 @2 a' Y; x  L5 V
  29. #include <linux/interrupt.h>+ `* [$ r; Z6 ^# k/ V
  30. #include <asm/io.h>' @& U% k2 R" Q# L9 o$ M& W7 J7 P  E
  31. #include <linux/moduleparam.h>
    , g& F5 u6 R7 w
  32. #include <linux/sysctl.h>
    5 l$ A! O- Q( B5 T/ Z
  33. #include <linux/mm.h>  \) ^0 B' G' r1 Y7 @
  34. #include <linux/dma-mapping.h>
    3 q. E, _3 f/ R/ G8 K" n9 D

  35. 2 J& n; x) d1 L, P7 u  S
  36. #include <mach/memory.h>& L' w* g5 q2 r4 ^" c  d, A
  37. #include <mach/hardware.h>2 A3 h/ n9 c. u0 a7 X
  38. #include <mach/irqs.h>
    9 S. a9 ~% |/ ]& S5 W
  39. #include <asm/hardware/edma.h>
    : d& H9 x5 v4 ^. o: o% ~6 P1 M

  40. * B5 I! L' Z* l4 R9 ?
  41. #undef EDMA3_DEBUG) ]5 F# k  B* g* q9 m  }* H
  42. /*#define EDMA3_DEBUG*/% S" }( _) B1 Y# x' [" J- x
  43. " w0 y5 U8 L; }/ [8 K; B
  44. #ifdef EDMA3_DEBUG
    - K3 t; Y! C3 ^& L+ h8 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( e5 V8 T/ q, P! q1 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& ^9 v' ~; w, Q2 d# y% n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). B& F; V  l4 L# q& K7 S7 x
  48. #else7 p( x4 a; B7 u) ]0 K4 T: _% b  _
  49. #define DMA_PRINTK( x... ): u. O; _* ?4 k5 G8 Y6 n0 j1 T. A
  50. #define DMA_FN_IN
    5 I. x; b7 a; I, [* S8 \  ~
  51. #define DMA_FN_OUT
    . t+ W2 T# J  q6 c; m
  52. #endif4 V7 D/ h# Z* m4 x( q2 _
  53. $ \& ]( j3 w) S5 H8 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 s8 ?/ J" k0 I  f
  55. #define STATIC_SHIFT                3; }. t* e$ K# R: \# T
  56. #define TCINTEN_SHIFT               20
    9 j( i0 K7 R* i6 @; c4 K' f
  57. #define ITCINTEN_SHIFT              21+ p' ?/ J' B5 N8 I5 r
  58. #define TCCHEN_SHIFT                228 {' F+ Z' X% ^# x# c( m0 X
  59. #define ITCCHEN_SHIFT               23
      q; Q+ C% [& A: w# `8 |
  60. 0 B2 u7 S8 Y% q
  61. static volatile int irqraised1 = 0;
    . q; Y* x* f. z2 b2 U! }! A
  62. static volatile int irqraised2 = 0;
    4 U; Y) K( d' V0 l

  63. 2 w$ M& u  \6 I9 k$ t5 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . `/ d4 J% q% p0 K; r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 [$ ~7 p" A4 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( g% w* T% K5 u. _+ v& M) |9 P
  67. 3 W  _4 l8 G2 ~: \. U2 _3 L! N* B
  68. dma_addr_t dmaphyssrc1 = 0;
    - m) ?2 C* j0 a/ _6 m
  69. dma_addr_t dmaphyssrc2 = 0;
    / S! {+ Q# O. ]8 a
  70. dma_addr_t dmaphysdest1 = 0;
    4 K. o1 k" q; y/ l. `/ m9 o
  71. dma_addr_t dmaphysdest2 = 0;+ I3 u2 p! X, I* r$ H7 |8 \" E

  72. ! R' x% g  c% ]7 @! X* t( ~- N) J
  73. char *dmabufsrc1 = NULL;$ l. C; ?1 y) ]/ T: ]8 I
  74. char *dmabufsrc2 = NULL;
    # E+ E% u) v" g, e# W9 T
  75. char *dmabufdest1 = NULL;
    0 e3 N* r$ r" Z0 e: I* }" O1 Q
  76. char *dmabufdest2 = NULL;
    % x8 k( W! J! W$ s( d
  77. 2 L" ]- B; _5 Z: v- p" T7 |; f$ @/ Q
  78. static int acnt = 512;$ d! U$ k# l, ]4 l+ }3 o
  79. static int bcnt = 8;) B0 C' B  G' A! ^: D  K
  80. static int ccnt = 8;9 ~' {* U$ f+ r

  81. 5 A0 f* ^: T" K' c
  82. module_param(acnt, int, S_IRUGO);
    + o5 r+ G. e$ Y
  83. module_param(bcnt, int, S_IRUGO);
    6 F, H7 Q5 L/ a3 D: s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 N; e0 P$ m& _7 Y: @

: o! x4 W9 x6 F6 }3 S' l! j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 [! K% n' B9 S# R$ Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( F6 t7 ~8 l* e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& H) A: M& A0 ~, O5 v* F, u- O7 h! I& l' r* Z" Q' W% p0 R
( h" G! J7 n: Y1 y; t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-1 09:50 , Processed in 0.036170 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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