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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ R1 U2 y5 Q- Z& \
  1. [code]EDMA sample test application
    % t6 p; K3 `& }4 n3 z, |
  2. /*
    % C/ M( `) q" k, J/ U, |
  3. * edma_test.c, J( P/ o! P4 z0 R
  4. ** F4 P$ P( L/ N0 q/ J1 U) J7 v
  5. * brief  EDMA3 Test Application
    7 n$ k, h) n3 s2 ?3 y* z6 [' b
  6. *
    2 w* p) Y8 a, H
  7. *   This file contains EDMA3 Test code.
    . t% a, O. S: L5 p, T3 V+ O
  8. *# q6 o9 k  h$ G; h: J' V1 R2 C5 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! D" X1 |0 c0 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. w4 M& h8 p  ?0 ]
  11. *         TO CHANGE.# \9 O) [* S% [1 w$ k
  12. *0 ]# ~  @, V* _5 e  e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & B* p1 \" j6 }- {, g  j& r
  14. *, f8 \% Q- P' G8 A1 g/ J/ R/ E
  15. * This program is free software; you can redistribute it and/or
    9 K! n: _6 J& \# n; x; ?
  16. * modify it under the terms of the GNU General Public License as
    : K- ~5 s9 u+ S5 Q4 L9 a$ n
  17. * published by the Free Software Foundation version 2.5 {  |6 z, r6 T5 _3 G; E2 x- V
  18. *0 d, [6 J! n% E2 C$ Y( |; r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 ?6 P2 F. p; c8 u0 J$ R8 ^5 J
  20. * kind, whether express or implied; without even the implied warranty
    & h( e2 _9 y- n! g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 A3 j4 X. h, m( L: e
  22. * GNU General Public License for more details.9 R, i+ z' H3 _5 ~) p) ^+ m
  23. */' z4 k: Y& z* J  s! m2 [5 L
  24. ; n& V. f& J. x) J9 ~; }
  25. #include <linux/module.h>8 L5 S8 V9 t: a/ V! a: `( a  p
  26. #include <linux/init.h>) k9 z& A. l9 |; z. w0 v0 v4 h2 l
  27. #include <linux/errno.h>2 y' M8 i" |1 c. ?6 d9 M
  28. #include <linux/types.h>8 ]( {3 f. u2 K' }3 z7 z
  29. #include <linux/interrupt.h>
    * |9 t0 V5 l4 i) ]5 |8 g% Y+ k
  30. #include <asm/io.h>4 @2 ]( K( n: D5 }  {. U: i9 e: C1 i' t
  31. #include <linux/moduleparam.h>- Y" b7 ]# P7 a) r3 w& M  a
  32. #include <linux/sysctl.h>
    - e6 L8 C! a2 f0 h0 h* a& S
  33. #include <linux/mm.h>. ~2 e9 ~$ \' y- ]* \& U' a
  34. #include <linux/dma-mapping.h>
    * f0 A7 o! N3 a, U4 z! J+ \3 C

  35. 0 T' i& l/ ^5 j4 B* U4 V
  36. #include <mach/memory.h>1 I& j8 |, }; a
  37. #include <mach/hardware.h>
    + e, k, U* u3 |1 H( a$ X1 g
  38. #include <mach/irqs.h>. I5 f3 o3 g" z* U( @/ i0 J
  39. #include <asm/hardware/edma.h>
    , c4 y4 _9 w! U0 P7 J% B
  40. . W1 p/ q# }3 i* K6 H% d: A
  41. #undef EDMA3_DEBUG
      F/ m% c  i0 }' e* u1 |6 h( n
  42. /*#define EDMA3_DEBUG*/1 T  m1 }- S8 S/ j0 o' ]

  43. % b) i% ?* P" T! i0 N; d$ V7 g: t
  44. #ifdef EDMA3_DEBUG5 U. _: ]! B. l1 z7 g% D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; x6 M& z# D: S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) b) P( g8 d8 q( v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 ~0 I1 d. p( V0 V; j2 r& B: V" j
  48. #else3 j. Z- I1 e& @# i2 R
  49. #define DMA_PRINTK( x... )& d  J4 V' c% q. V8 P2 O1 m
  50. #define DMA_FN_IN0 [) }7 x2 S1 x! ~# ]3 |, u. A1 c
  51. #define DMA_FN_OUT
    2 s# @1 f+ x) u, O$ `! L, e3 Q
  52. #endif
    . y  Z7 t4 M, d) F; l( M8 w: V  Z

  53. 5 W3 b# S' ?: B" v! _" X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ z/ s5 ^; f$ q2 L$ E% x
  55. #define STATIC_SHIFT                3' ]; O5 E* g. o- t9 M
  56. #define TCINTEN_SHIFT               202 U" c  Y1 L7 @) ?8 a4 Q; W
  57. #define ITCINTEN_SHIFT              21
    * r7 k4 H7 k  [( i6 a
  58. #define TCCHEN_SHIFT                22
    4 D2 f5 b5 L: q$ Y* @
  59. #define ITCCHEN_SHIFT               237 x/ }: p8 L- U

  60. : Y! U8 |" W# F* l0 @
  61. static volatile int irqraised1 = 0;3 ~) A( Y% A, y* V3 o
  62. static volatile int irqraised2 = 0;6 T) F$ [, m# [" y/ k

  63.   O; T! K8 W2 v. s6 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( m" x# P' a8 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! K: G( h9 K8 m6 ^- K1 I! q' d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 o" q1 U. ?6 U' \/ R
  67. 0 E* @+ ?5 c/ b1 V! Y
  68. dma_addr_t dmaphyssrc1 = 0;- T+ c2 j. L4 u2 M: m! K
  69. dma_addr_t dmaphyssrc2 = 0;
    - w: W4 ~1 p) f2 S3 @- t- |
  70. dma_addr_t dmaphysdest1 = 0;
    6 l5 J' ], Y" p2 Q
  71. dma_addr_t dmaphysdest2 = 0;
    4 D. v/ p" q4 P  |$ P+ a1 r. h# d) R
  72. : k0 y7 j) z6 }" N  C: G
  73. char *dmabufsrc1 = NULL;
    - z; R- q0 p9 [
  74. char *dmabufsrc2 = NULL;
    , D, A. L: h, v0 i' }
  75. char *dmabufdest1 = NULL;  t& s" v# i4 e8 W; l$ p- c+ A
  76. char *dmabufdest2 = NULL;
    - R  c8 K: L) H2 s. M, M% A

  77. 7 b4 Y9 _4 K# t
  78. static int acnt = 512;) c; Q$ l5 a- C% i# [, L7 f% M0 k
  79. static int bcnt = 8;4 B& D4 r1 S  h: ?' ~
  80. static int ccnt = 8;
    # {  K+ s+ S0 _  N. `. w0 D
  81. 4 s) W# w8 L) A
  82. module_param(acnt, int, S_IRUGO);
    ! R6 W% w8 T# F  |
  83. module_param(bcnt, int, S_IRUGO);. X. O7 a  n- l' S1 E) @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& @# p& n; m* e7 F, J
/ V% s3 t5 Y5 K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( F  D/ x5 d  M0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# n9 b/ O$ h. P) l$ K( b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ }  d" A9 B; V9 o

1 \* l5 s5 e% @5 W& o& L! ]/ u* g3 o. o$ z. R2 t! z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 21:00 , Processed in 0.039446 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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