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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! H( i5 r/ T! W
  1. [code]EDMA sample test application
    . B# W. w, H7 @, k6 _
  2. /*! E' {% N1 b* Z
  3. * edma_test.c
    5 c& ^0 ]% M- h+ N( Z7 u7 ]
  4. *+ V$ Y1 t  g6 J# w. [
  5. * brief  EDMA3 Test Application
    2 P6 r- b0 @- Z" R( ~2 V0 t
  6. *
    # N8 b: }0 ~- O' o# a: r! S- w
  7. *   This file contains EDMA3 Test code.
    * ?2 _4 X# ?* f& i
  8. *! u$ O* w3 k) V% \+ Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 y1 w( }* K1 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / ?' n( O2 |2 R# I) |$ u
  11. *         TO CHANGE.% `  V% w5 c1 R3 T# x7 V, X' a
  12. *- _* A4 o, h: s' @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) o8 o! d$ Q4 w: a2 Q) D! S
  14. *
    8 z  ^  Q7 D1 y; x; j
  15. * This program is free software; you can redistribute it and/or
    . m5 W. H$ _# C  J: T2 k+ K
  16. * modify it under the terms of the GNU General Public License as
    : L& U  a4 ^" ~: i5 a
  17. * published by the Free Software Foundation version 2.
    - w  s, I, ]; G& y# F. g
  18. *
    7 J* e& s% E8 Q/ X( j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( W, n0 _4 w% V9 Y
  20. * kind, whether express or implied; without even the implied warranty
      {) ]; ?6 u  u6 c9 H: C" ]; h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ F: K3 J- s# `; }
  22. * GNU General Public License for more details.
      J! |6 o1 Z( Q6 f1 S  C2 \. d
  23. */5 @9 _' R8 m( R% t5 I& [

  24. 8 X( k" X0 w' v" \8 h; [
  25. #include <linux/module.h>
    2 o7 }1 c! d  A/ l0 r
  26. #include <linux/init.h>3 K$ E3 D* `, F0 r
  27. #include <linux/errno.h>  ]% f: {# e- N6 F
  28. #include <linux/types.h>$ r" u: k- n. G' S# U. G% K8 b) A! K# O
  29. #include <linux/interrupt.h>
    / S8 j9 K4 u" H2 q0 T
  30. #include <asm/io.h>5 e6 d# w4 u! G6 T3 |
  31. #include <linux/moduleparam.h>
    6 V; u% v0 g: x
  32. #include <linux/sysctl.h>
    * ~, T: H: f1 n
  33. #include <linux/mm.h>  A8 k: k2 ?+ w' N$ _
  34. #include <linux/dma-mapping.h>9 }: ?! y; Z# n+ B( d$ k6 e6 T

  35. ' B' _/ _3 {3 Y6 Y3 I: B
  36. #include <mach/memory.h>
    $ o( D( y) f6 x3 D% z* R; h
  37. #include <mach/hardware.h>! g  S! L) `3 O
  38. #include <mach/irqs.h>, h' E! b9 I1 @' N
  39. #include <asm/hardware/edma.h>
    7 `: d) I8 v6 g4 Y  N  h% L
  40. # P3 K: M2 y1 c' x; o6 g9 T
  41. #undef EDMA3_DEBUG' Q5 b0 g5 X6 D- H
  42. /*#define EDMA3_DEBUG*/- n- d0 q5 ]7 K' k, R* k! ^
  43. + g1 V; D5 m; D. [. O- S
  44. #ifdef EDMA3_DEBUG- o; o% H  i! V" E: v' R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 q7 ]% W- T! s( T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 j1 |7 s6 i) S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 C# z3 P6 n7 c+ N, C
  48. #else
    / u# A* u. X1 B3 X
  49. #define DMA_PRINTK( x... )
    0 v2 z: @, ~* ]: w; _5 e
  50. #define DMA_FN_IN0 e" r3 i; j3 p+ j0 |7 d3 ^
  51. #define DMA_FN_OUT  Q" s3 }, S  ]( n6 B8 Z. S
  52. #endif* X( F' V! Z# l# D: ?+ N

  53. 1 e; ]! L' R1 G$ V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( H" @7 f2 M) J. J3 i+ |
  55. #define STATIC_SHIFT                38 f: J/ Z  Z: T
  56. #define TCINTEN_SHIFT               20* P( r& I: e  d7 A' T
  57. #define ITCINTEN_SHIFT              21
    # B2 e- h5 F- }
  58. #define TCCHEN_SHIFT                228 X, k" N( J( p8 Q% H9 [3 B" `3 u. i2 D
  59. #define ITCCHEN_SHIFT               23, _- G9 p/ \2 e  M/ {
  60. + C) I2 s' [0 H& u; d' j
  61. static volatile int irqraised1 = 0;9 `) @: i( c* E
  62. static volatile int irqraised2 = 0;! l3 z; d/ X+ L- w& J

  63. + ?# j% T! x2 f( j0 O$ X6 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  Q+ c8 i' b/ M1 Y3 D- k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; }3 z* U; g& i; x; b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' U& l& m6 |& {2 c2 ?7 a

  67. # D+ `. n2 d' \5 f
  68. dma_addr_t dmaphyssrc1 = 0;! y9 Y  j1 P% w. N1 }9 v$ m/ v5 \
  69. dma_addr_t dmaphyssrc2 = 0;
    1 v5 z1 v1 L; k. c5 M
  70. dma_addr_t dmaphysdest1 = 0;1 w2 i4 F" [3 K/ b7 [2 {
  71. dma_addr_t dmaphysdest2 = 0;
    . _' U9 O0 J$ w& O% S

  72. ( Y- @/ B* W6 H2 M/ h( h' \
  73. char *dmabufsrc1 = NULL;5 V% d+ b1 H& j
  74. char *dmabufsrc2 = NULL;
    , ^, g* J$ a4 S0 {$ |
  75. char *dmabufdest1 = NULL;
    ) l' y& _( b2 p
  76. char *dmabufdest2 = NULL;( S2 g+ n& v: ?% F$ M
  77. * g9 a$ a( i4 L0 v
  78. static int acnt = 512;
    & n6 D$ M+ m/ r/ U5 Y) P  q
  79. static int bcnt = 8;
    : w% l; O- U# ?' R  Q& u
  80. static int ccnt = 8;* y; e* y4 x4 f' ^7 k
  81. , _. c. u. G/ U# `$ A2 H) P
  82. module_param(acnt, int, S_IRUGO);
    9 p4 y# c% H8 Y1 i* D
  83. module_param(bcnt, int, S_IRUGO);0 H( F* l. @2 J7 A- x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 {( k) |3 ?% ^' M+ B
7 k7 b1 E% y5 @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! W1 R2 k5 v  l; n0 G( b1 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; ^: e0 i9 G. |* W; F" p/ ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ f$ |4 S4 N1 {  A3 N  j  L: G) k1 g7 R+ L' }9 }9 F) y. d

& L) Y: M7 x7 G3 n9 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-25 23:41 , Processed in 0.039318 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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