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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ }& ?% c" }5 z! l2 N
  1. [code]EDMA sample test application7 ^8 k% b3 w8 C& x3 M) z0 q2 s
  2. /*
    3 H! W" e5 c- T9 d, y  w; W, M
  3. * edma_test.c
    1 L- V- ]3 p  q  D/ l
  4. *
    4 ?  `" ~0 j3 r' M# K  j& R
  5. * brief  EDMA3 Test Application
    : F  |- m# R! q" @# n' z: Q7 Z' L
  6. *9 J( l; m6 N( [: Z
  7. *   This file contains EDMA3 Test code.6 G, C5 T+ b$ c) y* h6 f6 q
  8. *
    7 w/ X1 y$ }% v3 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + S+ I( d$ k2 t% L* o. k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ M3 Y8 ]1 X& Y5 |7 [6 X
  11. *         TO CHANGE.
    ! _7 C( i0 M) s5 {  N0 v- b! U) Z
  12. *
    , U! f" E- ?, Y9 v! Z% I/ a+ W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 s; l6 I5 L; I! E
  14. *
    7 Q; S8 x4 \/ L
  15. * This program is free software; you can redistribute it and/or4 h3 _* t" d4 N" m. j( y
  16. * modify it under the terms of the GNU General Public License as
    + l# k! e, t* s
  17. * published by the Free Software Foundation version 2.0 v' U1 E/ Q( O1 [" @* r
  18. *
    8 c$ ^: T: y( T/ N. t% _8 V/ \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : }% P6 l& E' r; H7 R
  20. * kind, whether express or implied; without even the implied warranty
    , S2 R$ D  }6 F3 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) c9 X' X& E& Q2 E9 y: i
  22. * GNU General Public License for more details.
    6 O6 z! X. v7 [* ^9 D
  23. */( c" I* L: v; `2 G- D3 r1 U! Z0 X

  24. 5 \2 W) C# I) x' z3 C/ E8 r% `
  25. #include <linux/module.h>
    6 I. K3 @1 I: n
  26. #include <linux/init.h>
    8 D  Q8 s2 Q1 ^2 i5 ]! `
  27. #include <linux/errno.h>
    % A# }1 V; D) n7 a
  28. #include <linux/types.h>
    0 t( |8 B8 @2 Z+ Z( X
  29. #include <linux/interrupt.h>2 C3 L7 r7 D4 c4 I- i6 t* x
  30. #include <asm/io.h>9 N7 R8 e! |. X
  31. #include <linux/moduleparam.h>
    ) h# E+ I4 m. [! k7 l* D( u
  32. #include <linux/sysctl.h>2 a8 P4 l* z" r9 K- H5 l
  33. #include <linux/mm.h>% I$ r; G" [0 P8 s" X8 k6 f* r* p
  34. #include <linux/dma-mapping.h>
    $ d* O9 _) @/ `' w

  35. 3 j7 S$ M! M( A$ f
  36. #include <mach/memory.h>
    ! g$ J& V: j9 @$ T, x
  37. #include <mach/hardware.h>
    # Q& m8 T) i6 Y9 N- r) i
  38. #include <mach/irqs.h>) \, `+ q8 R, G1 u) U( A
  39. #include <asm/hardware/edma.h>0 r! F' n. \6 F6 f

  40.   T) {  O% a9 ^8 C  |
  41. #undef EDMA3_DEBUG
    / U- h8 D6 c; H0 Y" }' F
  42. /*#define EDMA3_DEBUG*/3 [" F9 q% c7 x- Z* e- {+ x. w6 Y

  43. 6 F5 u) J9 f. U0 Z% P6 Q" c9 E, u
  44. #ifdef EDMA3_DEBUG6 ]* M' @, \. e" m5 ~! l' X+ h% n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + W9 K7 Q" d% e, a1 _3 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + Y2 A: E; d& n: u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 O4 F: t1 }/ t. R* O+ D
  48. #else
    5 P5 e! |; w+ d
  49. #define DMA_PRINTK( x... ), K3 h+ h4 e0 y% g4 X
  50. #define DMA_FN_IN
    : i' D' a: h. P( E
  51. #define DMA_FN_OUT
    4 x! ?1 M6 G9 x9 V# X# @
  52. #endif: r/ l. }# |5 z- \# M4 ~4 \
  53. : ^2 Y1 m- \  G/ Q: B! l$ f" L3 A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! w% c, [# z! y
  55. #define STATIC_SHIFT                3: m# W8 o( w9 p6 @( L3 B/ `$ }
  56. #define TCINTEN_SHIFT               20$ e# H0 x! I, B% w/ F) \; a
  57. #define ITCINTEN_SHIFT              21
    9 }" e" s& v% Z5 U
  58. #define TCCHEN_SHIFT                22
    ( B7 L4 h6 T, x9 a7 U2 B
  59. #define ITCCHEN_SHIFT               23
    3 E  ^/ L+ ?1 D: u  A" g5 Q7 P
  60. / n9 _: d2 r; v# m. r5 i
  61. static volatile int irqraised1 = 0;# o+ T+ B9 C7 Q0 Z6 Z
  62. static volatile int irqraised2 = 0;
    - e9 w0 a4 R' b1 O3 @' J

  63. ' v6 v6 I$ a( L. O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" H/ n  E2 f( b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & }  s7 `' H9 J* e) C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! }3 A) T) z' `- w  h2 c) K

  67. & ^% f( [% m5 M# U& L/ K/ G
  68. dma_addr_t dmaphyssrc1 = 0;4 Z* m$ i5 i# k# A4 u2 r6 }
  69. dma_addr_t dmaphyssrc2 = 0;
    6 a- r* [% |  D0 a6 S; V
  70. dma_addr_t dmaphysdest1 = 0;1 m3 L5 J5 `/ d5 J9 o
  71. dma_addr_t dmaphysdest2 = 0;
    ; M- t; `& x" b+ q- s5 T0 z3 Y* ]

  72. 3 v4 h' Q9 o/ X: n& Y
  73. char *dmabufsrc1 = NULL;! P& }; z+ p. }8 y( V8 X* Q1 I: p
  74. char *dmabufsrc2 = NULL;" A% O2 J) H: e- p
  75. char *dmabufdest1 = NULL;
    2 J3 b" f2 l. S" x
  76. char *dmabufdest2 = NULL;
    4 x8 h2 N" j2 N$ e

  77. + `/ D! c# }2 z/ B; T! C& [8 [- a8 S
  78. static int acnt = 512;$ j' X0 ^- A2 I, l9 k
  79. static int bcnt = 8;
    & E) X' C/ B' ^' Z
  80. static int ccnt = 8;: m( D( e! A) `& t, u( w+ W

  81. ' z) z+ [+ Z- G3 Z* R& n3 c
  82. module_param(acnt, int, S_IRUGO);; q" j3 G% Z" `$ i6 A+ g  J
  83. module_param(bcnt, int, S_IRUGO);
    ) o" {- T5 E  H2 C- |( i& u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 C+ z! }# f0 W/ T4 U" c% @) n6 M, K4 ~5 l' j4 e4 [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 F4 i! C! e8 {8 o( L' }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 O- x/ Q5 L7 Y! P) d) x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ e1 |8 W% J8 M" {: {; v" _! w- A

( _" ~. }6 o% ]% N' e: [
& l; s. J1 e# x  O& |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 23:13 , Processed in 0.039194 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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