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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- S+ G; b: _( J7 }3 k9 d
  1. [code]EDMA sample test application2 a' s. B* ~/ o& \+ b
  2. /*
      _: ^3 X1 T: T
  3. * edma_test.c/ Z8 [2 n7 b$ j8 \, ?. G6 o
  4. *
      H0 \$ |# y$ ~7 Z3 n' }
  5. * brief  EDMA3 Test Application
    # Z, x5 f* D" H
  6. *
    0 o. K7 t& ?7 S) ]0 g" T
  7. *   This file contains EDMA3 Test code.
    ! t" V" g5 m+ ?6 _% S1 }
  8. *; B" F' `5 r: i1 `4 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* j; N4 K0 I* Y* R% u# k$ X1 P! ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; u) K4 A3 a& s
  11. *         TO CHANGE.# i% i2 _0 z; ]
  12. *2 V7 `( z6 _) p7 D2 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 H$ \& ?- F9 r% E/ O6 P1 {+ m1 B
  14. *
    4 G+ r3 I9 X, @/ h
  15. * This program is free software; you can redistribute it and/or5 Z4 m1 l( z0 |% X% O6 |
  16. * modify it under the terms of the GNU General Public License as
    / A1 h8 B1 t0 a2 }8 t, J0 W1 l
  17. * published by the Free Software Foundation version 2.- P* j+ z& ]; f! d$ r' W/ w
  18. *. p0 {  H/ w9 Q% X! h( C3 M% u! s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / {+ o& Z  i8 Z5 S0 e2 g5 S8 _
  20. * kind, whether express or implied; without even the implied warranty
    ' w  m* D! k0 N' V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ V+ \4 ]( x+ \" i4 u
  22. * GNU General Public License for more details.. F, x5 v. [. v! o' V; {  w1 K4 z4 P
  23. */
    , H+ L" M! P. p. C

  24. 2 [: ^- h  x7 ^
  25. #include <linux/module.h>3 H: k+ }' |' D! z8 V8 U
  26. #include <linux/init.h>5 v7 w5 o0 h, e" Z
  27. #include <linux/errno.h># x  m1 w$ q6 }/ E3 L. C
  28. #include <linux/types.h>$ D; @& K9 z3 K. W# D" I
  29. #include <linux/interrupt.h>
    6 v+ ]9 H( H& a. P
  30. #include <asm/io.h>& a; G5 G7 L3 n& _1 V+ H% A2 l9 w  g
  31. #include <linux/moduleparam.h>) Q3 f7 K5 _3 j
  32. #include <linux/sysctl.h>: d6 c* t2 w' E$ B/ ~
  33. #include <linux/mm.h>
    8 i+ S) c2 @3 I  C; J7 C
  34. #include <linux/dma-mapping.h>' y( Q$ Y5 R5 X5 ?3 ?

  35. ) V7 W. |, V' h6 ~) Y) j9 b
  36. #include <mach/memory.h># P5 Q& O- H: e7 Q" `# T8 \4 ~
  37. #include <mach/hardware.h>, q+ F4 f0 d  J' g9 L/ t2 \
  38. #include <mach/irqs.h>
    + k+ q' F6 E9 l
  39. #include <asm/hardware/edma.h># B8 y. m. u9 v0 R
  40. % \, w9 W% I! T6 [
  41. #undef EDMA3_DEBUG
      z/ i6 E6 W2 @
  42. /*#define EDMA3_DEBUG*/5 H+ I2 m& ^: u# t
  43. % p! g5 q! Y7 i2 c; _
  44. #ifdef EDMA3_DEBUG% Z* }! _5 i0 x" P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 ?, l) N9 J9 l& T, I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). \1 {$ {; F0 \+ k5 f" J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ C7 \9 p& s+ t) \& }
  48. #else6 s  K% F  X5 Y' P
  49. #define DMA_PRINTK( x... )
    " ~  h  H3 s/ N" ~6 M
  50. #define DMA_FN_IN( ?$ T: a8 ~' N0 d
  51. #define DMA_FN_OUT
    . `' d/ C6 o& Q" B) z- M( E8 f! E
  52. #endif: Q3 x: M1 M7 J6 l7 T

  53. 7 p  ?) x7 b! p. x" _" Y* |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' I  V/ D& \$ G) S" u
  55. #define STATIC_SHIFT                3# ?& S$ F: k' s8 d0 g
  56. #define TCINTEN_SHIFT               20
    % q" l& R# c# o, f2 Y' o
  57. #define ITCINTEN_SHIFT              21
    - v% X* Q5 M: x  V# T( [
  58. #define TCCHEN_SHIFT                22
    ( ^# M- O1 r. h' O; }
  59. #define ITCCHEN_SHIFT               235 m5 O( \7 \$ t* ]8 J

  60. 3 x$ T0 U6 A. q0 Z7 T$ K
  61. static volatile int irqraised1 = 0;
    - ^2 j, E# N" j2 W; _  K
  62. static volatile int irqraised2 = 0;
    9 F9 n. U. ^4 F' d+ U+ j

  63. ) U6 U! Q# A* ^4 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 R: }9 {, K6 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 N$ E" @% u# M- N) Y. s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * }) r3 V$ v& g: i5 J
  67. & Q( `, s& ^7 E" K  \$ ~& t( m+ O
  68. dma_addr_t dmaphyssrc1 = 0;6 o9 l( {7 F; w8 W7 k
  69. dma_addr_t dmaphyssrc2 = 0;
    - h% O( e" `, a) Z! B" L4 R" ?
  70. dma_addr_t dmaphysdest1 = 0;) g  v8 E2 [& g, @
  71. dma_addr_t dmaphysdest2 = 0;* P7 P) S/ D  C$ b/ z

  72. : t1 c- x5 I3 K- o& D3 W* `
  73. char *dmabufsrc1 = NULL;
    . Y$ n) ?  D+ n
  74. char *dmabufsrc2 = NULL;( Y0 o" o6 S3 U. c
  75. char *dmabufdest1 = NULL;
    ! L7 {! X  `. _
  76. char *dmabufdest2 = NULL;
    / O& h7 M# q* a, ~9 u; W
  77. $ H+ U# Z; O) c$ N' E# q& z
  78. static int acnt = 512;; e' a2 _/ ^9 M" g3 T% J2 E
  79. static int bcnt = 8;
    # v" n6 O6 w8 ~" z* x: Y, F# Z& o
  80. static int ccnt = 8;7 [% @6 k, a& X$ B0 _3 h1 `

  81. 4 v3 E7 @. O% R  J3 E7 ?* A
  82. module_param(acnt, int, S_IRUGO);
      A8 j: s2 p+ ]8 N1 [, k
  83. module_param(bcnt, int, S_IRUGO);, d3 J. _2 h# F$ Z, s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! A4 p0 b+ L: E9 s& U& [# Y, R' n, _) b, D' b& O1 r5 a1 n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  T% W& i+ p' j' J$ Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" O( `1 f  U0 ]/ ^: y* R7 W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 C$ o, S) K7 H, T0 W
: g( s/ W9 W# }0 g1 T6 r* ^% f
$ h5 D1 j2 `$ w  ~4 r, c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 05:12 , Processed in 0.047397 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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