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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 H& K8 J6 d5 T! X; @8 `
  1. [code]EDMA sample test application
    , R2 i" R6 v4 s& S3 \5 D: N
  2. /*5 q3 p7 U6 W0 o1 T) R
  3. * edma_test.c3 @6 [- B9 p' e# m
  4. *6 J- a% Z7 ~% L
  5. * brief  EDMA3 Test Application
    & Q& v. Z, r8 _# s
  6. *2 {8 j5 h% W- \" Q2 W& C
  7. *   This file contains EDMA3 Test code.
    ! [3 s* ^7 W; b8 C6 Y9 ^! R
  8. *: g8 E8 |/ o5 j& V, Y* t% v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& g+ d6 H4 u& P& L/ i" A- Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; J/ Z0 f; l* x" i: O: P, @6 V
  11. *         TO CHANGE.* Q' C3 a( ]$ w( o/ E
  12. *
    , s$ T3 W5 d) Y* M3 e) p0 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , A) }0 V) N2 e
  14. *
    + h6 X* M/ |1 @; A9 Y( F7 e+ H
  15. * This program is free software; you can redistribute it and/or
    3 W* Q7 @( Y: T. A4 q
  16. * modify it under the terms of the GNU General Public License as
    5 I! E6 A' t2 J, ^! p; T4 ?
  17. * published by the Free Software Foundation version 2.$ p7 k* [, |- Y) B/ o* O/ C. v
  18. *
    6 `  E4 z9 v4 ^; q/ d% r% c7 }2 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% d& x, k; @, a0 B8 w
  20. * kind, whether express or implied; without even the implied warranty
    " N6 p' k7 I$ p# [; i9 [7 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# y  g5 n; W, h" n+ u( H. p6 p
  22. * GNU General Public License for more details.- l# M& L  q, Z2 P7 P7 _
  23. */
    4 a, i+ M' [, k5 ^2 {+ G0 |- m

  24. 5 P6 p! A9 [1 k3 g$ ]' o' y  L8 m
  25. #include <linux/module.h>
    . [# P% ^% b; z' b/ ]' s
  26. #include <linux/init.h>6 R7 `3 _! w2 C0 c4 h5 r$ L
  27. #include <linux/errno.h>3 p. @# f, g! [" S% j4 I6 F- f) I
  28. #include <linux/types.h>, Y% A& X3 [& n
  29. #include <linux/interrupt.h>
    5 }6 i3 U' s, i; O$ y
  30. #include <asm/io.h>, C4 w5 x. C* C* q* K- u' c5 a& o
  31. #include <linux/moduleparam.h>
    5 _8 y" j! j2 ?  n+ V
  32. #include <linux/sysctl.h>
    * o9 z9 j5 @- q- l! C
  33. #include <linux/mm.h>5 G5 p4 V$ K, D. c" F
  34. #include <linux/dma-mapping.h>
    9 R* W' E! B: V  I1 s/ U

  35. % g$ `# P# S1 _6 t, w3 U
  36. #include <mach/memory.h>1 a# [  m/ o' ~* d
  37. #include <mach/hardware.h>
    % Q. R' Z+ A3 _3 V# Z9 R
  38. #include <mach/irqs.h>
    1 o' X: Z0 r0 z, N# v  ?
  39. #include <asm/hardware/edma.h>& s* Y) T" ]1 F, K

  40. ) O1 P. y! I( ^; p$ ^, p
  41. #undef EDMA3_DEBUG& l; @* p* v2 o, p' s" j
  42. /*#define EDMA3_DEBUG*/- J) A1 N+ w6 t; M" X
  43. ) _4 s! Q9 ?3 u; v4 O
  44. #ifdef EDMA3_DEBUG; u7 w- `1 A; O( _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ E+ O; [" h  S6 P4 x/ C+ b# ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 t0 l4 o+ X' j4 ]+ s$ X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 F+ b2 H- v( w9 }
  48. #else9 a* M2 T8 a! y$ h
  49. #define DMA_PRINTK( x... )9 a) p2 ]) C0 ]; ]
  50. #define DMA_FN_IN
    % m% \7 ]& `' Z$ A% `- x6 K; J7 ]1 ~
  51. #define DMA_FN_OUT7 f' C; B- B* q; E
  52. #endif
    ) ]. m" H5 @1 u# }9 {

  53. 2 q- ~4 ?# C5 T$ d3 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 ^) X2 C8 m$ p2 p
  55. #define STATIC_SHIFT                3+ l( M2 X( s- z% C+ {5 b" @
  56. #define TCINTEN_SHIFT               200 _$ ?% H( A. z9 J' J& {" l
  57. #define ITCINTEN_SHIFT              210 q0 Z: @8 |! p
  58. #define TCCHEN_SHIFT                22  n( t  p2 S0 l+ c0 }& F* N9 p
  59. #define ITCCHEN_SHIFT               23
    1 W( K2 N& j- F( e+ H+ b7 O7 X
  60. 4 d0 L2 F" K, ?- T' x
  61. static volatile int irqraised1 = 0;
    , |* f' y1 X+ h8 M8 N# e( ^" C
  62. static volatile int irqraised2 = 0;" U. y6 E, x& S0 |6 i9 b
  63. 1 k: Y% h& m: [8 H- }) ~1 O' f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ~* Z  J9 u, X4 w4 }: `1 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ?+ R: g9 y8 r! Y9 F$ t% L; L: n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 k; B/ k4 C, Q7 |4 [

  67. 7 h0 m4 u9 q0 z
  68. dma_addr_t dmaphyssrc1 = 0;3 t6 L0 A4 y+ Y9 i
  69. dma_addr_t dmaphyssrc2 = 0;0 J9 q" d$ ?8 G
  70. dma_addr_t dmaphysdest1 = 0;1 u# M! j  @) {, }0 X7 z' k
  71. dma_addr_t dmaphysdest2 = 0;) o! z9 u/ D+ G' I5 `2 J2 e. j- q

  72. , O! z; H% ~/ c  C$ e9 y
  73. char *dmabufsrc1 = NULL;
      p& `( U" ]5 H4 C! z, j( H
  74. char *dmabufsrc2 = NULL;
    ( i+ p. _2 O3 z% B% K
  75. char *dmabufdest1 = NULL;
      m9 _$ \9 e' s0 _. Y$ f  C, {. Z
  76. char *dmabufdest2 = NULL;4 S7 W+ G6 `7 e/ U) d8 R

  77.   P7 R. w/ g+ E8 b2 W3 R! \, [0 l
  78. static int acnt = 512;
    & _. E" ~1 e3 H# d2 o
  79. static int bcnt = 8;: F% D) y  n( t2 e, X0 M% a, J7 x
  80. static int ccnt = 8;; ?5 _" R6 _, {: w

  81. 6 V9 `1 A$ Z' L" u! b( q4 ~, z
  82. module_param(acnt, int, S_IRUGO);
    + `1 i2 {& f6 a- {" `' B+ @
  83. module_param(bcnt, int, S_IRUGO);
    / k" S( Q) {# X; I9 w5 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' M% J7 K& L1 N1 Y  Z9 U* ?
. t. Q. I& G; x# b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 K) r; A  O% }3 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, V" g" g4 X7 K" x- x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 a, d3 Y$ l& k# _$ ]+ z# R: y

' z/ A& E- F: w
5 N6 d3 C7 x9 ]' J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 02:19 , Processed in 0.033658 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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