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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : u. u* {. g% q. R, i
  1. [code]EDMA sample test application5 G: h2 e" F: D- c. R
  2. /*
    5 b) b2 s# K! n
  3. * edma_test.c+ o  M& `0 V5 K+ x
  4. *6 I. J# s5 G) \6 h' D% m: E
  5. * brief  EDMA3 Test Application
    " G! Y6 b3 n5 L8 s0 u
  6. *
    0 \3 Y4 s2 U6 |  P
  7. *   This file contains EDMA3 Test code.) V( N7 ?- i: ?& y' ]7 @- q8 G
  8. *
    4 i7 K/ J# X! t6 L1 D# _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 h/ z/ Z/ h% Z1 B% e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ R1 @8 Z* y* |0 q
  11. *         TO CHANGE.# n% n1 b) M$ I' k  V! Q7 X
  12. *
    6 l$ l0 s) i3 o/ y: E- X5 N  q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 K* i6 t  M" ~! n" z
  14. *  G8 I5 w4 P* T% `
  15. * This program is free software; you can redistribute it and/or+ Z; {6 _- d8 E
  16. * modify it under the terms of the GNU General Public License as
    % q$ g  p4 A% o
  17. * published by the Free Software Foundation version 2.
    " P  [3 w% V" j
  18. *
    ( f# G* u7 V. H: x% e3 `- h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( c2 X8 a0 u) L* P4 T
  20. * kind, whether express or implied; without even the implied warranty! s7 O; T0 ?, A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 C0 Y( u) M! Z4 t0 ~  S7 k
  22. * GNU General Public License for more details.
    ' N$ K( }  K% R$ m
  23. */
    0 d! Q; Z4 m) \& X7 F2 B! B
  24.   h4 }/ O: d- V3 x# r
  25. #include <linux/module.h>
    / `5 Q8 J! Q& E& ?3 H3 f
  26. #include <linux/init.h>; H4 {) m' l; f+ l1 g
  27. #include <linux/errno.h>
    . f  q: g* x- Y% E* J2 M- y
  28. #include <linux/types.h>
    ) w+ c0 O% R- j5 g' d
  29. #include <linux/interrupt.h>
    ( r& W2 w) B# N8 }' L
  30. #include <asm/io.h>
    " f+ D: @0 D; _7 u4 Y
  31. #include <linux/moduleparam.h>
    * S6 I& s! G0 |0 X/ r. i  g
  32. #include <linux/sysctl.h>
    & O; n, v- J) ~! C7 j( d% y
  33. #include <linux/mm.h>+ H. n$ L" }# `2 r
  34. #include <linux/dma-mapping.h>2 f! W, N# o, @

  35. " J% v) \2 c8 |
  36. #include <mach/memory.h>
    / Y) R% E9 ?; {8 B- V1 Q4 |- C, D# Z# q
  37. #include <mach/hardware.h>1 l9 H; A' \. g' h
  38. #include <mach/irqs.h>
    + s: D- d9 L1 E4 O6 Y. P
  39. #include <asm/hardware/edma.h>3 C3 G! ^: C( H2 |0 r

  40. ( Y' R, w: p* k' u9 y
  41. #undef EDMA3_DEBUG
    : z9 _. Z+ j; ^" i8 I# R9 s( ?
  42. /*#define EDMA3_DEBUG*/
    # ?- g/ C0 O& m. _, ^

  43. - V0 w: x$ f0 e2 x8 s1 O
  44. #ifdef EDMA3_DEBUG
    - ~! r6 X' q8 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 ?: j! l; B' B0 e" o# L1 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  ^5 r& a1 k) j' Y7 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) c% a' g" y3 ^5 k& K7 s! g
  48. #else
    ! k: Q* e% k9 }/ |- w/ S8 p
  49. #define DMA_PRINTK( x... )
    " u- p6 N" J5 r$ k6 z2 j
  50. #define DMA_FN_IN; F; k! c9 K- J; }' x' }
  51. #define DMA_FN_OUT  `/ |2 i3 k9 K$ ]4 [2 f
  52. #endif$ B2 n/ [$ x; K/ J# F+ d& O
  53. : v# w* |7 l0 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), i9 ]4 \$ s% V, H$ [
  55. #define STATIC_SHIFT                35 |( W" u- r' P% q+ ~1 h6 t2 G; ]
  56. #define TCINTEN_SHIFT               207 k7 @+ g9 G3 T2 U! g6 J7 Q
  57. #define ITCINTEN_SHIFT              21
    , `& \. v- w1 ?+ |' q
  58. #define TCCHEN_SHIFT                22/ ^( J: B4 |/ D9 }: w
  59. #define ITCCHEN_SHIFT               23
    3 ?( M! |7 I9 [& H$ V# l5 c% S

  60. ; r  t' q: S" T8 B" d
  61. static volatile int irqraised1 = 0;# \" j& ?# m) N
  62. static volatile int irqraised2 = 0;
    ' I' p) v. Z) L# y$ f+ |

  63. ' F: l4 \" Q/ _& E) H& T# O: Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ D' P& k7 N$ _# k8 O9 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! `- L3 G& ~' C( z$ U7 \, y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 _; j, Q" i9 }

  67.   y: e5 X/ |& s- g
  68. dma_addr_t dmaphyssrc1 = 0;' o) r; N) e0 M* R# Q
  69. dma_addr_t dmaphyssrc2 = 0;! f! Z3 h4 R# d
  70. dma_addr_t dmaphysdest1 = 0;
    2 \& N! V, b8 E7 x; [4 v  V5 N
  71. dma_addr_t dmaphysdest2 = 0;0 x) p% B/ W$ C; y
  72. $ t# l8 [% t$ p: c# e, c! J
  73. char *dmabufsrc1 = NULL;  z: M' h$ E* Z8 I3 R& ?6 v8 Q
  74. char *dmabufsrc2 = NULL;" _- g" K0 ]$ i; H1 v1 ]
  75. char *dmabufdest1 = NULL;
    : l  n1 I) P" f9 L& z5 B+ }: N
  76. char *dmabufdest2 = NULL;1 O) ~6 K0 B4 p0 k/ t9 y' @  z
  77. ' T* J) k' H) {' O  U
  78. static int acnt = 512;; R7 J2 `1 i. x! x
  79. static int bcnt = 8;
    , n: \# K) p6 N" E4 B
  80. static int ccnt = 8;
    & D' u# z4 Q* p" ~9 g
  81. ( w6 d4 x2 W$ o
  82. module_param(acnt, int, S_IRUGO);, @, w5 d/ q( x. Y. d
  83. module_param(bcnt, int, S_IRUGO);% y: Y) L& ?1 a. u) j) k  h; q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 O) r! P& r  L8 l/ w1 ?: ]4 u9 c" o! [( d  w2 d- B: h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ j# l" D. P* ^6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 x" g, j1 i. K' {. r3 p3 S4 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, Q3 k! Y/ ]+ L/ x* z& Y/ v
9 k( R& S4 ~) r( _- b

( z2 G5 k- W( }5 U) F% v" @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-9 23:04 , Processed in 0.040099 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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