OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% @+ d) q; J  |. c' `, j/ z
  1. [code]EDMA sample test application
    % a9 W! T; u8 i0 b- X" T
  2. /*9 d. J( t. a: `  p5 }5 {) y
  3. * edma_test.c3 U$ k& d! s( S
  4. *
    3 @3 [& U4 [" u" g
  5. * brief  EDMA3 Test Application
    . ^+ E) L7 f. R5 _+ f
  6. *
    ) I, Z: \; k- i+ A, z
  7. *   This file contains EDMA3 Test code.
    9 b2 u; m* U1 B' j
  8. *
    4 U, G$ f0 w$ X7 `& F5 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 e5 J: F* P0 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: G  {$ k2 ~) B1 T* w' p" e2 [
  11. *         TO CHANGE.& B/ z  P. Z- J0 i2 O0 W
  12. *" h8 Q3 P$ B, D4 }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! @- G; u8 [8 i  a3 Q+ n% ?
  14. *6 m# Y% I- H/ j7 o9 s
  15. * This program is free software; you can redistribute it and/or7 B0 a( U: k' d+ d, U
  16. * modify it under the terms of the GNU General Public License as
    $ y+ |: `) R6 D9 b9 v- P
  17. * published by the Free Software Foundation version 2.! I" B" l5 M+ z2 j
  18. *9 R* U- C  m/ G( H/ t9 o. V1 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 i# j+ G+ M! C% Q
  20. * kind, whether express or implied; without even the implied warranty  [4 x  G* Z' a. Q7 Q2 \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 Z& {+ Z8 ~. k( w7 u8 I' j" N
  22. * GNU General Public License for more details.6 p/ |8 B8 L6 M( Y% P: [
  23. */
    / z' ~* f( ]# G, h) Z

  24. " ]: j. Z' R9 X
  25. #include <linux/module.h>
    4 p5 d; {9 M& N! K
  26. #include <linux/init.h>
    / F- J) R& }& }
  27. #include <linux/errno.h>
    $ A. |3 `: P% Y! Y$ Q7 |, w
  28. #include <linux/types.h>1 k" h( u0 ~/ U- N  a
  29. #include <linux/interrupt.h>
    4 S9 L# b6 a9 \! w. N# W
  30. #include <asm/io.h>* t, u( @$ A0 u( j6 q: L0 y4 W
  31. #include <linux/moduleparam.h>/ k) g* k* W! |2 c7 q2 r
  32. #include <linux/sysctl.h>2 f# v3 H- a8 U  ^* K
  33. #include <linux/mm.h>- P0 a! r4 I5 C( }9 l
  34. #include <linux/dma-mapping.h>
    & N! @! m% L5 x6 j/ t' u
  35. 0 `, l: T7 U8 |1 G$ ~1 u' V
  36. #include <mach/memory.h>
    / q* n3 [+ T0 ~0 F# h
  37. #include <mach/hardware.h>
    . o$ m( b3 j1 K8 g5 g0 C; I
  38. #include <mach/irqs.h>- ~/ y, e/ ~- x9 g* `0 f
  39. #include <asm/hardware/edma.h>
    : R" N' q7 s- ~
  40. 0 G5 p7 x' ~+ m, O0 }7 V8 Y
  41. #undef EDMA3_DEBUG7 R9 T! b. D9 T0 W
  42. /*#define EDMA3_DEBUG*/6 S; f( q0 E" {1 ]
  43. % k- Q$ C+ ]* ]: E8 a
  44. #ifdef EDMA3_DEBUG
    ' C! w. F5 G3 \& G& A0 F  P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! ]4 b" W" m$ f7 M+ o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 o5 w3 |" d& N2 V; T9 w! v+ L4 i; [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ f/ x) U. V2 M& H5 x
  48. #else( e! U: o4 i: r
  49. #define DMA_PRINTK( x... )
    ( c1 {, |7 d# R3 U  a: E
  50. #define DMA_FN_IN- {2 z6 n  d  ~; [# r
  51. #define DMA_FN_OUT7 V* c5 r/ d& G8 ?
  52. #endif. K) y( ?- ^! n* Q
  53. / L, a. V  J6 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 p$ ~5 _! Z# r0 O4 X  t
  55. #define STATIC_SHIFT                3
    ' b9 q, w6 y& Z8 s7 ]8 ?5 ~1 V5 x% T
  56. #define TCINTEN_SHIFT               20, h+ O. @: E# }: j! S+ y0 U8 Z: E
  57. #define ITCINTEN_SHIFT              21' G- {. V2 N" v
  58. #define TCCHEN_SHIFT                22
    # l  S% h, Q6 n1 C5 B0 t  t
  59. #define ITCCHEN_SHIFT               23
    4 _9 ^/ e2 _/ b, z8 ]1 ~" ], |
  60. $ m- D/ K; ~, O6 x5 r9 D9 V# K2 ~
  61. static volatile int irqraised1 = 0;2 I2 A3 J. ]! t
  62. static volatile int irqraised2 = 0;
    5 X& P- L/ s6 O* ~6 _
  63. # |4 X5 T8 x7 O( Z" S- u" o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 T& }" z/ Y2 `- o6 z. [5 t+ J; g  ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S" E& I/ f! n4 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. n& k4 w2 ^0 l. E4 W2 b1 ]2 I

  67. 5 h9 Q8 X" r2 e5 I
  68. dma_addr_t dmaphyssrc1 = 0;" a, V4 M( \4 s8 D. `
  69. dma_addr_t dmaphyssrc2 = 0;; ^) |/ t: H/ Q4 y5 L3 c" E  N
  70. dma_addr_t dmaphysdest1 = 0;
    ) h5 X) T" v4 C* S/ t2 ?
  71. dma_addr_t dmaphysdest2 = 0;) h9 N1 J" n, M" Q- o

  72. & H0 G9 D7 w4 F3 B* @) A  s* `/ ~" \
  73. char *dmabufsrc1 = NULL;& a9 l$ R# V/ Q5 |" ~
  74. char *dmabufsrc2 = NULL;% l( s% E; H) z% g- O" l1 f- W
  75. char *dmabufdest1 = NULL;
    0 y: i% ?& t1 g; L9 Q
  76. char *dmabufdest2 = NULL;
    + }( M3 h8 e* g& E
  77. * @6 x- e0 H; j$ t7 t/ e
  78. static int acnt = 512;
    % e* |$ k  m/ u
  79. static int bcnt = 8;
    0 w+ V8 Q7 P  K  t
  80. static int ccnt = 8;9 s' R: m. j3 `( c% n, s) g
  81. , V/ R% G( E  f  ]5 [
  82. module_param(acnt, int, S_IRUGO);) c: p/ z+ [1 C7 [  ?% N
  83. module_param(bcnt, int, S_IRUGO);9 k1 c% ?+ w+ K+ D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 g+ ~4 ?! ?1 |1 P: q  R( @1 R
0 v( k5 i3 j. r2 t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 g( n% a8 d) E7 B, V8 `; a0 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* q& Z8 Q. j9 |( o5 P" g/ u1 [" p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 M3 t0 p; h/ g5 }9 c
, ?$ g3 d4 {+ [9 }* P; p  c/ i7 W' K, m) [- ?- i8 ?: d" C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-13 04:40 , Processed in 0.035505 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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