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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% Q' m2 U2 Y1 _3 s
  1. [code]EDMA sample test application. c6 X3 P3 ^; N. k- F- R; ]! c
  2. /*+ [7 |8 S. F3 B1 Y
  3. * edma_test.c
    ) Y& i* t0 H( O# D: T0 D5 [% ~
  4. *
    4 a* \4 J5 c) _8 [- u4 o, A
  5. * brief  EDMA3 Test Application! g& K+ }" L2 }( l4 A
  6. *
      A& D& E; r$ G3 |- q1 ~" t7 P  O
  7. *   This file contains EDMA3 Test code.0 {( H) S  J, K8 [3 c) Y
  8. *
    $ U: l3 ]" Z" F" C# J2 ~0 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ {3 F# M) B3 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : g8 s6 v* x( e0 x
  11. *         TO CHANGE.
    4 a" A& M- n% _: ?
  12. *
    2 n- s1 s# E, f: H7 [7 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// j) ~2 z% ]9 V
  14. *
    ' s  Q* B9 U/ k( F$ p3 \5 @
  15. * This program is free software; you can redistribute it and/or
    + [9 a; r* v. Z4 P* G
  16. * modify it under the terms of the GNU General Public License as* o# a" b7 b! m
  17. * published by the Free Software Foundation version 2.
    5 x+ C# E. V, x1 x$ H1 z
  18. *
    : f3 @  {5 e, e: D6 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ R; @& f) b" d
  20. * kind, whether express or implied; without even the implied warranty
    2 d( W$ o  J* t$ d9 W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; e7 Q1 D& U- i6 C6 T( y# D  b8 n2 Z
  22. * GNU General Public License for more details.5 Z. C' s; B* Q: v
  23. */# J: [5 k4 `" V$ U4 G/ h
  24. 5 |8 x! s1 [) o; `) b) w$ L
  25. #include <linux/module.h>0 ]2 n; J. S; Y+ Y% p( J1 Z
  26. #include <linux/init.h>
    9 v$ h7 E3 i# Z' H
  27. #include <linux/errno.h>0 R7 r# B5 H! ~! a
  28. #include <linux/types.h>
    ! g( @( N0 Z  ~) x* h
  29. #include <linux/interrupt.h>1 j3 r. I* k: x# `/ V7 W" r
  30. #include <asm/io.h>! j6 i' o* B" e2 t9 B
  31. #include <linux/moduleparam.h>5 m* [( h8 O: U* Z) R( y
  32. #include <linux/sysctl.h>
    . g8 X4 z$ |& }9 f: J* p
  33. #include <linux/mm.h>- i0 q3 W( k$ a9 Z' `2 U
  34. #include <linux/dma-mapping.h>8 X: h5 Z6 `& v
  35. $ t. m* o; D& O" o5 ]- {+ W
  36. #include <mach/memory.h>3 m9 `! k2 a6 R
  37. #include <mach/hardware.h>" B( _. U3 S+ Q3 p
  38. #include <mach/irqs.h>
    8 U% u6 q/ S/ g0 e  P2 b/ G4 Z- `" a, [* Y
  39. #include <asm/hardware/edma.h>
    : x, |5 s3 y' R9 @
  40. % M5 `$ H0 H; a0 o/ L) w/ J
  41. #undef EDMA3_DEBUG# {1 o; C* U: q0 R" d
  42. /*#define EDMA3_DEBUG*/
    6 {9 q0 N7 e' m7 H8 q
  43. 8 Z+ S  L; t" F, b9 d( H
  44. #ifdef EDMA3_DEBUG* ^2 o1 b6 t. p" C' r! r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 `' T& x2 T7 I7 }- u7 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 g( l- W8 E  E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 [) z& e' J5 I- d' U- ~
  48. #else
    1 m$ g; c! k' z7 M6 f$ ~! y- I
  49. #define DMA_PRINTK( x... )2 n9 A$ @# u  {! y
  50. #define DMA_FN_IN
    ! w" B6 O. l" ]7 y" r. [) {5 w
  51. #define DMA_FN_OUT9 O7 H0 Q( m/ C; @
  52. #endif
    * F$ D" K2 l7 b/ ~: _9 p

  53. ; P9 E/ r/ ~7 s' F+ f6 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  j5 G; P7 M8 @9 _* o% f
  55. #define STATIC_SHIFT                3
      o$ L8 x9 G) w- I+ J
  56. #define TCINTEN_SHIFT               20" u. _; M. g5 K7 H6 A6 {
  57. #define ITCINTEN_SHIFT              214 a  G; B5 f! X
  58. #define TCCHEN_SHIFT                22
    $ ~- Q: n, S. S0 u9 y
  59. #define ITCCHEN_SHIFT               23
    " [+ Z  g& a* D! c& e

  60. , T1 Q: u: s" q2 X, t; W
  61. static volatile int irqraised1 = 0;
    % r, c9 D3 W3 e2 a2 r
  62. static volatile int irqraised2 = 0;' B% Y% h0 t. S* H
  63. : M5 e/ [7 R, P; h- o9 J7 @# T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. b5 a0 R% w# y# {% k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 l) a1 m7 J( n- g0 T; r4 ]# h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 L' \4 k, ^7 W3 O
  67. 2 i4 R0 O/ [0 u% ~
  68. dma_addr_t dmaphyssrc1 = 0;* g" i$ r; b, J  l6 p0 d( `  m
  69. dma_addr_t dmaphyssrc2 = 0;0 g+ F. h# F! }+ N% E
  70. dma_addr_t dmaphysdest1 = 0;9 Z  ]5 P9 x2 T0 R4 [
  71. dma_addr_t dmaphysdest2 = 0;+ K$ z- h  ]9 M. [. L3 N4 a

  72. ; p& Q( X  y$ z8 |! h7 \
  73. char *dmabufsrc1 = NULL;: [. f. e( h, R/ D/ a/ h3 f
  74. char *dmabufsrc2 = NULL;' I0 X- c+ B2 B7 r8 N" Z
  75. char *dmabufdest1 = NULL;6 V8 v- S) a; z+ n  x( G  I* ?% s
  76. char *dmabufdest2 = NULL;3 Q9 W3 z2 a, L9 i, f) z+ _
  77. 6 n; [. @0 k8 }: q5 Y
  78. static int acnt = 512;/ n3 _- K9 o1 C$ [
  79. static int bcnt = 8;
    / X3 i- r& d9 {9 O7 r
  80. static int ccnt = 8;+ b9 R- C) n6 v& Z0 k

  81. - q% i7 ?4 r: N0 d$ V+ W6 u6 X/ ?
  82. module_param(acnt, int, S_IRUGO);
    1 F: c+ P. w6 T1 r+ s1 p$ `
  83. module_param(bcnt, int, S_IRUGO);
      N. \% w. o0 Q% f& T2 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 d% R& _4 S5 P. g$ h9 E7 f8 M" e
/ j6 e* f& D) W9 X9 M/ b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- K) M0 D9 k/ G3 U
arm-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; p' ?( `- a- O, o$ O2 ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) y5 v0 v, t8 W' V
! z2 p/ l9 _" p" }
7 a; M: `5 `2 ?5 g, m" z. z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 21:27 , Processed in 0.044924 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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