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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) }7 a  b9 ?% f" ^, @/ p
  1. [code]EDMA sample test application( f# @4 o2 O" u
  2. /*6 Z% ]4 ~" A" L, e3 n; k
  3. * edma_test.c
    9 R) V; O+ C. g/ u: H% x
  4. *
    9 J' {0 V4 w! P$ l# O
  5. * brief  EDMA3 Test Application
    ; V! j, t9 Z( O
  6. *
    . F! S) |8 b' h4 H1 e
  7. *   This file contains EDMA3 Test code.
    : i. ?7 f3 i) j# \8 E5 B  ]0 [: K# ^
  8. *% k& m" y( u6 c. {  V! Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ X3 ?- T. _, C4 w/ m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 q0 r2 F9 i" p) D8 v
  11. *         TO CHANGE.
    1 K2 _: h  @3 k
  12. *
    7 L6 ^  G# ?3 c, M  j- l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 t2 S4 K! x8 O* f/ A) G
  14. *
    ; E$ r. o/ L7 i! O% M- |3 |0 \- f
  15. * This program is free software; you can redistribute it and/or
    0 X. k8 R7 M, ^9 i/ t
  16. * modify it under the terms of the GNU General Public License as
    + o( N# N9 H; C
  17. * published by the Free Software Foundation version 2.
    - \9 E& ~0 Q2 c* ^' i+ |, O5 D
  18. *
    ) U& c! C8 {. J9 D/ [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : b+ h6 c6 M. \7 S3 j/ Z
  20. * kind, whether express or implied; without even the implied warranty
    $ j+ ^6 N* D2 [6 U, ?& W8 Z- d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " o7 p& ~/ C& Z* x: `; `
  22. * GNU General Public License for more details.
    4 N. g$ S( B# z. ^' }
  23. */0 `) K+ y* a& z. H7 s

  24. 3 f/ {. Q) \8 L" j  e# c
  25. #include <linux/module.h>
    4 h3 W( C4 s; b' T. a
  26. #include <linux/init.h>
    3 t% K0 I, V+ m! t1 ^9 a, @* A6 k
  27. #include <linux/errno.h>
      w) u! G' b( ]
  28. #include <linux/types.h>
    0 W7 {) s( B" d' u
  29. #include <linux/interrupt.h>
    9 p6 t0 J6 L! g$ c
  30. #include <asm/io.h>
    + D& }- x9 j' n7 W  z) w
  31. #include <linux/moduleparam.h>* m3 H) ^: ~" Z, S
  32. #include <linux/sysctl.h>
    1 }4 L# b0 y- }. Y/ r/ a
  33. #include <linux/mm.h>
    " o- b1 s! Q, }% h& k) j8 Z
  34. #include <linux/dma-mapping.h>- ?7 C- O: j0 h1 N
  35. 2 d$ S. n" t; K! ~
  36. #include <mach/memory.h>
    1 L/ S& Q; {% Z" ]
  37. #include <mach/hardware.h>
    ! @1 J8 `6 S: ]
  38. #include <mach/irqs.h>
    3 B$ J+ F" W  q, {  }: K
  39. #include <asm/hardware/edma.h>
    . w8 L1 E. l' f3 I
  40. " [& S* h, `3 z- R& z0 S/ S' w. C
  41. #undef EDMA3_DEBUG' I( V$ J' M9 f: k, N
  42. /*#define EDMA3_DEBUG*/1 m3 P8 Q2 f7 G  `. q0 R

  43. + S3 n; L! `* g/ X& S
  44. #ifdef EDMA3_DEBUG
    9 |; `6 f$ \1 X4 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 ^1 }$ o' W; W, s$ b* G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & l; ]9 S  c$ q2 y, p7 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' f6 O, q9 {. b9 m# Y! T6 V! G
  48. #else8 h) _! b2 W( T8 k/ H
  49. #define DMA_PRINTK( x... ): B% ~3 H" S$ p' P4 K
  50. #define DMA_FN_IN
    ) l) J; s9 H7 m0 Z+ |! ]
  51. #define DMA_FN_OUT: ^- }" V  `( R5 ]' [
  52. #endif; |/ K+ T. u- V# R5 [

  53. ; C0 `. {& [) @: M2 v: h. \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 b( a) h& d/ V; {3 ]
  55. #define STATIC_SHIFT                3# O% z2 U; n% W' N$ a) f7 }/ Y
  56. #define TCINTEN_SHIFT               203 c0 U5 v* v" c( }6 ^$ Y& n; B) u
  57. #define ITCINTEN_SHIFT              21
    # S$ C* R& x$ [; b+ @
  58. #define TCCHEN_SHIFT                229 w: o# o0 H% ?' |
  59. #define ITCCHEN_SHIFT               235 M  L( f; _9 y: q2 C2 N" T/ ]1 \
  60.   K1 [6 X2 `" C
  61. static volatile int irqraised1 = 0;2 t: R, ^  w1 ~% f
  62. static volatile int irqraised2 = 0;( a! c; X6 P* G+ V( m$ _1 D
  63. % t* c- |1 h7 f4 Y" n% E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 m# m/ y+ A; R+ @/ I: v5 m6 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 D+ |! [# `, o) |6 l& k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! o. [& L- `& D; j. t6 C# r

  67. # a) U9 G3 s4 ]) B1 T
  68. dma_addr_t dmaphyssrc1 = 0;) m: P  w$ r8 k& {. h9 k# I# _8 P/ w
  69. dma_addr_t dmaphyssrc2 = 0;
    / F  g7 L" v& h7 \
  70. dma_addr_t dmaphysdest1 = 0;
    6 c3 C  W  M! I+ k; X
  71. dma_addr_t dmaphysdest2 = 0;5 N8 z% P' O0 ?# o

  72. 2 B1 W0 \. G8 v: f( E) q
  73. char *dmabufsrc1 = NULL;6 O! \; h/ ]3 b
  74. char *dmabufsrc2 = NULL;
    ) ]# l, [8 s- s9 G" @
  75. char *dmabufdest1 = NULL;, R: f& O6 o9 R6 j/ O1 h5 i
  76. char *dmabufdest2 = NULL;( O8 Y! R! e5 |9 I( f
  77. " J4 J4 Y3 y" a4 P) K1 Q" {6 O
  78. static int acnt = 512;
    # l' ], r/ Z( k3 E6 G+ k
  79. static int bcnt = 8;; f- C" D# @; F0 c
  80. static int ccnt = 8;
    ! Y: U' i* A8 @& i' e& P
  81. 9 B2 m- t1 y% t9 @( t* I9 f
  82. module_param(acnt, int, S_IRUGO);
    * C, e% N  K4 M5 z
  83. module_param(bcnt, int, S_IRUGO);
    8 F6 \, X% R4 V+ M8 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; G* Y4 B/ G1 u' E8 P# K# Z

& r7 s6 W. J! U' a: ^( U0 x8 ?! ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 e; Z4 D3 l' h6 y( v9 barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' k% @% s9 r" d4 z/ |4 b! k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( i8 A+ R* `* g1 ?
0 p7 D" o" t9 G8 E* }4 M  P( v

) G. h# o4 v, @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 09:24 , Processed in 0.039609 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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