OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& o) Y9 W, a* u4 l$ {
  1. [code]EDMA sample test application
      u! u  |+ q, o8 f# u( N( P
  2. /*
    9 C- X1 A4 E4 m% I5 f+ |
  3. * edma_test.c* N) w0 [* I% W4 S& i4 e7 y
  4. *
    ! c& F: A" c( d
  5. * brief  EDMA3 Test Application
    : `0 Z  n% D8 v, Z" X0 o
  6. *
    ) w/ ]( P% }" v9 n" I! m2 {
  7. *   This file contains EDMA3 Test code.1 s+ I1 X, v. T( |. ?/ ?  q/ f$ s
  8. *- v5 H/ h+ u6 u9 k, `: Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; U- |3 L0 C/ M% b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 h0 t- N0 C* h
  11. *         TO CHANGE.$ R9 Q# j6 a7 s  i/ V/ B
  12. *! t' z. a4 e& i0 G7 {3 C" |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " a. o: z8 g; M+ ?1 `
  14. *! Y  Q5 j, f2 l8 q9 |4 R
  15. * This program is free software; you can redistribute it and/or6 c9 H5 n$ a4 k- v8 w7 g
  16. * modify it under the terms of the GNU General Public License as) k/ [2 O; ~. X) u
  17. * published by the Free Software Foundation version 2.  R0 M) K/ n1 D6 U$ C% I! z8 i* x
  18. *
    ! f6 [0 h& M! ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      j: S9 u, g6 D- c2 Q3 R; I
  20. * kind, whether express or implied; without even the implied warranty' `4 {7 J5 ~' C$ ]: @* `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( i, E0 |8 B; Q5 T2 g9 H  Y
  22. * GNU General Public License for more details.
    + j# U% H8 S' K" h
  23. */: o. y$ D5 P6 K* X' n! [

  24. : f4 q- d% _1 r# L" R
  25. #include <linux/module.h>
    * z! [1 t" P2 u) z  i0 d
  26. #include <linux/init.h>
    : j9 E6 N5 I, u; k  B5 j( ]
  27. #include <linux/errno.h>  k0 @1 M2 k. c$ s& _
  28. #include <linux/types.h>5 X7 [' x: i+ m3 X: r5 J+ L
  29. #include <linux/interrupt.h># @0 x# p) ~, U$ |9 J: d
  30. #include <asm/io.h>
    4 j6 {" b, V- {, U( ?
  31. #include <linux/moduleparam.h>
    / f& Y9 F* K, |+ }* q' E
  32. #include <linux/sysctl.h>2 |$ f/ E, Q* I& _$ G; W' i
  33. #include <linux/mm.h>6 T. K; Q  E& S: q1 t4 K, }% b
  34. #include <linux/dma-mapping.h>  V" q5 ]. b7 @6 R' C8 [( ^1 b9 W1 ^

  35. - W( z  y) a0 X# o/ p9 j1 D
  36. #include <mach/memory.h>7 D4 v( v9 e8 ~/ p; A7 ]+ y0 Q
  37. #include <mach/hardware.h>  x: L- _. M# l% d
  38. #include <mach/irqs.h>
    + s6 K# U& A: ?  ]
  39. #include <asm/hardware/edma.h>
    - Z. v1 x5 G% K! n3 N
  40. ! V9 G  V# t/ |
  41. #undef EDMA3_DEBUG4 w( [1 P. ?: x) @# `
  42. /*#define EDMA3_DEBUG*/# Q2 u8 J& M5 r* L4 i8 U

  43. / T% E9 p" u3 P9 M2 J
  44. #ifdef EDMA3_DEBUG
    ' t! Z  w9 k! [+ x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Z+ l( Y- d" V2 U+ C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ n. H& u# W; i1 K/ D1 f% F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 h/ g4 o2 A  u$ _& l& N
  48. #else' x: V( d" W# ?, z4 z
  49. #define DMA_PRINTK( x... )
    : m* a* @6 R. b6 i5 |# m) b5 m: D8 ?
  50. #define DMA_FN_IN5 f+ ~9 x  N7 e$ \# J# J
  51. #define DMA_FN_OUT
    3 h$ J* t$ `# Y4 k, E
  52. #endif/ J/ G  u7 G3 J/ d* U5 f

  53. 6 T) t% e" q  O- L4 F) `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! W* Z" r( O3 F. M/ M4 U" K  @
  55. #define STATIC_SHIFT                3) H1 l' Z& ]2 c  K$ [( y( p: z
  56. #define TCINTEN_SHIFT               20
    ' G3 Z. b3 Z% r; x- |0 q
  57. #define ITCINTEN_SHIFT              212 P- y. W. I- t$ _7 N9 d9 V9 a
  58. #define TCCHEN_SHIFT                22+ U( d  O2 l+ s. u& o
  59. #define ITCCHEN_SHIFT               23
    7 P+ }" o5 b' H/ ]8 b7 I2 R
  60. + c9 X' ^0 \0 v5 Q8 n
  61. static volatile int irqraised1 = 0;
    # T& p5 \) c7 `) a& r9 [* S9 d
  62. static volatile int irqraised2 = 0;) V9 ?* z6 O6 S3 U8 _: T5 S0 l. n
  63. 3 G8 X" e1 ?9 M. S. \& T" q4 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. A! d% C/ _' Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- b- D" W! j- R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" D# N) T: B/ D

  67. % E' x5 f) h& d. f  O& }: g* ?1 @
  68. dma_addr_t dmaphyssrc1 = 0;1 p2 ]- W! N$ A' c! c
  69. dma_addr_t dmaphyssrc2 = 0;
    4 i$ F. `! e  U( T
  70. dma_addr_t dmaphysdest1 = 0;
    ; m" X/ g. G* Y, I1 e
  71. dma_addr_t dmaphysdest2 = 0;
    / ]% q( R0 K/ n* J( n9 ]

  72. . N  S4 }& z7 Y' J* ?
  73. char *dmabufsrc1 = NULL;7 H1 v$ y! y* T+ z0 K/ J; K
  74. char *dmabufsrc2 = NULL;
    0 n' r+ d& S* [( ?. R, H
  75. char *dmabufdest1 = NULL;0 D5 X) D- q5 ~; }- X" z. \
  76. char *dmabufdest2 = NULL;% s- I$ J- Q5 f( A
  77. ; F) r1 S2 g/ C1 d/ Y' Y
  78. static int acnt = 512;
    * [7 o( Z& }+ ~, M- G4 a; p: {
  79. static int bcnt = 8;
    ) q5 s9 R$ t# `3 u/ L
  80. static int ccnt = 8;; a7 U) _$ C  g; j# Z( t

  81. ' {- b" ]8 ~5 n- R; V, q
  82. module_param(acnt, int, S_IRUGO);
    ; m+ ~* u3 e' l2 e, C8 u( q  s: O
  83. module_param(bcnt, int, S_IRUGO);2 @! I! n3 M; ?; P  \" b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! c- p( S& `7 K) q/ W! \5 b# \% u6 L6 `
; }3 }% Y4 c. ~8 @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 m% r( O& Z1 W& F3 P+ x3 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" c4 R! \$ B( h0 `4 T9 q6 G5 _# ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ y, F5 w2 C1 X- m& [# U9 V" P' ^- i) L+ c! u5 s
' u$ n* X2 p4 M, J/ t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-10-13 23:34 , Processed in 0.038303 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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