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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " H! ]# _- b: F5 E. ^# E4 K
  1. [code]EDMA sample test application7 l6 `4 ]* K: y+ x
  2. /*
    0 b. [7 o4 S4 W1 {' z0 R3 p" _
  3. * edma_test.c
    $ v" e' A$ ^9 }1 X
  4. *
    . Y. {2 c# d- c- p( f9 q4 e. h
  5. * brief  EDMA3 Test Application; i& d" B' ~' O# j5 n
  6. *
    4 z- p; I4 @2 X! h, L0 j# u- Y  Z
  7. *   This file contains EDMA3 Test code.$ a) |4 ?5 F5 x; T/ I+ `( F9 O% [
  8. *9 @( _$ c- A3 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 N7 t# x0 P2 s8 t& X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # S' Q' L* R# ~  g+ S1 J* K
  11. *         TO CHANGE.& D) u) Q" _$ A  x  O3 I3 C9 [
  12. *
    & x. a( @$ p4 M* F- Q: Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      L- s7 G8 {8 l+ N  o! X  }
  14. *
    5 |+ v0 T" _1 y
  15. * This program is free software; you can redistribute it and/or) d- q7 Y  z: c
  16. * modify it under the terms of the GNU General Public License as
    + c6 Y5 G' @% R1 p- a! d% ^" ]
  17. * published by the Free Software Foundation version 2.- W' F+ {# I6 @
  18. *
    + l9 X2 A1 u4 b% Z5 X2 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! T/ K% U8 Z$ h( L  }% h
  20. * kind, whether express or implied; without even the implied warranty
    # R/ x6 X5 R+ H  H& w5 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , [! @& F* K3 x- |7 Q8 N; J; I
  22. * GNU General Public License for more details.# [' a+ c* V3 d& x; H5 x0 g. O. Y+ m
  23. */
    ) G9 e! e! w- P

  24. 5 y' c/ }0 O6 t0 d
  25. #include <linux/module.h>
    + y. ~  n6 M( E: c- s- i; H( @- l
  26. #include <linux/init.h>+ T* L* v' E& d
  27. #include <linux/errno.h>
    / C# I4 R, F, @. A6 P/ |1 z
  28. #include <linux/types.h>
    " @" V+ v; `$ c- C8 g, N/ O' Q
  29. #include <linux/interrupt.h>, C+ f3 A" }9 C/ g1 m( D, |* ^% d
  30. #include <asm/io.h>( r8 w' @. |4 B: }
  31. #include <linux/moduleparam.h>
    9 c6 G7 u# P8 _3 i7 d3 S  R5 R
  32. #include <linux/sysctl.h>
    4 q# }% R; b  V% j
  33. #include <linux/mm.h>; }/ P& C% O4 c. |8 u  F
  34. #include <linux/dma-mapping.h>" r- V. i- {0 X, f8 S# B! M
  35. + ~' y1 S/ R5 O# @# R
  36. #include <mach/memory.h>
    3 ?5 C1 H; Z* Y! F" _' i8 M
  37. #include <mach/hardware.h>. o$ o+ U& Z- I3 G- H
  38. #include <mach/irqs.h>
    0 Q$ m+ F. y' E- Y: F8 p  A/ {
  39. #include <asm/hardware/edma.h>) t9 O& a0 m8 C, q9 F
  40. % h. t; Z: O. i: b- `
  41. #undef EDMA3_DEBUG  `+ Y& V& k4 h0 g
  42. /*#define EDMA3_DEBUG*// p' t9 v: f1 M4 m! x0 I
  43.   h) [$ i( f! w3 v( Y
  44. #ifdef EDMA3_DEBUG
    ! e* p3 o% A- W- r1 V- i/ f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 o% O% W2 a( ?" {$ x& o( A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), A& Q* L$ {# f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 p! j4 v& v: ^( k! C
  48. #else* E. W/ V+ B; _' h9 M5 J
  49. #define DMA_PRINTK( x... )
    7 [* s0 l6 Q3 a
  50. #define DMA_FN_IN, f# W# z. ?0 C: `: ]
  51. #define DMA_FN_OUT
    # w7 s- A5 u' N2 F: Z1 o3 P
  52. #endif
    8 z, F1 z. b% d
  53. * X- k6 c+ D4 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; s' j* T7 D/ a% q3 m
  55. #define STATIC_SHIFT                3* t, x" H$ F( q: {! I
  56. #define TCINTEN_SHIFT               20
    , l  q7 s: H" _2 ~! ?+ M  @8 N
  57. #define ITCINTEN_SHIFT              213 q. h1 t! K/ C7 R; O3 I
  58. #define TCCHEN_SHIFT                22
    % Y! {- j; j( @
  59. #define ITCCHEN_SHIFT               23+ B1 v3 l8 ^  z" k

  60. 8 q+ N7 q: I8 R, w( n7 W6 n
  61. static volatile int irqraised1 = 0;  f6 V3 ^8 s. ]
  62. static volatile int irqraised2 = 0;
    4 y" J# C0 H( D8 k2 b. s: P+ d
  63. / d4 e, t9 D1 J: f/ B9 x9 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& R5 l! Y+ P0 U- ?7 e/ t4 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ^4 ]5 p6 y3 L7 z' G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! @0 Q; z& f+ q$ b5 C6 n$ Z+ N; X
  67. - L# E* x* j  o6 u- G- Y
  68. dma_addr_t dmaphyssrc1 = 0;0 a, b6 S9 _8 }. @) m
  69. dma_addr_t dmaphyssrc2 = 0;
    2 F+ p+ @9 p8 R( M* M
  70. dma_addr_t dmaphysdest1 = 0;$ B9 e( t9 {" O# T, m7 g
  71. dma_addr_t dmaphysdest2 = 0;1 o* ?7 w$ H( p6 D3 X$ l

  72. ) |& g7 n2 U, T5 P2 Q; ?
  73. char *dmabufsrc1 = NULL;! u0 n4 r& o8 ^+ K$ ]
  74. char *dmabufsrc2 = NULL;
    % W: C$ b* o$ ^1 U1 I2 [7 j
  75. char *dmabufdest1 = NULL;
    4 z8 Q* y- }5 U3 M# h1 Q' r
  76. char *dmabufdest2 = NULL;9 G) R7 s. Z) j

  77. , N/ ?# x% X' m0 g( q
  78. static int acnt = 512;! a1 X" t* B5 K
  79. static int bcnt = 8;2 Y+ m* l4 U0 W
  80. static int ccnt = 8;: P% v  W& Q4 X' N2 }: D! ]! G2 J
  81. ' o$ [2 S) ]6 b- W$ k$ e% I, C) @4 C, Y2 m
  82. module_param(acnt, int, S_IRUGO);3 d% m8 a, V- U7 ]5 b1 i
  83. module_param(bcnt, int, S_IRUGO);# y+ y. ]8 y, k, ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ v0 ]7 B& y* J
3 V' d1 {, U# S' C, F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 j& M  t. D: y; T; B, Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! I, g0 i  U. u' N$ Z  T7 U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- B, h+ U$ {6 ~* W' p
5 ^2 T# Y- t7 L  ?

% k2 o( j( t4 ?! O5 n# y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 02:48 , Processed in 0.038106 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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