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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- a( I  M) \2 _( e- B1 A; f
  1. [code]EDMA sample test application
    3 B0 h+ a8 m# ~, b
  2. /*
    / ?0 H% R8 p0 l5 I, L2 D
  3. * edma_test.c% c7 l! J7 B: I
  4. *: D- j  I$ }! F( ^6 I  B  e
  5. * brief  EDMA3 Test Application
    ; t1 Y1 E' j! p8 G: e% n% `
  6. *
    ; G, d" y1 _- b4 z( Q& Q1 B, I* S
  7. *   This file contains EDMA3 Test code.
    7 ~/ v5 A! B$ e  f& @1 w1 p' J
  8. *
    / _* B9 ?8 }& O8 W0 z$ N% k; J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , A% ~, u7 w1 O+ }5 T* h$ d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * h+ T1 s2 v3 v/ {) @
  11. *         TO CHANGE.
    8 X% [: O1 D1 [& C
  12. *1 p- q3 \4 j6 O0 P, Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - z$ |3 F" w  |+ v1 G; `
  14. *2 D9 Y8 `8 z. m
  15. * This program is free software; you can redistribute it and/or' l' k2 {7 }; Z% H% p6 o
  16. * modify it under the terms of the GNU General Public License as% X2 ?8 J; y& u; n
  17. * published by the Free Software Foundation version 2.- f9 F+ z) o8 V( d. L, t$ k
  18. *- u% j7 k" a+ r. n4 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 H; n; a! i) v# I& y
  20. * kind, whether express or implied; without even the implied warranty
    % H0 H' g8 T: T  _% T# a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 L9 o% l% x: t$ x+ K" [6 Q# B
  22. * GNU General Public License for more details.* v% T5 G$ o9 A* ^
  23. */
    : N* k+ \' n: X' h2 W8 A
  24. # F) c9 h& d6 ?  y
  25. #include <linux/module.h>
    - y; o. u( G9 c& O! y
  26. #include <linux/init.h>
    5 ?, q6 s! x* i- L
  27. #include <linux/errno.h>
      z& y' @, F9 G( t2 }4 \
  28. #include <linux/types.h>" Y9 v8 V+ O8 r
  29. #include <linux/interrupt.h>9 l: K3 a% p* k# }( r2 _2 D2 _; e% `
  30. #include <asm/io.h>
    : Q6 \2 v$ D, q3 q9 X* d0 w1 I
  31. #include <linux/moduleparam.h>8 L, k* s8 J7 a9 B( C9 V: b* b3 G+ w6 Y) b
  32. #include <linux/sysctl.h>1 I. ]0 }+ r6 X+ c) r
  33. #include <linux/mm.h>6 V0 y% S# f& l8 V7 [2 g+ e
  34. #include <linux/dma-mapping.h>
    7 f' s/ `5 L, o) k4 I: M) Q) n: w. ?

  35. & Y. k. w5 L& s! Z6 b
  36. #include <mach/memory.h>9 X8 P9 [0 Q, C1 ~* y+ g$ v4 @4 Q
  37. #include <mach/hardware.h>
    * m+ W+ A( {4 U) d7 ]/ a8 _
  38. #include <mach/irqs.h>
    & e4 G0 @! ^7 d; L' c; K
  39. #include <asm/hardware/edma.h>
    2 \  m) u8 Q4 O( ?7 ]2 c

  40. 4 F/ W! i& }9 S
  41. #undef EDMA3_DEBUG
    & l  e; [8 U1 h$ d, h: d
  42. /*#define EDMA3_DEBUG*/
    ' S7 L) Q+ N# a3 H+ F) d( a
  43. ! ]9 I/ Y( [. T5 Q; W' Z) _$ m/ u, d
  44. #ifdef EDMA3_DEBUG
    * f( Z( |! V8 d# o8 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 z' R& f& h8 M- d4 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). Y; Q+ s& |+ X  F9 H9 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) o% M+ L  d) S
  48. #else$ D8 t9 w- o; [1 g- \- z
  49. #define DMA_PRINTK( x... )
    9 o2 k4 c5 L, e
  50. #define DMA_FN_IN+ R% c, z8 q+ k2 S0 V& g* }( F. r8 Q4 D
  51. #define DMA_FN_OUT
    ! U& I3 E; T  M% s
  52. #endif
    * C& h2 W% g$ S

  53. 0 w8 r1 w8 f3 F: r7 N5 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 F7 u3 Y' J" t) f9 G
  55. #define STATIC_SHIFT                3
    ) @, o. l+ f6 ?' Q2 g3 i- }! m
  56. #define TCINTEN_SHIFT               20& Z/ ^; d5 P* d, w% o
  57. #define ITCINTEN_SHIFT              21  F: T4 W+ ?  [
  58. #define TCCHEN_SHIFT                22
    9 r" B" I. q+ p/ l
  59. #define ITCCHEN_SHIFT               23' S) L: y2 |$ C

  60. 7 c9 S( ?, Y1 Y* P: z5 C1 e
  61. static volatile int irqraised1 = 0;! l0 X: W7 g; K, a# K+ g
  62. static volatile int irqraised2 = 0;
    * U3 b+ b" z1 D% K' d
  63. 1 X, M2 q  B- J) Z+ j& _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 E  Z0 a/ |1 U8 l- w' B" g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 t+ g) }1 g3 s5 t' A) K& {  W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) m0 a: F0 F- H
  67. - t- [3 w2 V# v- _, i
  68. dma_addr_t dmaphyssrc1 = 0;
    # h  b$ s) O1 [8 e
  69. dma_addr_t dmaphyssrc2 = 0;: D9 k8 j5 X0 h: y: _9 E
  70. dma_addr_t dmaphysdest1 = 0;7 N7 e8 ~$ n# t* n& ~
  71. dma_addr_t dmaphysdest2 = 0;
    ) b6 Y: `& H) Y1 O/ L/ w( D
  72. 8 B5 d) g' L- g4 B1 c7 W
  73. char *dmabufsrc1 = NULL;
    . G! e0 e- a# }( S9 g) \) }3 S
  74. char *dmabufsrc2 = NULL;- G: }) C  p% r: v
  75. char *dmabufdest1 = NULL;1 s1 J6 |5 s+ t7 K: Y
  76. char *dmabufdest2 = NULL;# K# u' ~5 H; Y3 D8 T* c
  77. 0 Q) g* K( S1 U  h2 K+ |) B6 J
  78. static int acnt = 512;: D0 D% d' e% t9 Z$ A
  79. static int bcnt = 8;
    + D) U% t6 ]& j6 a, f2 Z
  80. static int ccnt = 8;
    , }- F- H' u$ k2 p# w
  81. " z1 L+ C, u4 C# G* h1 d
  82. module_param(acnt, int, S_IRUGO);* p: q. r, A& L& x1 x. j0 b
  83. module_param(bcnt, int, S_IRUGO);
    4 G1 t: T6 f) c0 s5 q! I; e" Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# h/ r; g  }" A
5 g8 z2 ^% J9 Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 a# T2 O- S+ J; R  o1 [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 s! P0 Y. \3 Y  m7 [- M* M; ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 M- B4 _! T/ B& k+ i8 y8 r
; v* k& e( r! Q  Q* W" t
0 y) @) }  i8 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-5 14:50 , Processed in 0.037366 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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