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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 u- H9 a: @8 _( K
  1. [code]EDMA sample test application
    / K$ G- u9 F. |
  2. /*  l* u3 H3 q6 @) E
  3. * edma_test.c
    2 i  j; a( M5 w' g. m) Z  f5 l
  4. ** e3 O; \( o" ~# J+ E, ~8 G/ ^0 W2 M
  5. * brief  EDMA3 Test Application
    7 |' N3 A5 |. |) r! `
  6. *
    8 I2 U. o) W& M) M8 |5 O
  7. *   This file contains EDMA3 Test code.
    : a5 q" `  ]  a
  8. *8 k) g) X) K% j0 ~' v2 P7 H: k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - b' T- {5 }# B! h2 N; v3 `0 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ S/ E& F7 b0 e% O
  11. *         TO CHANGE.
    + ~0 w4 T- W% z8 I1 k, r
  12. *4 s" X+ w! t8 ^% k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 C5 E0 ]+ B& j$ a3 ]
  14. *: O7 b7 A8 G' ~5 m- O$ Q
  15. * This program is free software; you can redistribute it and/or
    * d. z: t, r5 `/ s8 v
  16. * modify it under the terms of the GNU General Public License as
    ; \1 A8 ^4 c) M
  17. * published by the Free Software Foundation version 2.& b2 n2 d: n4 t
  18. *
    ' T( o. ~; y& S5 H, l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& x& Q; D/ C1 w9 l6 I$ W8 W
  20. * kind, whether express or implied; without even the implied warranty
    1 N' c8 E) L$ s" f) E! F, a# V& `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 K3 x$ b1 s% {; r/ D7 R9 t5 i6 u* U
  22. * GNU General Public License for more details.) b+ U) O/ _0 ~) `
  23. */8 X- H8 K9 ~1 T7 r
  24. 4 z0 @* v0 @. c& _4 i' [
  25. #include <linux/module.h>- ~5 j8 f* `4 c1 z1 P9 T
  26. #include <linux/init.h>
    8 |% j: A2 h6 I* y1 _
  27. #include <linux/errno.h>) F, y5 C$ u( B+ ?2 Q
  28. #include <linux/types.h>& A( ~9 x. S1 u( l  V5 b; b
  29. #include <linux/interrupt.h>0 _# p- P$ A' S
  30. #include <asm/io.h>0 A  G" N3 n; Q! I! U. t4 F- b
  31. #include <linux/moduleparam.h>/ T! y$ `, i7 i! m
  32. #include <linux/sysctl.h>8 X/ |3 \& a5 g, x/ K
  33. #include <linux/mm.h>
    3 k; w! Y8 M+ c" w
  34. #include <linux/dma-mapping.h>
    6 F3 |+ ?. a, ]! E; ]

  35. ' d# C# g$ k5 f9 [: M/ r0 K
  36. #include <mach/memory.h>0 S& ]! G6 B# }: j# D  i6 I& T8 L
  37. #include <mach/hardware.h>
    0 e+ |- X- N3 f" S& ~
  38. #include <mach/irqs.h>
    * d$ C1 o5 U) L
  39. #include <asm/hardware/edma.h>
    . h; ?3 F* m/ l5 G% o4 G2 v3 s

  40. " x9 k% ^, c) u
  41. #undef EDMA3_DEBUG
    + C* ^* a1 K( I7 `, z% Q4 q6 e1 ]
  42. /*#define EDMA3_DEBUG*/
    . ^7 s% H) s+ ^

  43.   b) ?( ~$ Y8 `  h' a5 r( F
  44. #ifdef EDMA3_DEBUG8 s/ y" F3 P( Y$ @, n) j0 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " K9 i  S+ U9 N- u: l# Z* l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : _. o- ~) I- P( C1 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# x  U8 }: ]/ `% D
  48. #else
    3 K) H0 Z  p1 U' K; J
  49. #define DMA_PRINTK( x... )
    , Q' P; V5 n7 O4 I" F
  50. #define DMA_FN_IN
    ) s+ a6 c7 i  Q  U3 C/ |
  51. #define DMA_FN_OUT. e1 q+ i1 W9 a! L
  52. #endif
    " B" X% s6 }) [9 b0 F9 m
  53. ( a. z" B, {8 l4 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 z- J5 `1 U2 a- q" Z
  55. #define STATIC_SHIFT                3
    ( Q' B" |8 g/ p
  56. #define TCINTEN_SHIFT               20
    % k3 z9 }" C4 H
  57. #define ITCINTEN_SHIFT              21' y8 L/ B: C! A* h5 y( L
  58. #define TCCHEN_SHIFT                22! _( d" x9 t" x. i8 {3 C
  59. #define ITCCHEN_SHIFT               23
    # ~8 I: v! @0 m8 }7 L0 a, ]6 D

  60. % I/ V, y# A. J% C7 f8 X2 ^% ]
  61. static volatile int irqraised1 = 0;
    8 Z! a, t6 @3 a2 `6 P& s
  62. static volatile int irqraised2 = 0;' ~8 r% U* K/ b" D
  63. ; P4 H$ B8 g2 Y; @. b2 E  y* ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ]9 n0 h1 ]; H2 i) U) q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 x0 L; C. i* V2 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Q4 O% b& S) Z* q/ ~
  67. ( \; Q' l; r. _5 t: r1 A( G9 \+ _5 H( w
  68. dma_addr_t dmaphyssrc1 = 0;5 r' x& I+ _* D! o3 C0 k9 D
  69. dma_addr_t dmaphyssrc2 = 0;
    * e) b  J4 _  R7 j9 H( B+ W5 ]/ |2 Q
  70. dma_addr_t dmaphysdest1 = 0;
    1 O& e9 P5 O- y8 H
  71. dma_addr_t dmaphysdest2 = 0;  X) \. q* J$ x3 v5 E
  72. ; e( t7 R- i% o5 i% J# l
  73. char *dmabufsrc1 = NULL;  k3 T5 f7 [9 I
  74. char *dmabufsrc2 = NULL;
    ; h" k& h1 M' B. f5 S. k9 U. U
  75. char *dmabufdest1 = NULL;
    * L/ B" n* T( \3 Y& D
  76. char *dmabufdest2 = NULL;2 I" F, A' \+ x. \$ ~
  77. + {0 n( W9 L+ g/ N
  78. static int acnt = 512;; s; F' n/ `- C# G" I
  79. static int bcnt = 8;
    % \) a4 E7 G; n. w  _
  80. static int ccnt = 8;7 |: G- F. D/ w  h& c

  81. 6 {+ [% i' U6 Z" U
  82. module_param(acnt, int, S_IRUGO);) f4 p" F9 o$ J: @
  83. module_param(bcnt, int, S_IRUGO);
    + Z& Z) D# E8 e4 u& O! w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 q: c0 I2 s- D, J# @
3 g- o3 T$ C" m4 h. ]. ^. d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 H3 l! b# U0 P3 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 A$ [- X5 }! {; c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* m- v$ G# }" F& C# y" C( T( p2 i9 G, y( B: u
: O7 r7 j  ^) A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-5 00:27 , Processed in 0.041421 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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