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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  p6 F3 B/ U3 C" U3 \
  1. [code]EDMA sample test application
    ; K  q/ g  S7 b
  2. /*& I- {' l4 i3 \- @. [* L
  3. * edma_test.c
    ) f. ?- K* B' I, \$ K- I1 j
  4. *
    7 n7 e+ r1 W9 ]5 X- Z
  5. * brief  EDMA3 Test Application- Z2 z1 J/ ]* }. ^, ?& A3 z
  6. *  k" D2 p% q& P) h
  7. *   This file contains EDMA3 Test code.! K2 w5 F; i. k9 }
  8. *
    . B1 K2 e+ b% U2 P6 y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  K$ m- s& }% G' H, a% w. m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  r: H2 X# r( Q: z3 u
  11. *         TO CHANGE.
    3 G- ]  A0 W! q
  12. *
    " E/ t" b5 D: M- S+ z& M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 V# [8 m- T4 Z+ {+ G. [& q8 k& v
  14. *
    / g, A8 J5 @, G& h
  15. * This program is free software; you can redistribute it and/or
    9 D/ l/ l. i2 Z5 _$ g5 ?
  16. * modify it under the terms of the GNU General Public License as% G3 }' z/ L2 K
  17. * published by the Free Software Foundation version 2.
    9 l* o1 C$ c; ^# B& W
  18. *: J9 [' R( V! r( G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! b3 S. M3 I7 d
  20. * kind, whether express or implied; without even the implied warranty6 U, A- L4 r& P5 r% W( P) ]3 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 N* F6 [$ Q$ T. B& I# Z
  22. * GNU General Public License for more details.
    . a/ L2 C' p; @1 N$ a
  23. */
    6 M) T8 o# h% k: f5 f4 W/ q. A/ Z
  24. ) p9 s7 H# t  K3 U, _* ~( O4 t! n
  25. #include <linux/module.h>
      v! D1 `" ^3 N1 K
  26. #include <linux/init.h>3 l6 M6 s+ u- c& F8 [
  27. #include <linux/errno.h>
    & L% l0 U6 N+ S2 \  Z& t
  28. #include <linux/types.h>
    ( W9 U0 h5 b- k* k1 L  h6 o
  29. #include <linux/interrupt.h>
    : m/ O5 g* a) X# h9 i8 c
  30. #include <asm/io.h>
    ; c3 f3 i4 K  o: R  q- \5 ]3 `4 U
  31. #include <linux/moduleparam.h>6 R" D# M$ b# W2 `
  32. #include <linux/sysctl.h>
    ! K% }# t, c/ B3 J  p3 n$ M
  33. #include <linux/mm.h>
    2 k/ Y2 b' R, ]2 y3 Y8 P  i3 O( m
  34. #include <linux/dma-mapping.h>
    8 A# _9 \, S. L3 M2 g7 c1 F- C
  35. 0 H' Q% b$ w, Z6 u! t* V( x% d- q
  36. #include <mach/memory.h>
    ( W% P* @; F$ m8 z7 n# r
  37. #include <mach/hardware.h>
    3 e1 W; u# F* O( T3 V) H
  38. #include <mach/irqs.h>4 a; o# x0 \3 e% A* z0 h( C
  39. #include <asm/hardware/edma.h>( v9 N& p& |2 T$ P, e7 L& a; D- @! R
  40. 5 _" l9 z) H3 K8 r
  41. #undef EDMA3_DEBUG7 _3 W7 r5 r4 N2 I; Q& f
  42. /*#define EDMA3_DEBUG*/8 Y3 M( i$ m" f/ m  r

  43. . w% P3 ?, n0 X3 V: K* L% @% v" m
  44. #ifdef EDMA3_DEBUG8 Q; v0 k9 h2 d) o6 N. w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # `) c  F( O; k' L5 G, d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 D, J9 g$ @9 h" s: c( S$ g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" m. M7 U4 a- u
  48. #else
    4 V0 S2 L% |# V2 b+ W
  49. #define DMA_PRINTK( x... )
    0 g; b8 c+ A9 w% o5 B+ C, N
  50. #define DMA_FN_IN
    " z+ V: L" `$ b+ f; g5 X3 r/ _
  51. #define DMA_FN_OUT
    9 D9 u8 ^. Q4 [/ J7 T! t$ E" s
  52. #endif5 x  i4 I' y! E
  53. ; x  }, B# @& q2 N/ H) X. m2 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + M' X5 X1 }6 E/ o
  55. #define STATIC_SHIFT                3
    ; O. U2 b, ]; R1 f+ I
  56. #define TCINTEN_SHIFT               20
    - O2 J$ L$ P  v; H
  57. #define ITCINTEN_SHIFT              211 o, D; w& i. {3 D
  58. #define TCCHEN_SHIFT                22
    : N" k5 ?/ t8 {9 t9 n9 Q" Y
  59. #define ITCCHEN_SHIFT               23) x& Q7 m6 ~( e5 C7 w( k" V4 ^

  60. & c6 Y! [5 A* U5 _* _8 U6 G" m: a
  61. static volatile int irqraised1 = 0;% d7 D& Q+ ?% ?4 l; {: a1 ^
  62. static volatile int irqraised2 = 0;* q# }' R$ w0 G8 F. x

  63. 9 b3 N; f4 \# r. ?8 @( _4 D# v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! e! r8 q. x/ k5 B: k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 e7 S4 P! B* E0 o$ e7 X( D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & k& g( d( C1 U- i9 y. s# P

  67. - M/ }1 A' @( s% ^& B  P
  68. dma_addr_t dmaphyssrc1 = 0;
    ' X8 P( ]$ h6 a1 u
  69. dma_addr_t dmaphyssrc2 = 0;. u7 f3 M% |- u5 A3 _* B$ T0 A& U
  70. dma_addr_t dmaphysdest1 = 0;
    - M9 K- B0 O3 @- i9 J0 ^
  71. dma_addr_t dmaphysdest2 = 0;: H# D: ?, B  ^4 _3 S

  72. 5 }" @. ?$ s7 c% B8 m* }" `
  73. char *dmabufsrc1 = NULL;" Q2 P3 z2 J7 z6 W4 d
  74. char *dmabufsrc2 = NULL;
    - ^6 o6 Q% p% a2 W' A9 |8 b- f
  75. char *dmabufdest1 = NULL;" y, x& z! y! h/ h
  76. char *dmabufdest2 = NULL;
      x/ b4 f1 \4 G7 S0 J- k
  77. / b' o9 q0 @. _, `8 _7 J3 ]
  78. static int acnt = 512;2 }/ {- {4 v3 n! }
  79. static int bcnt = 8;0 k, O0 R& ]0 o+ Z
  80. static int ccnt = 8;; x. h( W* j1 _2 ~7 _/ Q, S$ s

  81. 1 t" q( \* V7 v4 ]/ [& k# v
  82. module_param(acnt, int, S_IRUGO);1 _! p- S9 h8 L
  83. module_param(bcnt, int, S_IRUGO);  x6 v5 q$ c4 F1 z: O) \9 M) N! g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! Y6 h' P+ @" A

9 W0 S* k4 B/ V  g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ @. u7 b& j6 Y/ Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  B+ z( S: \, z7 T- f, |+ j  |3 X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! v9 H8 _2 b8 _! J; F
  U' ]! f+ w' B' R# @
, ^6 e1 h, B& ~) u( N7 y. F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-10 05:28 , Processed in 0.035897 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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