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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: S5 r9 ?% b) b8 c: w0 }" {6 [
  1. [code]EDMA sample test application/ z8 J2 H/ A4 ]" ]! H
  2. /*
    ; T# u7 K6 i) g' J5 A3 k
  3. * edma_test.c
      a' d7 }2 |. \
  4. *
    8 j, _/ U3 l# L4 s
  5. * brief  EDMA3 Test Application
    & X$ s8 i# u1 [3 v
  6. *
    , {$ [1 v( _" N* |: {3 u" K7 i
  7. *   This file contains EDMA3 Test code.
    ' _% a. A2 ]! Y( \0 p# L
  8. *
    8 L+ D: b) {  z2 }; Q& ]; d7 ]1 U4 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, G4 r5 E2 W' _& @# ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , N# g) }: A* K8 H8 t- o- e  Z
  11. *         TO CHANGE.
    . F. l! j* n; T" {) k- z5 b* H* |6 y! }) ?
  12. *
    2 `4 @* c: D/ }+ @2 c2 N  V  q, ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' ~7 `4 [: l. }
  14. *1 H) d4 c. ~, ?- E5 e# }& m
  15. * This program is free software; you can redistribute it and/or
    : Y* T, ~$ J; [( Y( U$ k
  16. * modify it under the terms of the GNU General Public License as
    . e( O; {, {5 Z* |& U( t0 |6 T
  17. * published by the Free Software Foundation version 2.
    1 i0 |( w! {& r* |* G
  18. *
    0 p( [# H8 \$ R4 W# H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  }; o+ R7 P  R7 A( F$ T& P5 x
  20. * kind, whether express or implied; without even the implied warranty
    ( f5 _, K) |- q+ u/ ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 V7 m9 L7 r9 q& g) R7 u
  22. * GNU General Public License for more details.
    , @. H- ^" ]0 M9 h4 Q; j+ C3 h
  23. */4 z! J  ~( ?# d9 h$ `: G8 R
  24. / V7 a0 A! ]& c- d  O$ M' b
  25. #include <linux/module.h>
    ' h% Y, a+ q* B5 j9 _% O7 K
  26. #include <linux/init.h>
    : F& N4 N. ?: E( i4 |& Y% _
  27. #include <linux/errno.h>
    7 J6 b: C, t: w. z1 E# o& n! R# I+ W% U
  28. #include <linux/types.h>
    7 A$ m, E: ?: z8 P% W7 `8 c% ~
  29. #include <linux/interrupt.h>
    $ E6 c# Z' d$ C
  30. #include <asm/io.h>
    8 s; H6 H2 X: [9 k4 Y0 R7 w0 u
  31. #include <linux/moduleparam.h>
    1 o, ^9 n  C; E) j: |7 b: z
  32. #include <linux/sysctl.h>
    9 A& g3 G7 y# _0 |9 l0 G
  33. #include <linux/mm.h>" q$ C9 f# {, o2 w8 G% W
  34. #include <linux/dma-mapping.h>1 E8 ~6 p# r1 P# ]4 c# s# ?

  35. % w- W( b; H, ~4 p7 K5 ~! H
  36. #include <mach/memory.h>* B/ K7 s" K" {# I- s- P
  37. #include <mach/hardware.h>
    4 Q( V. s! J4 H
  38. #include <mach/irqs.h>8 [7 {5 L5 u. z
  39. #include <asm/hardware/edma.h>5 v' x- d& z: g+ r
  40. 1 ]" }; i& l, _* ~
  41. #undef EDMA3_DEBUG
    8 V3 I, y; o  A. o' h7 w" f2 s
  42. /*#define EDMA3_DEBUG*/2 v& G6 [" o5 H* _/ m# i

  43. 3 O1 U1 Y) X) R6 `( L
  44. #ifdef EDMA3_DEBUG
    ( q" h1 K5 O1 k' [9 R# w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 S, d/ ^: B# v) P, p. B9 A" n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( _; i( T2 ~; P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ @: y1 Q7 W1 ^' ^
  48. #else
    0 c. l7 t& I8 F  K: Z1 q
  49. #define DMA_PRINTK( x... )5 a8 f. Z3 B. ^
  50. #define DMA_FN_IN; `7 y+ v' I  P  ]% F
  51. #define DMA_FN_OUT, m' V3 j4 I2 h1 E2 E7 _
  52. #endif
    % k$ @6 a8 P; E. e( i8 ]% k

  53. $ w2 `9 O# {! m% L5 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  E0 X; C" Q% j  z; K' a
  55. #define STATIC_SHIFT                3
    . `6 D" N# X6 d6 o* H9 w2 `  G. p
  56. #define TCINTEN_SHIFT               20
    ; P. k6 E/ ?% _+ O1 @  Z6 U* p
  57. #define ITCINTEN_SHIFT              21
    # F  @$ G/ A3 A2 ?
  58. #define TCCHEN_SHIFT                22
    ) B! w- k, H. T- R
  59. #define ITCCHEN_SHIFT               23$ @: a7 W* a- \$ x
  60. 2 @/ |0 T8 ^0 H5 @% G( I
  61. static volatile int irqraised1 = 0;! I6 l2 ^  I9 h2 t$ s7 Q
  62. static volatile int irqraised2 = 0;7 ]; @+ _. D) \  H) [0 {# G) W

  63. ' W+ \4 n3 N6 f0 B& f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; w$ v! U" |; T6 Q/ Z% L  {# r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + D1 p& h3 P; d8 i0 g# i& d* @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " B. v' i# m+ \
  67. : N; F7 g5 D  O$ \, ?! b7 `6 t
  68. dma_addr_t dmaphyssrc1 = 0;8 _) J# w# h+ _- Q% f9 T0 j
  69. dma_addr_t dmaphyssrc2 = 0;6 ]4 ]% Z9 q0 u* t" [7 b, v  v, v
  70. dma_addr_t dmaphysdest1 = 0;- j2 \+ T! l, H7 @" j8 S; f' W
  71. dma_addr_t dmaphysdest2 = 0;/ W" b0 S1 S+ F4 B4 f: p

  72. & T9 X3 l+ {5 e  m+ p' i! F
  73. char *dmabufsrc1 = NULL;0 `# t& g# \5 o2 H; l% R& l
  74. char *dmabufsrc2 = NULL;1 I1 R7 E4 @% {* R1 w
  75. char *dmabufdest1 = NULL;
    % M5 h" p( p' [5 _
  76. char *dmabufdest2 = NULL;/ E% u0 H: Y9 K1 J: C8 I; p
  77. ' o0 G- z& J5 i( W. U
  78. static int acnt = 512;
    ) j9 L$ J  x0 _" G  [+ B) \  _( R
  79. static int bcnt = 8;
    # I# e! K, e2 ]$ y
  80. static int ccnt = 8;# v$ i( W4 P% V, K6 L5 l$ f
  81. ; a, }: y: r4 n2 }
  82. module_param(acnt, int, S_IRUGO);$ n& L0 S! o7 n1 ~# a5 e8 I
  83. module_param(bcnt, int, S_IRUGO);
    $ S1 m9 Y8 e7 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 l0 y2 n. I1 k; E( d2 U) N6 i% h+ {6 ^. l0 S3 a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 [6 b* _8 A$ Y. I; I! G1 h2 C. _
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 O9 D( W* L+ z* U- s# H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! s( X; N8 ~6 H5 T( h
, Q4 k- V8 Y9 [$ `4 D8 l

& a  J( q2 K/ b! j" ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 21:31 , Processed in 0.038021 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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