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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 t( }* N& D6 |$ g% I0 \4 A
  1. [code]EDMA sample test application5 q- `3 D6 N% N3 o6 g5 R' e& V- J' N
  2. /*
    # D" x2 P* X/ V. a
  3. * edma_test.c. m% C9 t5 k/ j' c* L
  4. *7 n  i' H- i8 v) G
  5. * brief  EDMA3 Test Application
      @! C- U  }* \/ ]1 |% L
  6. *4 v4 e: j5 p/ m8 J2 J$ D5 T$ J
  7. *   This file contains EDMA3 Test code.0 }9 }6 O1 i7 w  T, }
  8. *' E  r" }& E, D! z+ K1 X1 d  R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 A+ Q, m( q3 N8 @/ f' R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 X9 S- x/ J- l) Y4 [8 K  l
  11. *         TO CHANGE./ B+ f( N! `* l1 E5 m
  12. *
    , L( Y1 f2 e' W1 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 Z" l: O, T( o$ P
  14. *
    % Z  a' o7 W" g: H% u4 v/ N' k
  15. * This program is free software; you can redistribute it and/or
    ) W; L- M; n/ H& M5 C5 ?6 i! @
  16. * modify it under the terms of the GNU General Public License as
      Q0 L+ e$ [7 F" P3 V
  17. * published by the Free Software Foundation version 2.# ~6 g4 z& s$ L% U" v% |
  18. *
    2 R/ n; P5 ]2 f2 W' v- I' S  v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) ^' H' r  p! q. P
  20. * kind, whether express or implied; without even the implied warranty" c) q5 a4 }! l9 B8 ^. g* i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * K/ g/ I0 f" o  m
  22. * GNU General Public License for more details.
    $ {8 M3 s/ E# }5 |& X6 i: K
  23. */! Z" W4 h! S+ T
  24. : O# ^  k+ g% `0 V! ^& s  k% @
  25. #include <linux/module.h>
    & r/ p* c3 _+ o) J  F
  26. #include <linux/init.h>2 W5 _, \; V8 b( H
  27. #include <linux/errno.h>
    + t. G; A3 L) G, ~" _3 e
  28. #include <linux/types.h>
    / p  _: R& U) r
  29. #include <linux/interrupt.h>7 D4 V2 O2 Y# G) K" [1 y$ T- Q
  30. #include <asm/io.h>! X  _/ g# b' t6 |2 U
  31. #include <linux/moduleparam.h>5 Z5 |- U8 @& k% S7 v. D4 y5 l
  32. #include <linux/sysctl.h>3 e5 s9 z  m+ i1 x
  33. #include <linux/mm.h>* l  q+ z- b: V# i6 }
  34. #include <linux/dma-mapping.h>6 u( w' }# [! M0 f
  35. + D- m9 a% ~8 H: R( p( x& h
  36. #include <mach/memory.h>
    * _" f, G  ]) ?
  37. #include <mach/hardware.h>: H2 _  I. C/ d% o
  38. #include <mach/irqs.h>* z" s9 l( e+ @. Q3 f! R/ I
  39. #include <asm/hardware/edma.h>
    - F8 q3 `1 h1 n+ v' d
  40. + R( W! r/ d* Q" J
  41. #undef EDMA3_DEBUG. \4 b! {- J* J# {. ?8 }2 |
  42. /*#define EDMA3_DEBUG*/
    : v! x+ v, E7 Z- n& Z

  43. * J4 E& z! g# U8 f
  44. #ifdef EDMA3_DEBUG5 d3 a  m  u7 W1 K5 O# u) I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Y, I3 |- c/ V/ ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 e  S  d5 U6 n! F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 T$ _! u5 U' l0 |$ W* I! ?
  48. #else/ d5 j/ t3 {. L
  49. #define DMA_PRINTK( x... )
    9 \& [: ]) i2 A* Q* [3 n6 ^
  50. #define DMA_FN_IN
      P3 u% ]* z6 Y5 N  t
  51. #define DMA_FN_OUT
    - [$ \4 A: _7 [1 @
  52. #endif8 \0 P2 q0 H! p- R% L0 ?  y$ i

  53. ) S# e! r! ^+ R0 _0 W, C. ^" r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 K: u& H* c0 \* V$ J& k  I
  55. #define STATIC_SHIFT                3
    0 _4 D/ g, `3 f& `6 q
  56. #define TCINTEN_SHIFT               20* f  f1 ~2 f5 q$ `
  57. #define ITCINTEN_SHIFT              21" d. P( E! u# {& a, ^+ i% T
  58. #define TCCHEN_SHIFT                22" ^1 q2 X& J  [& t7 [* r1 g! W" a& p
  59. #define ITCCHEN_SHIFT               23
    / e5 g- N1 d6 I: d* S$ w: I) \, [
  60. & m9 c% ~, I! @8 R% ]) }
  61. static volatile int irqraised1 = 0;3 f5 a" f5 q/ ?
  62. static volatile int irqraised2 = 0;8 M& H8 g1 V7 Y* n* o/ S( l

  63. ' q- c6 x1 S  U/ s2 Z# b. z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; u* y9 w& y/ w9 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 Z1 A9 X* t, t0 f) R9 b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( K) U! E0 J+ _

  67. & l; G% Z) v& g2 D
  68. dma_addr_t dmaphyssrc1 = 0;
    / H, M7 j1 Q8 m8 {- g
  69. dma_addr_t dmaphyssrc2 = 0;
    6 I( ]/ M5 d0 r. {/ B
  70. dma_addr_t dmaphysdest1 = 0;
    " x# k# A: E5 _* O
  71. dma_addr_t dmaphysdest2 = 0;) _+ z" K. Z6 V& t
  72. 3 @) F9 S+ `2 k; o
  73. char *dmabufsrc1 = NULL;$ e* c" D% c. q1 {2 c; D- V7 K
  74. char *dmabufsrc2 = NULL;* i8 N5 S) D/ G, e3 x& ]
  75. char *dmabufdest1 = NULL;
    2 g9 O* C4 q8 o% \2 Z
  76. char *dmabufdest2 = NULL;0 c# [8 U, p1 t5 E2 a! q
  77.   b! v- A7 r8 t. d$ |
  78. static int acnt = 512;
    % x0 g' ?% }; r6 z8 T. D* T
  79. static int bcnt = 8;- |; o% z4 M8 n5 L& L7 a! H' \
  80. static int ccnt = 8;( e3 v% p6 i2 c" Q* `1 s
  81. + g; |  O/ [$ C' ?3 j
  82. module_param(acnt, int, S_IRUGO);
    3 o, d. I5 m1 z" Y1 M8 n% o
  83. module_param(bcnt, int, S_IRUGO);
    $ O% N- P+ f+ A$ t8 x8 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. m6 i5 y  y; x
( J) X$ T% j& R2 u/ d0 O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 f* B, {2 T9 {% {; h2 r' Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 n0 F0 a  T, Q3 Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 u( Y# G8 P" B' A$ u

% R# T* H+ ~# N* c. F: F0 m
  l' d  W) c1 [: g% p: j1 J2 F9 G; W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-10 14:49 , Processed in 0.039057 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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