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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 l! s& l' z# D* c9 r
  1. [code]EDMA sample test application! L3 w0 X$ H( z% S( C
  2. /*
    # y" c( E+ C* R0 t" t3 k+ m
  3. * edma_test.c8 b2 B  S2 N8 z& J2 c3 K( K) [
  4. *
    / U7 N: R9 b/ y: L3 ?) I
  5. * brief  EDMA3 Test Application% G3 r9 g( k* D/ f: Y, \& K
  6. *
    4 T  y; }* p" P" F4 F5 [- {
  7. *   This file contains EDMA3 Test code.5 j; Q2 c! K' B, u2 l, j
  8. *
    ! o' _1 F) @% h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 t" o% G% m& ]( f% O0 f) y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      C1 J2 P" r( b' C" b6 J' l3 F
  11. *         TO CHANGE.
    ; R: M/ [+ ^; T$ E
  12. *! |# e  C5 x1 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! g$ r% d! e& ~4 p1 K# F
  14. *  h1 L. _; U& x& Z; e; T
  15. * This program is free software; you can redistribute it and/or9 t) s' W3 i# d5 F) K- `) b
  16. * modify it under the terms of the GNU General Public License as! B' d5 L; G% M
  17. * published by the Free Software Foundation version 2.
    - W7 ~3 `$ Q1 p" C
  18. *: y) J& P- @7 E1 R& ?& k! Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . {' M" ^+ P* e7 E2 ^  c6 t% o
  20. * kind, whether express or implied; without even the implied warranty$ {9 V( E' v6 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. W0 @+ Q; {* l3 @$ |0 G8 h
  22. * GNU General Public License for more details.& }1 @9 {) B" I0 O/ x3 x
  23. */
    9 Q- z- t3 _7 q0 c/ R+ k7 m
  24. 3 \& O9 G6 Y- G0 h! @
  25. #include <linux/module.h>
    * [4 c1 v' w2 _7 @% N
  26. #include <linux/init.h>
    + A1 T9 F: L  f2 z
  27. #include <linux/errno.h>2 c  _5 t- W& f7 D8 k; }
  28. #include <linux/types.h>3 h' C! b6 t! H( y1 h; y
  29. #include <linux/interrupt.h>
    + @. z' e. N  t; ?: C
  30. #include <asm/io.h>5 x$ J& U+ v/ h! v- V
  31. #include <linux/moduleparam.h>
    + H; |: z7 B9 ?* B
  32. #include <linux/sysctl.h>9 r7 z2 v+ _% M. K' X8 ?: J
  33. #include <linux/mm.h>
    ) t) f1 i# ]7 T$ M( w; H
  34. #include <linux/dma-mapping.h>
    # X5 u. Q, o3 m* G5 l

  35. 8 W: z' s" R- E* E; L
  36. #include <mach/memory.h>8 R" ]+ F$ v/ ?0 R0 b
  37. #include <mach/hardware.h>
    7 q! j! F3 e  q
  38. #include <mach/irqs.h>
    ' Y# W8 u0 ]. H' x
  39. #include <asm/hardware/edma.h>9 E" r* N9 A( K: d9 p

  40. : K7 E8 M: p4 c+ V
  41. #undef EDMA3_DEBUG
    * ?# B  B6 Q* \
  42. /*#define EDMA3_DEBUG*/8 g" I) h' \1 l' {
  43. 3 U% b1 g+ R& V* `: P# ]0 z
  44. #ifdef EDMA3_DEBUG
    : m1 A! G. [6 N, |8 f% [2 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( I& i; y- }3 z& U2 s  i& @; e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + Y' B* W6 R0 h. g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). H+ E$ J1 [3 h! Y3 L+ `6 _
  48. #else
    * b$ C( {9 P$ |
  49. #define DMA_PRINTK( x... )
    ' D& x  d! I  p% f6 {6 X' Z
  50. #define DMA_FN_IN6 q" V+ Q+ v; c
  51. #define DMA_FN_OUT
    , w5 X- H% n$ O, ~
  52. #endif
    1 w& a- J4 I1 F5 J# g& c) Q/ [4 g

  53. % }, K7 k( j0 y6 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  g  d7 Z% q% w
  55. #define STATIC_SHIFT                3
    2 ?3 {! U; {( l: x' L+ N
  56. #define TCINTEN_SHIFT               20
    ) N3 h2 T! G0 K
  57. #define ITCINTEN_SHIFT              21
    5 ?( X  W: E' H+ x/ A4 @4 G
  58. #define TCCHEN_SHIFT                22
    ; U) j) E, ^1 V. N8 \* N) t! d
  59. #define ITCCHEN_SHIFT               236 Q: k8 x- a+ C9 h1 e/ `
  60. 0 J& V' {! X5 K, h/ V5 r; A" ]
  61. static volatile int irqraised1 = 0;
    # j+ [4 S% @- O  y/ l
  62. static volatile int irqraised2 = 0;6 i2 F8 U* a0 y7 f  x) y6 u

  63. 5 t- v0 l$ Z( p, i* E5 F+ I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , a) y5 E. Z& b, m6 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ {$ I. N) ]/ C- L( q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# {; Q- ?& J* [

  67. & \9 U& ^3 u" T  \3 E" Q2 d
  68. dma_addr_t dmaphyssrc1 = 0;. F- j, f+ e9 ?! ]
  69. dma_addr_t dmaphyssrc2 = 0;6 \# G2 o- q! g8 n7 Y/ q
  70. dma_addr_t dmaphysdest1 = 0;
    6 Y) H0 C& q% I( A7 ^# O- }5 H
  71. dma_addr_t dmaphysdest2 = 0;
    $ e. b# Z0 y: u& a0 Q5 z
  72. " S  B0 M: k& D" l
  73. char *dmabufsrc1 = NULL;
    " e% G( g( v, q; B9 v: A
  74. char *dmabufsrc2 = NULL;; B% T' m- V; D: N7 ], {
  75. char *dmabufdest1 = NULL;+ l1 O4 N8 T: L7 d+ `
  76. char *dmabufdest2 = NULL;
    # o  w6 o2 f. r$ h* i3 i+ e

  77. 2 Q( U. f/ [, o5 d
  78. static int acnt = 512;) Z# V: p5 B) B4 a; U! J
  79. static int bcnt = 8;
    / J0 _4 c- H; q0 x
  80. static int ccnt = 8;
    " _# G% ^) V8 O' T7 g% T. h" Q
  81. ! Z  a8 _" t3 s  o( u5 m0 `
  82. module_param(acnt, int, S_IRUGO);: b9 m  H: D3 B" E9 k
  83. module_param(bcnt, int, S_IRUGO);
    & {' n/ i: `/ @3 `3 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- h# W) S) c) T2 Z6 z
& r7 s/ R) \" N! M& i' u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, u' c+ @8 s4 ]% X* Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ a2 ~) f% ?& t: g( d' _+ \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# B& G) A( j& E  n9 c3 C9 D
. ~8 B1 b7 x6 t5 `' B4 n* s
. z% N% C6 }7 M' k9 ]1 @4 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 12:38 , Processed in 0.039672 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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