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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 U$ Q/ Q+ e7 }" A8 p6 c
  1. [code]EDMA sample test application; t$ G6 e& Y% ?$ q
  2. /*6 r6 e: R! y& F5 q& r! c! |# L
  3. * edma_test.c2 i5 Q4 p& w: X9 X! T
  4. *
    * R5 u" M2 I! g8 V' {, [$ n
  5. * brief  EDMA3 Test Application' o& L: o" o: _8 N
  6. *
    ! E4 b3 O: H# G; Q$ }1 K  }7 R
  7. *   This file contains EDMA3 Test code.
    ; y7 c3 y, n+ d, M5 B9 s, J3 H
  8. *
    % e5 g* j, ]5 l) U' Z6 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! Z: y0 r$ z: q" q4 K! A5 @# M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % `) g+ m1 w% U7 s% M& P* f- b- V
  11. *         TO CHANGE.' d- F  u' F; Y/ s6 |8 a4 k' A
  12. *
    + x3 W; B- f3 O( ~3 C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 K2 D- k* i9 U  D( f
  14. *
    6 h1 D  N% Y4 o7 f
  15. * This program is free software; you can redistribute it and/or
    * D' ^" i" U9 b9 K! `5 \) p
  16. * modify it under the terms of the GNU General Public License as
    + S0 x! c$ V2 s* t1 M. E3 Q* F* ^) m
  17. * published by the Free Software Foundation version 2." \' d; |5 Y! k1 D
  18. *- M) m! w/ S- }' G! L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 \9 R4 g9 f6 A. ~) W2 \) g
  20. * kind, whether express or implied; without even the implied warranty
    0 q( L' @3 B. ~) B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 K  X) z& V8 ?) g; n' e
  22. * GNU General Public License for more details.4 G: e( V* x' f, e# r) n. n
  23. */4 m+ U% Z; ^7 k: B
  24. $ Q3 b) U  `" f5 ^+ B
  25. #include <linux/module.h>5 T; S: Z0 [6 \, A% H
  26. #include <linux/init.h>
    8 L8 \0 V1 R8 B* R
  27. #include <linux/errno.h>  n; A, O: l+ C6 @$ X% G
  28. #include <linux/types.h># ~# H1 Y$ z7 W/ N0 H% J
  29. #include <linux/interrupt.h>
    ( U2 h% u! @7 Y) Q! D7 D6 `
  30. #include <asm/io.h>
    3 _3 g+ V6 j( G" |
  31. #include <linux/moduleparam.h>
    5 _; |1 g) _/ s: J/ W4 P2 R
  32. #include <linux/sysctl.h>
    4 P" S8 I- t1 u; n& J6 j5 M- d
  33. #include <linux/mm.h>' B; ~0 Q* t* Y! {9 \- g
  34. #include <linux/dma-mapping.h>
    0 x9 X; d5 c1 y4 h3 r% Y

  35. 0 i; o, u6 ]$ b
  36. #include <mach/memory.h>2 ]0 u; Z( Z0 b
  37. #include <mach/hardware.h>
    ; _" G$ w8 g+ |0 o9 _
  38. #include <mach/irqs.h>
    / ]9 c  z+ p* Y* g9 H. ?* K- Z- f
  39. #include <asm/hardware/edma.h>+ R0 t$ m3 A4 q5 t, d
  40. + b4 {# u6 D, H/ F: E* f
  41. #undef EDMA3_DEBUG
    2 D8 J( f: w! x
  42. /*#define EDMA3_DEBUG*/
    : S! O/ l+ ~  c& G

  43. , X" M$ K: t  _
  44. #ifdef EDMA3_DEBUG
    & a' j, W6 h# x/ w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 u* F) O& h/ k  P* ~; x( E0 `1 P+ B1 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . y8 ]( n, e3 b5 _% M( v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 X! D6 L# y$ n  w8 t- Z" ~' ?& h
  48. #else) r, [2 L: A3 Q: b3 L
  49. #define DMA_PRINTK( x... ): B" q6 a; A5 x1 H4 I/ }. U2 l
  50. #define DMA_FN_IN: K# o+ u* ^0 z8 D9 i0 R- M
  51. #define DMA_FN_OUT+ m0 k( e4 W8 I& H) H+ L# b6 x
  52. #endif* o7 J/ R5 v7 c' |

  53. 0 O1 U! b/ e6 C: K8 t1 ~( N2 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  s) @, Y2 q; e- k* `1 J% C$ o& b& w
  55. #define STATIC_SHIFT                36 \  @/ w+ y6 I3 M, c
  56. #define TCINTEN_SHIFT               20
    4 c4 I9 e( p8 ~1 |% [
  57. #define ITCINTEN_SHIFT              215 c3 h# @" F" I) ^* X
  58. #define TCCHEN_SHIFT                22
    " T4 k5 k6 ]$ E; [) D( w$ v
  59. #define ITCCHEN_SHIFT               23; x& k& `; F" i

  60. ) V; b9 u2 [! l. h% X3 _
  61. static volatile int irqraised1 = 0;
    , _. }! Y: b5 L7 J& t
  62. static volatile int irqraised2 = 0;
    5 ~, r2 R, Z/ Z& v% R/ s1 h/ o

  63. ' C( h5 u* h# K( _- M2 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- M) G! D* R- a  J7 X$ Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ X% {0 m9 Z' a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * v: m8 p' I- Z& f+ f% i& y
  67. 9 f9 X) c3 T9 t% J7 ~! g! L( {2 D; O
  68. dma_addr_t dmaphyssrc1 = 0;
      z: v0 |' F7 z% [* `5 ?2 j0 H: _+ g9 U
  69. dma_addr_t dmaphyssrc2 = 0;
    + {  G# F) S. p+ Q6 W0 q) h& Y
  70. dma_addr_t dmaphysdest1 = 0;- N& c/ M: w4 W' c
  71. dma_addr_t dmaphysdest2 = 0;
    5 Q2 A; ^5 i3 h0 z4 v2 x

  72. " Y' l0 D3 [* h" G4 F
  73. char *dmabufsrc1 = NULL;% Z- F3 j5 }8 \7 ?$ k% Z
  74. char *dmabufsrc2 = NULL;
    8 v+ K9 h) Z- [% r+ q
  75. char *dmabufdest1 = NULL;; a7 m0 S. U; h3 C$ y; ?
  76. char *dmabufdest2 = NULL;
    & F: Z, Y# t% N, M; y7 @
  77. 4 y5 ^# S' f# T1 [, F
  78. static int acnt = 512;
    5 P& ~* U) U+ T. J" H
  79. static int bcnt = 8;
    * p% b+ m0 ]- K; n+ H/ a6 ^( h7 Q) @
  80. static int ccnt = 8;
    2 B1 V& T' t0 H1 ~1 s3 k
  81. 0 {$ O* Z8 w/ _( {/ W2 \
  82. module_param(acnt, int, S_IRUGO);3 s% j) j3 C' z6 W  |0 z5 M
  83. module_param(bcnt, int, S_IRUGO);
    : R4 B  l& R# e; ~. X. }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 A. w! {  S  e  O$ N6 \! J8 h% r

2 j4 t! J5 u2 A) ]7 w! Q2 G+ N+ [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! N7 Q% T7 o/ Y0 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& Y$ e1 A5 h3 q/ x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& s0 F! U5 ~9 B: L$ e5 x
7 N; G. [! \7 E1 \$ a) a

6 n4 d) i  G+ D9 l8 R: Z4 ~, n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-10 05:10 , Processed in 0.038573 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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