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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 U( I6 B4 ^$ _* W- O' s5 v0 n7 t
  1. [code]EDMA sample test application
    4 L8 c1 l0 J0 m; D) [9 Z
  2. /*
    5 a5 j! F: B  v" x6 V3 T0 P
  3. * edma_test.c5 _; v! e! N, x% K" P
  4. *
    . O( {" v+ p, ~
  5. * brief  EDMA3 Test Application* b3 V) u' Z7 [( `! Y9 y
  6. *
    & ?* W, j+ P( ^$ M% g
  7. *   This file contains EDMA3 Test code.
    % D; H# j+ I4 n( D  x6 q% n
  8. *" ]0 j$ S1 h5 E& O( z) H3 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 r. C; t' @$ Z6 \$ R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 U4 ~( B9 G/ O: h  p* h# g/ P/ B" C
  11. *         TO CHANGE.) S3 Z! c8 D( Y) w/ _) h5 C
  12. *: U& Y, t' v& T+ i8 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : I1 q1 P; X7 F7 A0 J
  14. *5 I3 \  Q5 r+ C
  15. * This program is free software; you can redistribute it and/or3 V# j3 {% h) g/ X0 z
  16. * modify it under the terms of the GNU General Public License as7 ]0 H$ I" M2 v; o4 g1 q+ X( S
  17. * published by the Free Software Foundation version 2.
    6 I) l; T- c  A: ?0 c: r
  18. *4 T! h9 C/ A* \1 M* g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * e0 C* @5 n' {/ ]3 B, d
  20. * kind, whether express or implied; without even the implied warranty
    ' W! U7 s2 B5 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 m% K! |7 C/ {9 J
  22. * GNU General Public License for more details.
    * @1 k% B) W' ?8 Q2 \$ p
  23. */
    ) }  x2 S$ ^8 \  m2 N$ @& ^" n

  24. ) y- L: J. `! x% U+ v. T
  25. #include <linux/module.h>
    6 d. y+ R7 r& }% _3 q6 d
  26. #include <linux/init.h>* l( b9 G3 n6 A$ B0 e. B& V9 V* c) P
  27. #include <linux/errno.h># k1 J% |6 g/ m* `1 [6 Y9 c9 W
  28. #include <linux/types.h>
    # |% ~/ f5 |' w' D* C. o* f
  29. #include <linux/interrupt.h>! m% i& r# M& s4 y
  30. #include <asm/io.h>0 M4 u1 A8 V* |! [) n
  31. #include <linux/moduleparam.h>& h: Y4 U( d! R1 c
  32. #include <linux/sysctl.h>' R, s& P% {) C1 x! F
  33. #include <linux/mm.h>/ t  h6 M  S3 u2 z6 ]) M
  34. #include <linux/dma-mapping.h>- x3 x& r% Y3 H% o
  35. $ ?; W( c2 G0 O: E6 v
  36. #include <mach/memory.h># `9 G0 R8 `$ |9 q$ N
  37. #include <mach/hardware.h>
      H) B( u' f1 x) l2 U& L6 h( S
  38. #include <mach/irqs.h>1 ]& e7 Q  |. b9 R
  39. #include <asm/hardware/edma.h>
    # W9 c% L" i* O" `' `) u

  40. % m6 ]' A- ^' `
  41. #undef EDMA3_DEBUG
    $ U/ N$ Z  @  s" N, c. D8 D
  42. /*#define EDMA3_DEBUG*/, l5 i! a" X: ]% C2 u
  43. . z& v7 I/ ^2 |3 x3 U
  44. #ifdef EDMA3_DEBUG
    : f  \! ]# Y3 S% z6 ]4 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! m& {6 g) j: C5 V5 ]8 k  q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 a' o/ w- `/ P, y9 h+ Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), `8 n/ f- U; s, h
  48. #else
    % y9 z1 B- ^. o- K1 F$ w
  49. #define DMA_PRINTK( x... )
    " W4 q- u3 ^# V$ }
  50. #define DMA_FN_IN4 U1 D2 l6 b) a- J+ |4 H& f
  51. #define DMA_FN_OUT
    1 k# I  B8 _+ V& h9 d" @
  52. #endif8 P/ X6 H4 L( ^$ s

  53. * N# ^6 v) F5 Q% J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 |1 `4 p: s/ o. y# ], _7 L
  55. #define STATIC_SHIFT                3
    # D+ T. t; a/ F) t9 a4 |
  56. #define TCINTEN_SHIFT               20
    0 I- b1 @2 U1 j
  57. #define ITCINTEN_SHIFT              21
    3 x- r# s+ @; ^/ |- h  T4 \
  58. #define TCCHEN_SHIFT                22, r0 l3 a# Z" R7 j9 U4 o9 E" v5 k
  59. #define ITCCHEN_SHIFT               23
    2 F/ v' Y8 g& ~
  60. ! h; J' m" o: t$ |
  61. static volatile int irqraised1 = 0;
    2 K* M+ n# U  ]: K) `& J% \
  62. static volatile int irqraised2 = 0;: H% H+ }9 I) M( L. [

  63. 0 E0 u3 Y: T- d  M7 B- M3 g( D8 k/ s* b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 b( R% I) d- m' B# [0 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ h: |0 z5 @) s1 \# S  P- ?7 m% p5 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # V+ z- s1 i: t- p# h$ `2 u

  67. 1 H$ A) q5 l; F* Q
  68. dma_addr_t dmaphyssrc1 = 0;8 l) ?7 ~: ~0 K1 ?
  69. dma_addr_t dmaphyssrc2 = 0;% _6 a+ b& @' n! q6 ?- W$ q
  70. dma_addr_t dmaphysdest1 = 0;
    8 B9 s, K7 d6 i4 Z& t( m; M8 ?
  71. dma_addr_t dmaphysdest2 = 0;
    ! ~/ D, v! e( a) @4 u; X( p
  72. - M5 s. L" M3 }: a
  73. char *dmabufsrc1 = NULL;
    ' g8 f2 ^: K+ {
  74. char *dmabufsrc2 = NULL;; T' p4 [8 x8 M! ?* M. V; X
  75. char *dmabufdest1 = NULL;
    ; b) Q% A5 G; [5 Z2 a. f2 _
  76. char *dmabufdest2 = NULL;
    $ {9 v! `5 X# T7 C/ r2 z

  77. ' l* y  s+ a9 q2 T( e6 L0 C6 z2 B
  78. static int acnt = 512;& v; t- S2 |1 U6 E! i, R
  79. static int bcnt = 8;3 s) T8 }! P" Z8 O! G& V  K. j& H
  80. static int ccnt = 8;0 j% h! `- e9 |6 p& G) D
  81. 1 V3 W# @' X7 q; S4 ^
  82. module_param(acnt, int, S_IRUGO);  ?" ?9 a4 c% C; P3 w# c3 p, |2 x
  83. module_param(bcnt, int, S_IRUGO);. x* K3 z* F( V9 V. }1 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* K% R1 s( x9 p( ^! K
$ u/ g9 x; _8 W7 p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, P) N. j$ L$ g! q: x% I9 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 C1 c/ Y2 @) g7 G( |, I: d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 T3 Y( r( z+ ~" \
# U* v2 n8 F" p
: Y0 t6 P1 A7 L8 s$ p3 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 17:28 , Processed in 0.041737 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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