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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + ]0 L" ^9 [+ o/ p0 w
  1. [code]EDMA sample test application
    8 S$ k7 j( K: G, e$ M6 w
  2. /*- s, ]4 Q1 D  ?
  3. * edma_test.c1 w8 n* y* b9 v4 c) a9 y* _& s
  4. *; t7 T- w. D+ M2 ~* u2 ?
  5. * brief  EDMA3 Test Application
    6 }4 V! y8 J; M, @; w9 C# R+ p* J
  6. *
    ! n, M5 m6 G/ ^
  7. *   This file contains EDMA3 Test code.
    4 l/ E5 C% N: c# s9 F5 K! y" Z' r
  8. *
    % Y1 Y; l$ l- E% U  b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- D2 C: q3 z6 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( x1 S$ Q: `( v7 f; S
  11. *         TO CHANGE.0 X8 n% e/ c: L# g
  12. *
    - q5 H' a! R* t% ^! A3 b5 p7 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& W. P' j7 m) {" J
  14. *
    : Y4 j: H0 [5 Z1 K8 I+ R
  15. * This program is free software; you can redistribute it and/or
    4 z8 l6 R  O4 O8 i' Q3 r; b' A
  16. * modify it under the terms of the GNU General Public License as
    , Y* y$ h5 h( z6 ^# ~3 N9 e
  17. * published by the Free Software Foundation version 2.
    7 f2 n3 G6 s. y( l2 ]
  18. *: W% y  U( b$ s9 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 Z; a. s2 v! g5 S, Q5 o" n7 h
  20. * kind, whether express or implied; without even the implied warranty
    % L( w+ c" @- i* x/ X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ f" y$ Y7 b( C" c, |  x
  22. * GNU General Public License for more details.' c  f, v; ]  `3 Y. b& L. H; ^
  23. */
    ( V3 T  j+ f( {! S" J, i

  24. + ~9 m* R: Y/ m0 {  e8 q. Q5 n
  25. #include <linux/module.h>
    1 Q) K  v$ ?) s6 E( x
  26. #include <linux/init.h>
    ' h/ T, h8 ]* Y# K! I; p
  27. #include <linux/errno.h>
    % A7 L+ D& [3 ^0 W7 R: Y% w8 [2 g
  28. #include <linux/types.h>
    ; K, o- ^+ b0 w
  29. #include <linux/interrupt.h>
    ' d% J& g' K1 x0 i
  30. #include <asm/io.h>
    8 c7 s$ z( _* R' g( L! J
  31. #include <linux/moduleparam.h>
      A, {) ~& [; i  t% A0 n
  32. #include <linux/sysctl.h>9 B7 a! z3 {" w0 Z& Y
  33. #include <linux/mm.h>
    ) G$ `1 m% x+ P3 `/ R9 C7 a
  34. #include <linux/dma-mapping.h>
    3 o& L% V0 ~) k! ^6 S) Q
  35. 1 ^1 N2 {/ y1 W* o& i  R  ?
  36. #include <mach/memory.h>
    . t3 I  X/ ]8 ~% \& [* l, Q
  37. #include <mach/hardware.h>! }% N# \: K+ x
  38. #include <mach/irqs.h>9 G% x9 f' o/ U- y+ h
  39. #include <asm/hardware/edma.h>9 I# n, H8 V$ _$ }; C

  40. ' T" M9 M+ G* L' l# a5 R9 Y
  41. #undef EDMA3_DEBUG, K9 P! {& X% |! P7 A
  42. /*#define EDMA3_DEBUG*/* L- \8 Q1 S$ ?- w0 Z, e

  43. % k0 {1 W2 }5 z
  44. #ifdef EDMA3_DEBUG
    4 j% r9 i6 ]' a( V; j( ]( D# p9 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # Y9 n% Q( c5 p% S8 u) Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 T" h' q& \9 I+ j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# M7 L9 X5 _) Q* S+ B
  48. #else
    ' m; {# x% e- {: d
  49. #define DMA_PRINTK( x... )1 P6 [/ l$ _; ?% a% r) i
  50. #define DMA_FN_IN
    # ^) [1 y# M! x/ w5 g
  51. #define DMA_FN_OUT
    ! R6 H. W- ?* ]
  52. #endif
    ; S5 M( p  w9 H& m
  53. 0 S) _# b0 j( ?& j$ t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * B2 U! J$ l2 p( P* q
  55. #define STATIC_SHIFT                3
    3 R& H- f$ q# i. w  u& v
  56. #define TCINTEN_SHIFT               20
    * G+ ]0 }6 a! x0 h3 \
  57. #define ITCINTEN_SHIFT              21( ?# r  ?* E8 j$ q
  58. #define TCCHEN_SHIFT                225 I) y" l4 \3 C+ a, U
  59. #define ITCCHEN_SHIFT               238 y7 @+ V/ M9 E

  60. ) V2 A6 v( x4 C. }% v5 ~# J/ @
  61. static volatile int irqraised1 = 0;/ L, f: E! M' h4 y0 l& p' ]6 E) z
  62. static volatile int irqraised2 = 0;
    2 B3 G2 O& j5 A$ ]' a
  63. 4 ]- I, g& O) [: A/ X$ }* `0 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ z2 @* ?$ F/ m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* W6 |' i# P; {! `/ t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 k1 q4 R6 H* ^

  67. . C  y5 V6 n# ?! g7 b
  68. dma_addr_t dmaphyssrc1 = 0;) N3 x8 n3 y: e+ \8 f, P
  69. dma_addr_t dmaphyssrc2 = 0;
    3 f: m0 n% F+ O$ p; x
  70. dma_addr_t dmaphysdest1 = 0;
    ! @3 i/ L1 z6 E, b5 O
  71. dma_addr_t dmaphysdest2 = 0;
    / F% W) R- b9 l( O5 M
  72. 0 ?+ k) N" p$ ~9 A0 w3 l+ R
  73. char *dmabufsrc1 = NULL;% W( h; \9 g9 Y5 T( q5 }
  74. char *dmabufsrc2 = NULL;
    & Q) G* u, m* `' D+ M
  75. char *dmabufdest1 = NULL;4 t- t; g2 F9 u' M6 t/ N9 n
  76. char *dmabufdest2 = NULL;
    + V2 T  Z5 t: ?- p/ i4 n' \! B2 t

  77.   G& T7 _$ A$ h% K4 J0 n( W  i& b1 W
  78. static int acnt = 512;1 S. L" {6 N) p
  79. static int bcnt = 8;7 u6 t  i; K) M
  80. static int ccnt = 8;
    ; W- D+ G  @; w5 Z1 c9 ^

  81. 6 Y+ f, a9 V: ]6 g) j- _
  82. module_param(acnt, int, S_IRUGO);; B' ?( J1 d: ]; d8 _5 w7 ^0 R
  83. module_param(bcnt, int, S_IRUGO);8 \; t$ v! b/ f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, V- L  w8 M. F6 e2 ~) }& R

+ Q3 U7 s) D# \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' D( I2 A& E2 K% X9 R4 Z6 sarm-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 R1 F9 p; H7 {- O2 Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 M3 F& X+ q9 X1 [" q0 M6 ]4 v3 y! J  o) W, n
7 a" s! l# o0 s: S. Z: T% @4 F; E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-25 17:13 , Processed in 0.037712 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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