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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . D4 A7 f' s/ j5 a+ r
  1. [code]EDMA sample test application* p& e6 H1 Y  p" R
  2. /*: d' s" Q8 ~2 K$ q" d7 R' g
  3. * edma_test.c5 T2 D' E' w/ n$ L2 B
  4. *
    : @8 e3 R; ^. \5 u( q
  5. * brief  EDMA3 Test Application, ~5 u, n3 C1 N; K# {
  6. *7 z3 g. r1 k$ n/ @# h: O  }& b" a3 i
  7. *   This file contains EDMA3 Test code.
    9 `  H! c' L. i: G9 D) |1 v: E0 M" C
  8. *
    $ t/ l3 ~  h5 P, J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 t' W) _. l* s2 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. E; `* p3 `" @, d# ?1 r. F! u& _
  11. *         TO CHANGE.
    . d* d$ y6 s0 Z5 @8 _0 n6 @
  12. *8 S& z! E. W( n5 S/ o# C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * I7 ^/ [$ d: X. V) a: ~6 z; i
  14. *
    " }* T( i5 l  v
  15. * This program is free software; you can redistribute it and/or
    4 [2 Y6 S; E: |$ k+ `6 t8 W
  16. * modify it under the terms of the GNU General Public License as
    2 [" W- k' A; D" c, m& R5 l0 u
  17. * published by the Free Software Foundation version 2.
    & Q6 L' ]- Q# |0 S$ W( }
  18. */ i) @% p. r1 V! E0 z2 C4 D) A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ X% }0 O1 a8 \5 O0 A8 v# k
  20. * kind, whether express or implied; without even the implied warranty7 R/ ]! b9 N& y. V& {: J; ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 I& l4 w4 O3 r$ i( V) |# W
  22. * GNU General Public License for more details.6 d4 U: d4 ^1 h/ g9 P6 e' A
  23. */& U8 E2 Q/ H. \4 S

  24.   }7 B) v7 K3 r" m0 O; B
  25. #include <linux/module.h>% X  c  k9 _, u8 B3 w: q6 |
  26. #include <linux/init.h>( c: ]' @! E; n# J' S; a. l0 B' m
  27. #include <linux/errno.h>
    3 z% w( w$ g' @) d: X' A! I  \
  28. #include <linux/types.h>
      a( Z0 z: q- {& z6 c
  29. #include <linux/interrupt.h>. N6 ^* S( [" D$ ~$ v7 U
  30. #include <asm/io.h>
    0 T6 |  O7 g) ?& h, x. A
  31. #include <linux/moduleparam.h>* z* {2 T: ~  `; ?( h! c& g
  32. #include <linux/sysctl.h>
    " h$ e& z9 t- Z, M9 T1 h  e8 d5 V5 J
  33. #include <linux/mm.h>
    5 u% W7 E) n/ @% Z3 _6 o0 Q
  34. #include <linux/dma-mapping.h>
    * L5 U( {: F. T/ a- j

  35. / s) Z" `! U0 b) ?/ l4 V
  36. #include <mach/memory.h>
    9 j+ C" s( n# O. M: |  }) y8 y
  37. #include <mach/hardware.h>' X, f' a) f$ a$ o  I  d3 e6 {
  38. #include <mach/irqs.h>) M' l& O7 k) C% ^; r+ I% t
  39. #include <asm/hardware/edma.h>' O$ Q) j+ o2 D4 w0 m/ S( O& ~

  40. 1 x2 `7 D+ r1 f+ D& |
  41. #undef EDMA3_DEBUG; Y$ P8 O8 d1 S, _- u
  42. /*#define EDMA3_DEBUG*/: }. I  P$ a3 \  P

  43. 8 |% u" }/ U* g8 N. I  H+ \
  44. #ifdef EDMA3_DEBUG" y* k. d! h1 @. U! M1 ]# V8 v" `3 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      S# Q0 F* p7 Z  O7 ^9 L7 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' y2 q7 N% |+ X% m& f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ `6 y2 P* s2 L: W6 p, w/ d  f- T" j
  48. #else
    ; h: i% b# O9 y" z, k8 n, j
  49. #define DMA_PRINTK( x... )
    ; Q+ A% ?) n. T0 ~; P
  50. #define DMA_FN_IN
    5 Z, n+ V$ C5 c! b" L  C$ g
  51. #define DMA_FN_OUT5 g/ u! d8 t1 k9 y' k9 K
  52. #endif3 W  |( r. F+ [) N8 b

  53. + J* d9 N1 ]+ d* ~% ?" b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! i1 U, r; a+ Q9 l& X
  55. #define STATIC_SHIFT                3
    & h( `+ p( |) j7 M. Z
  56. #define TCINTEN_SHIFT               20
    - O; L8 k; w- X* K* v3 m: S
  57. #define ITCINTEN_SHIFT              21
    ( o1 ^/ Y- C7 u, f% \. u8 L6 ^
  58. #define TCCHEN_SHIFT                221 V9 K: e; ~8 S& m# o7 p- n
  59. #define ITCCHEN_SHIFT               23: L$ I4 N. e/ ^1 J, T  D5 ?
  60. $ U6 B1 B# y; {7 A2 ~* s
  61. static volatile int irqraised1 = 0;, [+ q: l* \. T* F6 K' M$ j# g
  62. static volatile int irqraised2 = 0;
    % x+ W( u5 t; f6 w: M1 v2 C% J4 k1 U
  63. , c% R  s# c" p1 k" q6 X/ e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " e2 q5 D" |6 K8 \' w/ P, G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ~/ Q8 d2 T' Z9 ^; l8 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- a1 c+ M- }; p$ }

  67. - u* i. O! T* {$ F  j
  68. dma_addr_t dmaphyssrc1 = 0;
    3 z8 ^! z! ?  O. z; E
  69. dma_addr_t dmaphyssrc2 = 0;% m  `4 U* i: H( [4 o
  70. dma_addr_t dmaphysdest1 = 0;
    2 P. K2 n+ n% _  C" T9 O( h' P
  71. dma_addr_t dmaphysdest2 = 0;
    / k3 N5 J. X& \9 x( X
  72. - y3 F2 @, T; G3 ~
  73. char *dmabufsrc1 = NULL;+ |; t$ D- P5 r
  74. char *dmabufsrc2 = NULL;
    7 f! B% c$ O) ]- X
  75. char *dmabufdest1 = NULL;
    ; R8 z5 }3 M% ]) }, l
  76. char *dmabufdest2 = NULL;
    ) }4 L* @& s( j; D6 P, ]4 G

  77. 4 J+ Q$ ~6 u4 z- j4 W
  78. static int acnt = 512;
    ' K" ]! W/ I7 _
  79. static int bcnt = 8;
    , \( {9 r6 H) s) o% N' N0 Q" ^
  80. static int ccnt = 8;5 U) j( |. d  D; G; {# ^
  81.   r5 f# |( b* s, Y! O
  82. module_param(acnt, int, S_IRUGO);
    , h- h9 y2 ~# T5 g
  83. module_param(bcnt, int, S_IRUGO);# Y, @+ V+ O4 O0 S9 ~3 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 z& |" Y  j0 k5 R
) ?9 q8 L1 ?4 B4 ~% \2 r" g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* G0 c: G7 p3 Y' Z! a3 ~3 u  T! H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 I7 W  B8 D% s- n, {+ ~: v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 V4 D7 I% U( k# [

0 h, g: d( y7 n, |
7 r9 g7 g6 e! S" g6 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 14:59 , Processed in 0.041647 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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