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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 ?7 I( ]5 u% g  D
  1. [code]EDMA sample test application
    : V+ P9 n: S$ d6 Z. s
  2. /*/ n/ ^! G, p8 L! V" S
  3. * edma_test.c
    * X5 w0 X- L1 Q' X* r9 O4 I: v3 c# [
  4. *
    ) d7 T0 E* |' y
  5. * brief  EDMA3 Test Application
    ' A4 I" k4 p, @# q
  6. ** f6 G! \* ^* P2 Q% H# G+ a
  7. *   This file contains EDMA3 Test code.6 u1 o( C( f3 @% x6 v/ F
  8. *
    ! [" S1 k" ]% r1 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 }0 L6 N" C; J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. g$ @& |# F6 j( _+ [; v/ S
  11. *         TO CHANGE.& u2 n- X7 Y+ ~6 E
  12. *
    " e: ~' M. F$ E: q1 D/ D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) e8 _/ m# k" W& m! e- q5 z& [
  14. *
    ( [$ w4 q3 }+ B8 X- [( @
  15. * This program is free software; you can redistribute it and/or  M) Z9 w; x7 B0 T1 U; `: h
  16. * modify it under the terms of the GNU General Public License as: K- [4 q6 f8 c6 k2 t6 ^9 |
  17. * published by the Free Software Foundation version 2.
    " w% S! A. W2 q! Y7 `- |0 D8 Q
  18. *. G: l" ?. x0 T) g+ B- z) Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 @: R/ B. a% Y. f
  20. * kind, whether express or implied; without even the implied warranty7 N6 _% x6 M: {8 s0 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 ?) g. j! o/ V& R1 I2 j
  22. * GNU General Public License for more details.
    & X% U$ \2 x# s2 [% G: ?1 K  n
  23. */, G0 S$ @4 O8 |2 I5 S& \
  24. 8 Z$ @* Q  w% e2 s0 l8 w' g6 d) g
  25. #include <linux/module.h>0 [* F# P4 _) n$ G% g
  26. #include <linux/init.h>
    ' ^7 C7 V: N6 @. P
  27. #include <linux/errno.h>- W, Z4 g  j" W, l7 Q. t
  28. #include <linux/types.h>
    ! x9 H: T4 t7 m$ s- \4 N9 S4 S
  29. #include <linux/interrupt.h>
    4 ^! p$ n5 L% m! O2 I4 _
  30. #include <asm/io.h>
    9 \$ A! N' B5 ^) r0 V, |* s$ y( S# t
  31. #include <linux/moduleparam.h>
    ' h* w* g! V3 M/ X1 D, U4 z
  32. #include <linux/sysctl.h>( y3 T) V, T" `6 ]! h) Z: Q& {) P
  33. #include <linux/mm.h>
    . z# W6 y, O9 D& [/ ~- k8 L
  34. #include <linux/dma-mapping.h>
    / Z. h. ~/ k8 C4 q- E) h* @6 U& |0 Z

  35. 2 C6 f, Q) `# g0 Y' \) ]) z
  36. #include <mach/memory.h>
    ( F) @; ^. b/ O6 v
  37. #include <mach/hardware.h>
    ' v8 I0 t0 q  W+ c$ Q* ^
  38. #include <mach/irqs.h>
    + ]  L. Q4 r( `$ G7 h
  39. #include <asm/hardware/edma.h>
    ( r1 o2 f% I- L7 E! {

  40. 0 [- E" e. `2 f0 Q
  41. #undef EDMA3_DEBUG2 ~- z. |9 W- C9 U) @9 E! q
  42. /*#define EDMA3_DEBUG*/
    ( Q5 X) P: j! }: S6 Z) f! \

  43. 3 a0 k7 z! f) F& I+ x  E7 y. ?# q
  44. #ifdef EDMA3_DEBUG, v7 x; D/ E: g4 Y; [4 p" Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 Q9 h! u& b3 _- u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 e  `& H! Z( S! G3 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 J1 B: W8 L1 s
  48. #else, E' ?! x8 Y6 ?' u  G
  49. #define DMA_PRINTK( x... ): B( s5 R* S$ p8 B: d; l7 S& u7 S
  50. #define DMA_FN_IN, j8 ]5 l6 f8 ~6 d0 y) d  |
  51. #define DMA_FN_OUT
    4 f! N0 c$ e- [, ^2 R$ _* a" r7 v$ u' Q
  52. #endif
    5 L/ C# t/ T* R: j8 w6 }
  53. - ]( \  l2 ^+ b0 C0 O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), p  k. X0 t- A& _9 U2 `
  55. #define STATIC_SHIFT                3& Z; E7 k" T3 g1 ^" R
  56. #define TCINTEN_SHIFT               20( C) w5 I. ^2 u2 y* S
  57. #define ITCINTEN_SHIFT              21: ~8 }3 W+ d. w
  58. #define TCCHEN_SHIFT                22
    8 q4 v. \' K/ n
  59. #define ITCCHEN_SHIFT               23! M3 [$ c# V7 w2 q9 O
  60. ( ?8 R' n! q7 ~" O) W4 w% ]! s9 H
  61. static volatile int irqraised1 = 0;
    6 T/ [+ S  g9 ]3 P' n% d" {
  62. static volatile int irqraised2 = 0;
    5 n8 U3 [' E9 s2 s
  63. 2 N+ N4 M7 T: B" A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; O' H* \" M' J3 g6 u' M* u( f* x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      o' J0 a. L% u  v  |( {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! _6 z" P" {) |* n
  67. 0 z' o  l* n, d9 U  y9 V
  68. dma_addr_t dmaphyssrc1 = 0;  B& `1 p# n) f' Q$ L' W
  69. dma_addr_t dmaphyssrc2 = 0;
      f/ P5 Y( x" t* k* h, Y% h
  70. dma_addr_t dmaphysdest1 = 0;. l9 k8 e% r3 I- w: a
  71. dma_addr_t dmaphysdest2 = 0;
    / t; _- |$ [" X& ^3 q/ _

  72. : U1 H- L( u8 g
  73. char *dmabufsrc1 = NULL;; g$ ]4 F1 t+ `& X, O; E" T
  74. char *dmabufsrc2 = NULL;
    ! i! J- j% u8 v' p* ?
  75. char *dmabufdest1 = NULL;
    ; X- M+ @- v% Q6 G7 d
  76. char *dmabufdest2 = NULL;- H6 [' S2 x( ?' }
  77. 7 @/ @) j, X* b9 _
  78. static int acnt = 512;
    5 C8 r$ y( ]3 W+ H, d% c: O
  79. static int bcnt = 8;
    , ]5 g1 }! x! c  ?
  80. static int ccnt = 8;
    1 w  l+ W+ ^( C

  81. 1 f/ h) L  P5 I4 f2 z
  82. module_param(acnt, int, S_IRUGO);
    3 e$ o3 X0 t; E* K
  83. module_param(bcnt, int, S_IRUGO);
    - J' Y+ z7 g$ K. P, T; Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: \* ~" p0 y5 t; K$ |
8 f3 W9 B1 F" F: K2 I: S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ {! P4 j3 n+ e/ M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 N7 `* d" H* A% C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 \" I5 t; K  y
% i" S; l( Z* F" I
2 Q, Y1 ~4 i& m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-1 01:15 , Processed in 0.037234 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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