OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * L8 Z! `' i/ \  |/ k- b1 l/ y
  1. [code]EDMA sample test application6 e; R- Y6 h( N! f
  2. /*
    % e; A0 f( O5 i- g6 Q2 \" L
  3. * edma_test.c
    6 o5 [5 ?( o* E$ }6 W
  4. ** R8 s$ P5 v5 K& d% R4 q& L6 B
  5. * brief  EDMA3 Test Application* e; s- K* G* c  w9 \3 G
  6. *) w1 \, }- J- D
  7. *   This file contains EDMA3 Test code.
    4 B) G/ W8 z) I/ ], Y
  8. *
    9 i- i* r4 x0 B4 Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 X' l, Z- F. d1 s4 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! m) W# A$ N5 B! K+ A
  11. *         TO CHANGE.
    : X+ G% Q( Y7 C/ J) F7 q
  12. *% G+ t* w! a1 z- H+ O- Z7 Z, g4 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % y& x0 L" \4 p5 s
  14. *& m, X- ]' R( N5 w/ \* q1 w- t
  15. * This program is free software; you can redistribute it and/or
    ) M' M& [" E+ B% @
  16. * modify it under the terms of the GNU General Public License as
    3 @( M+ }# u5 u
  17. * published by the Free Software Foundation version 2.: e5 T7 N7 _" o! L
  18. *. A: m' S, G" G* S8 c2 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: J% B9 Y4 B, r
  20. * kind, whether express or implied; without even the implied warranty
      H8 L# u$ C7 I4 B" `/ d& P" h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( m% s0 t2 y7 c+ c8 w3 C
  22. * GNU General Public License for more details.
    , S0 @6 t6 @9 P. F& S
  23. */
    7 H" e' l) Q, }5 o  z& O

  24. 1 v8 u* X% r2 h+ {# g; F( f9 Y
  25. #include <linux/module.h>
    6 L$ R4 ^; G6 P+ u8 n( _7 q
  26. #include <linux/init.h>, v, ]5 i  S3 V
  27. #include <linux/errno.h>2 z  y0 D" @% D% `0 c$ R) E. t
  28. #include <linux/types.h>
    $ {! z+ w" s. e4 M0 `5 o% c" c
  29. #include <linux/interrupt.h>9 d; J6 N1 ^0 k) Y1 r0 a% B
  30. #include <asm/io.h>
    : t9 @  P  b  P& @. V
  31. #include <linux/moduleparam.h>) q+ u4 a7 s" U  d2 v) z( \
  32. #include <linux/sysctl.h>
    ; T0 U6 y! q" ]6 _: f
  33. #include <linux/mm.h>
    $ c; ^; I/ W8 p
  34. #include <linux/dma-mapping.h>; k/ X) x5 @) I% |; k+ m0 T- h8 d0 \
  35. * [9 d, j7 o" X8 X: P
  36. #include <mach/memory.h>
    8 P; G5 f/ R9 u4 Q
  37. #include <mach/hardware.h>
    ( i! Z5 t; u6 n5 T5 D+ i$ p; e
  38. #include <mach/irqs.h># v5 T; C8 ^6 |! P) B+ G
  39. #include <asm/hardware/edma.h>
    , {$ U. y& m4 B% b" C

  40. . y$ Q- @$ m8 J8 N  O/ R
  41. #undef EDMA3_DEBUG/ [5 G+ c) R4 Q/ t& j1 q
  42. /*#define EDMA3_DEBUG*/9 |0 O  t+ v( d# b" Z9 O

  43. & s( v" a$ Q) s2 l- r# Y
  44. #ifdef EDMA3_DEBUG
    & l% I3 Q( @& v" B  Z% w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), _  ~6 m; c) s/ A0 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : M. _* |& S+ V& A$ ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& Y$ R! D; D6 n  D7 o
  48. #else9 S7 Z) Y6 [' n) v
  49. #define DMA_PRINTK( x... )5 t5 Q, F9 V+ E& w$ s& R8 x
  50. #define DMA_FN_IN' ^4 _8 W3 J; a; ~9 Y( ~5 o
  51. #define DMA_FN_OUT; i& D* W! s: _4 e/ X" r. }
  52. #endif
    9 o3 p  h& V! y1 v, k; `
  53. ! |( Y$ e$ n0 V- E! T* @& x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 P5 K- b7 ^) d" |
  55. #define STATIC_SHIFT                3+ a, }2 L/ e% B
  56. #define TCINTEN_SHIFT               20- v+ o- \5 U  r) h0 m
  57. #define ITCINTEN_SHIFT              21
    8 y) A  n' V9 R' r7 W% H+ T
  58. #define TCCHEN_SHIFT                22
    4 v" t5 B2 t% l
  59. #define ITCCHEN_SHIFT               23
    1 k: Q1 b! x/ I7 M, w! c: H
  60. + O- a& B+ x( l0 X! V0 A0 D
  61. static volatile int irqraised1 = 0;
    9 r* ]6 Q, @# f/ j. \' A
  62. static volatile int irqraised2 = 0;$ e* Z: P. {$ m' \6 a0 k& c
  63. % U6 ~2 c# g/ I  {# N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" y/ i- t, E1 F# j3 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; K2 ^9 x4 L) A, d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; U  J+ ^% H1 Z5 N, |, i# _

  67. + V* `4 e& h' q
  68. dma_addr_t dmaphyssrc1 = 0;
      F& @4 t2 O7 O9 _
  69. dma_addr_t dmaphyssrc2 = 0;
    1 O9 B5 B2 {' n+ N
  70. dma_addr_t dmaphysdest1 = 0;9 F; I- m6 y- U: j5 s9 p- Z! k& S
  71. dma_addr_t dmaphysdest2 = 0;8 R. }+ l# R# d- V

  72. 0 A* i2 V8 J7 K4 ^0 c4 Z
  73. char *dmabufsrc1 = NULL;
    - @- {6 K4 V4 o. a# o
  74. char *dmabufsrc2 = NULL;
    0 m8 ^1 G1 Q( C7 C
  75. char *dmabufdest1 = NULL;
    ) U3 ]+ o8 s0 k# I" W5 \
  76. char *dmabufdest2 = NULL;$ a9 a6 _: }! Q8 v2 }8 z

  77.   b1 s4 z- R$ h' t
  78. static int acnt = 512;8 p( a1 B$ r+ ]0 w1 Z/ ~6 j
  79. static int bcnt = 8;
    4 `& V% J4 C  d
  80. static int ccnt = 8;
    8 i% }% B. G' i: j# U, z2 ?
  81. # }/ m. z* g; Z9 z8 H
  82. module_param(acnt, int, S_IRUGO);
    * G- s! b+ E4 l. A" I! u7 }( Q
  83. module_param(bcnt, int, S_IRUGO);) s2 c# u9 D9 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" ^; \; I" I: o  b
4 {5 l6 e7 U+ l" p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. `5 _6 K2 F' v+ k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' h& I. A$ R  H  C7 m! r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: e  w4 J5 r  c0 L
/ Z7 X; Q# v$ D3 Y' b6 u

1 F  a3 q9 P4 o5 ]4 f. d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-3-31 12:42 , Processed in 0.046754 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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