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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " h: H; A/ e5 `1 r5 z
  1. [code]EDMA sample test application
    ' i5 M1 p* Q7 U" A7 d& ?
  2. /*
    ( U( J! Q+ b/ v' t% s
  3. * edma_test.c
    # |- q0 ?2 Y' |) r
  4. *
    3 M6 k" }/ i. h! U& I
  5. * brief  EDMA3 Test Application
    9 R- A5 X9 W- P4 Y( c* M6 w: ~
  6. *8 H+ I& @" J' x! ~6 H# ~8 y$ y
  7. *   This file contains EDMA3 Test code.; f& z0 o% R/ Q# \: C3 [
  8. *
    - v  f  h1 a6 }; v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ e2 _3 q2 g6 y: M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 D6 U' J. j. }2 w0 ?  t* d
  11. *         TO CHANGE., G' u) p4 K" X5 u
  12. *+ j% L! y- \, t+ d8 F, l  b) c: r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ @  `/ I( Q% @8 h. r! y: Y* c$ p
  14. *  `' t* @' ?% I7 O
  15. * This program is free software; you can redistribute it and/or
    " g6 U( m4 k" R9 n* Q( f9 T; O- D" B& I
  16. * modify it under the terms of the GNU General Public License as
    - I- a& {; b+ a! ~+ g
  17. * published by the Free Software Foundation version 2.2 Z- T6 I7 j9 T* }9 B, x3 e
  18. *
    # n8 i" D! N& g7 o5 Q( g' M) |0 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 l3 M( s# j3 e. ?: U
  20. * kind, whether express or implied; without even the implied warranty" D$ ~8 ?2 s) p: {2 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 h' [* J4 g# b) h
  22. * GNU General Public License for more details.; q, ?( u6 g' b  P
  23. */2 d. ^4 m# u( u$ f. s6 ]4 e

  24. , S4 z) R5 j4 r9 x5 F- y7 n! S
  25. #include <linux/module.h>
    ! f6 Y9 Q' m+ r- \" }
  26. #include <linux/init.h>
    ! c+ ]! ?8 h, ^) s% {! P
  27. #include <linux/errno.h>+ n3 L' D4 i0 Z; T  `
  28. #include <linux/types.h>; A# ~1 ?0 g0 p) H, L4 y
  29. #include <linux/interrupt.h># E5 h) P! L* b2 n
  30. #include <asm/io.h>4 t1 i; g# q8 P6 R. J+ J. s8 |0 y
  31. #include <linux/moduleparam.h>
    7 p* r. K4 a# {/ s* S, I2 @
  32. #include <linux/sysctl.h>. ~- j3 q9 \! G+ t  A
  33. #include <linux/mm.h>7 H; R' p7 O5 N
  34. #include <linux/dma-mapping.h>
    : ^- \( Y" f0 F0 e

  35. 8 |( c% l7 b9 @& K# R1 Z5 V7 T3 n4 d# Q
  36. #include <mach/memory.h>
    / [  W. A% n: o8 Z/ u2 h' l+ ~
  37. #include <mach/hardware.h>
    # l0 @: G9 h' ]7 @! l6 F
  38. #include <mach/irqs.h>, N( P+ Y' T+ J6 A- l9 c; i
  39. #include <asm/hardware/edma.h>
    7 i. z% g9 _5 M' ?7 |0 f# @$ k
  40. : h1 T  o, O% P! T: _$ g7 f7 s
  41. #undef EDMA3_DEBUG
    " s- |& @) H7 ^
  42. /*#define EDMA3_DEBUG*/$ w/ x) W' b! P+ W0 z. B
  43. ' t& ?- J3 e* _
  44. #ifdef EDMA3_DEBUG6 q/ ?0 \* B7 Y# G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . T! e" M( a+ e3 a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* m6 M8 {0 _, R# P6 o; Z! ^3 ]' @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 v% T. j8 }4 n6 L
  48. #else
    / H% t; E& W+ T" z6 x- W
  49. #define DMA_PRINTK( x... ). H2 o# P0 u% G$ G( t, t$ V2 c- n+ m  z1 N) X
  50. #define DMA_FN_IN4 ]: B0 x: R# J$ Z5 H1 \1 m
  51. #define DMA_FN_OUT
    5 _! }7 |% i. l! ^; A: _  b* D
  52. #endif
      _6 B4 g  s, v
  53. 8 U5 Q( i& L0 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% }6 p4 h$ ^9 t' g* t+ t) V
  55. #define STATIC_SHIFT                3
    / y( |7 [( ~9 q
  56. #define TCINTEN_SHIFT               20
    , C8 E% ]  H8 n3 I9 R! p8 v
  57. #define ITCINTEN_SHIFT              21
    4 k- n; P' _( S
  58. #define TCCHEN_SHIFT                22
    0 j# }5 G6 L) y. A4 o
  59. #define ITCCHEN_SHIFT               23
    % u8 |* K( Z" E; b$ Y) d# o

  60. 8 T0 m" s+ [$ i( ^5 Q9 G
  61. static volatile int irqraised1 = 0;& U: r1 h& L( K3 z9 b
  62. static volatile int irqraised2 = 0;
    % c- ^% ~9 [" D5 _: {8 p

  63. 1 Z; f2 N. e* R( p( S9 L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 s! ~/ [6 [, q- }+ h5 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Y: u. d6 c( A. B: N2 K7 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 J1 q1 ?: H. H4 d3 a. ]
  67. ! L4 K- B9 ~8 C* |- c
  68. dma_addr_t dmaphyssrc1 = 0;
    3 p. A0 D) K! M& Q
  69. dma_addr_t dmaphyssrc2 = 0;5 e2 l  Z; t; c4 O% x' H7 A; s' H( ^
  70. dma_addr_t dmaphysdest1 = 0;
    / P* J! Q  O9 E9 W  A
  71. dma_addr_t dmaphysdest2 = 0;
    3 K( q9 Z, |. r' t) y

  72. % [/ G4 F1 Q' W0 Q) W. a& Y
  73. char *dmabufsrc1 = NULL;
    ) y5 [9 b( M, \9 A: l+ m
  74. char *dmabufsrc2 = NULL;" r* v0 @% r& I7 j4 X4 m3 _
  75. char *dmabufdest1 = NULL;3 z, _- w( e3 k1 G" ]7 k- I
  76. char *dmabufdest2 = NULL;
    8 `* C/ L, n" C4 e
  77. , B" R0 n& M& b) z
  78. static int acnt = 512;( B4 C; n- K; D( n- P5 f1 H4 Q7 r
  79. static int bcnt = 8;# Y8 e+ S3 n$ W  S0 ]7 K
  80. static int ccnt = 8;
    + J7 i3 r  j7 b# @+ i1 o. z8 K
  81. 9 h3 M& U, U* j. Y) t
  82. module_param(acnt, int, S_IRUGO);
    0 a9 ?. W- J; t9 Q+ l
  83. module_param(bcnt, int, S_IRUGO);
    ! y8 o7 d  _0 U- K3 p0 V: m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. F4 j' O& B; l7 L* l3 a6 E
! B3 n5 j& e* L! j' k- p* j; t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  H9 j0 j3 [  K/ V2 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ g0 i- w0 a, K( h! ^6 U' t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  T; X. T6 ^, X0 K
) Z7 G5 Y7 t7 A7 R$ ^  [$ N: r* K2 |$ ^, c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-15 09:18 , Processed in 0.037623 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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