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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, P- p7 X% y1 n  G; x1 Y/ K8 B
  1. [code]EDMA sample test application
    + n+ a# c, U, I; _
  2. /*) z( [' B# i7 |2 Z
  3. * edma_test.c
    ( |4 ^2 ~: a$ A* ~! f2 R
  4. *' b3 ?2 Q! b/ _! H1 j* U3 _
  5. * brief  EDMA3 Test Application
    0 \3 N# q1 D4 g0 ]. c& |9 n% x
  6. *6 y4 p( T2 B' a$ r7 Y9 n
  7. *   This file contains EDMA3 Test code.0 w& B# y7 G% v9 O7 M( E% L
  8. *4 y/ u8 O& \; M0 T" k0 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! _5 x/ Z: C4 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ W) T, Q8 V4 t
  11. *         TO CHANGE.9 s& H% Q5 T8 R+ J
  12. *
    , X- [1 z& Q7 R& e0 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 e6 |7 @& Z. \0 Q- m; J
  14. *
    8 E! F8 K% b1 W6 R6 r) ?
  15. * This program is free software; you can redistribute it and/or0 g+ E3 d+ W$ D
  16. * modify it under the terms of the GNU General Public License as
    6 t% Q( L: x6 X( c& G" ]+ E
  17. * published by the Free Software Foundation version 2.
    : X7 @' ~+ I; [3 n6 B4 |9 @. V
  18. *2 j% D7 Z5 g0 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 q' ~/ l8 z. r/ y" C0 U) I0 i
  20. * kind, whether express or implied; without even the implied warranty
    2 Y$ s$ _" w2 t0 n: Z' l8 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: J* o" x6 ]8 E+ ?2 U
  22. * GNU General Public License for more details.
    : z0 b& U/ L& t" T' Q) A6 p; Z* C
  23. */
    " G* z( t- L. ?* A

  24. 2 }& V! h9 f- [: A" N$ K/ u8 h
  25. #include <linux/module.h>. W* c* M7 W. `+ G2 P5 h1 x2 K
  26. #include <linux/init.h>6 F8 p% x9 P) |5 P- `
  27. #include <linux/errno.h>" m. A1 E( p' g
  28. #include <linux/types.h>6 d' y2 }9 L7 Y$ r$ C
  29. #include <linux/interrupt.h>5 O3 P5 s- ^  F+ Z9 u
  30. #include <asm/io.h>9 p! K) I3 n/ q9 }) `
  31. #include <linux/moduleparam.h>* i) `, C. X, @( v& \
  32. #include <linux/sysctl.h>
    ) R5 q& Q% `  u" g1 M6 R
  33. #include <linux/mm.h>2 J- G* S2 x/ w2 _
  34. #include <linux/dma-mapping.h>
    " b5 {, e. ^' F) j( |! l9 L3 X
  35. 6 C$ R( F8 F2 j$ D: H9 N# q. f+ }5 r3 p
  36. #include <mach/memory.h>; A& ^6 o; x! ~- y! @
  37. #include <mach/hardware.h>
    7 N+ D& O, u+ J: l
  38. #include <mach/irqs.h>: ^3 U! W5 ~# P. C  E. t+ P
  39. #include <asm/hardware/edma.h>
    # A1 J) g/ t7 C: I, L+ x

  40. : C+ q- Y6 l/ l: g
  41. #undef EDMA3_DEBUG
    3 e  U7 Y- Z1 x/ B# ?
  42. /*#define EDMA3_DEBUG*/
    ) m; Y" O. ~0 l& R" b" y+ b
  43. * h5 C5 d# e6 a
  44. #ifdef EDMA3_DEBUG
    - P3 H# f5 \7 I- v" ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - z! Y9 o/ `9 y# l0 g3 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; @0 {, H2 h6 v/ e. o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % u( n6 D& j1 k2 g5 X; R
  48. #else' P1 s+ P: K# G6 P, f, @( V2 j' L
  49. #define DMA_PRINTK( x... )! J: ~  V; b  o9 r1 C! n7 g: x$ R
  50. #define DMA_FN_IN, S  i/ F0 h" W
  51. #define DMA_FN_OUT# @' w2 r9 b$ ?! ]4 c8 F+ _
  52. #endif
    7 F7 u8 |% S$ L

  53. + n4 Q9 o7 S( r7 U) A3 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % B, P, b) L! C0 j1 n& E. i8 E' C
  55. #define STATIC_SHIFT                3
    + Z8 x0 R+ Y' V# }
  56. #define TCINTEN_SHIFT               20
    / R6 P$ \* W4 m" h, V. E5 R
  57. #define ITCINTEN_SHIFT              21
    , Z# u. U* r: @2 X# A
  58. #define TCCHEN_SHIFT                22
    : E; X( F7 }3 @% u& @
  59. #define ITCCHEN_SHIFT               23
    - S+ H- q3 W# r& _  |
  60. 8 c* [' C2 ^# ~: i
  61. static volatile int irqraised1 = 0;( o- W- g; d6 g# W1 a
  62. static volatile int irqraised2 = 0;
    / T' w; R6 R7 l

  63. 2 D1 h3 E9 V8 ?0 k2 j. P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! F* d( o3 \* J4 J4 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) R9 P# a! q& G4 v, a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, d% E9 A* V0 P; t

  67. # z/ K: r  O5 z/ j/ d0 E
  68. dma_addr_t dmaphyssrc1 = 0;; I( G& {0 c& n, h" I" }
  69. dma_addr_t dmaphyssrc2 = 0;. w, j/ n9 p; N2 L0 `+ _
  70. dma_addr_t dmaphysdest1 = 0;& R& T6 E; ]5 u5 ^& i
  71. dma_addr_t dmaphysdest2 = 0;2 _) O% W9 Q$ ]4 g- M

  72. , v' }0 V" S4 v; X
  73. char *dmabufsrc1 = NULL;
    5 g) g0 ~1 ~! Y' U5 N
  74. char *dmabufsrc2 = NULL;0 w% B* Z/ X. Q
  75. char *dmabufdest1 = NULL;
    5 u3 Z  ^. o% V/ z6 G+ A
  76. char *dmabufdest2 = NULL;
    3 U" z% l! X0 w. m& _

  77. 4 b4 w: j' a2 |" X
  78. static int acnt = 512;4 e8 K# C5 h" p( C- E. v1 z1 G
  79. static int bcnt = 8;  R! F3 W8 Q) Z. f' f% a4 p4 x6 u
  80. static int ccnt = 8;% s0 _+ D, G" N6 n5 ]1 F% d2 {( _
  81. ' {* ~% V) \! p/ G; w
  82. module_param(acnt, int, S_IRUGO);- q" i2 j. e7 T4 r0 t
  83. module_param(bcnt, int, S_IRUGO);
      X( S. t  G# Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( d2 g& _7 t* L3 I- P% o: r3 i% t; a- u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# F" o9 k5 q  u' c& e# a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 Q: z) _, n. l2 }/ b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' ?/ k6 {% z6 E" @$ s% b2 W& X$ T. ?# N
* s/ X9 U* z' E" r0 V$ P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 23:03 , Processed in 0.038209 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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