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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 E0 q+ O8 s+ h* j" w
  1. [code]EDMA sample test application
    # `7 z1 w$ g/ B7 P6 L7 \6 k# g
  2. /*4 ~9 p7 l' w+ n7 J# v0 i
  3. * edma_test.c2 c' U! O9 p; H( C: C# A
  4. *+ ]4 @' t2 o: d0 {5 ~0 n
  5. * brief  EDMA3 Test Application1 d1 J$ t. X0 w' J
  6. *
    # C+ Z" @' u: ~3 c; h
  7. *   This file contains EDMA3 Test code.
    6 z( r6 U. b- ?* |
  8. *( D! ?; @% m9 w! W" I: y0 ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ Y9 w8 C8 i1 b/ }3 q) ^2 c6 N) L8 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 u+ q& x; ^: R2 E; R+ M+ a
  11. *         TO CHANGE.' m( O) h% x( I) A
  12. *$ i* W+ i; U  e0 a+ [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . ?+ |8 B  j" k& ]
  14. *4 b3 Z- n- @, M# M  A
  15. * This program is free software; you can redistribute it and/or, O$ n; N2 I. M/ S7 b
  16. * modify it under the terms of the GNU General Public License as
    % u+ v- x( D* s# O: S) r# R7 ?+ I
  17. * published by the Free Software Foundation version 2.4 W8 W. Y7 }- p. W- f% w
  18. *
    5 f: i( G7 E+ F! ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % W2 n. X, |, n3 _
  20. * kind, whether express or implied; without even the implied warranty
    ; u' L  P9 U7 l" K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 ?8 G9 L- r3 N( n$ ?  K# d. ~# M; N- S
  22. * GNU General Public License for more details.
    3 b0 L- h: ~' p$ D& l4 V
  23. */
      |% `7 ^) P* c0 p
  24.   ?( Q$ h' @2 _, P1 u
  25. #include <linux/module.h>
    % c$ C/ E: S7 A/ v. ~
  26. #include <linux/init.h>8 A4 s: T: A$ G7 ]% L
  27. #include <linux/errno.h>6 x6 v# O1 a. C' A+ j# R
  28. #include <linux/types.h>
    " X. j1 _# r8 e
  29. #include <linux/interrupt.h>
    ( i! T" Z1 N; R2 M5 W
  30. #include <asm/io.h>
    6 R! q/ z' C' k: v8 y' E
  31. #include <linux/moduleparam.h>  q/ e* E6 \& t& U  k7 X& ]2 y. J6 b& L
  32. #include <linux/sysctl.h>, J( x! D* Z* `% _# {
  33. #include <linux/mm.h>
    : ?5 o3 _# s7 f# O' [
  34. #include <linux/dma-mapping.h>* E( T0 f9 [" c

  35. $ G5 [  l/ V- J% Y( Y' V
  36. #include <mach/memory.h>
    / }6 q# v, ?" e6 [( z; W" ?/ k
  37. #include <mach/hardware.h>8 u1 u$ d; z, ^- }( o
  38. #include <mach/irqs.h>
    9 L( s. L# r; _+ J) Z2 A+ L% ]# P" L
  39. #include <asm/hardware/edma.h>1 u" N1 `3 ^7 D' n
  40. 6 @" I  J; y% m- b% m7 X" k/ c
  41. #undef EDMA3_DEBUG: n& ?1 e; H7 x. V  i" Q
  42. /*#define EDMA3_DEBUG*/  ~8 V, f( o" a7 J% U

  43. ) Y- f: H( t1 F: h9 C( j! H: X8 d
  44. #ifdef EDMA3_DEBUG
    8 m' N! C+ u8 u6 o4 ^2 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % p# Z7 h" D- T: k6 s) {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 F3 ~( `8 G& }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& x9 g; G7 M  W! Q# x2 X( D2 Z
  48. #else) j4 p0 C% m; d* V
  49. #define DMA_PRINTK( x... )7 k; K" X5 E: \& o5 \/ a# G
  50. #define DMA_FN_IN1 n$ A: ^9 B/ Q* G, ^0 B
  51. #define DMA_FN_OUT  h) C+ V: o+ [
  52. #endif6 Z+ F7 B3 i+ l9 U& T

  53. * {4 q& E* m5 X; A# S; F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ G# u3 P1 r5 ^8 o4 _
  55. #define STATIC_SHIFT                3( Q# |4 z5 N8 j
  56. #define TCINTEN_SHIFT               20
    6 p( |6 Q" M4 H0 G) U5 C* I. l3 u, a
  57. #define ITCINTEN_SHIFT              21
    2 O  S1 V" @+ w
  58. #define TCCHEN_SHIFT                22
    6 @  W0 F4 U+ f" V* b4 C3 C( j
  59. #define ITCCHEN_SHIFT               23
    . O  ?  x# w- Z0 \% P6 C

  60. $ u" n: j( |) u& w+ }1 L
  61. static volatile int irqraised1 = 0;, e9 B; \% T2 U! P% n9 ~$ R! n
  62. static volatile int irqraised2 = 0;- \$ I8 R3 T' k! a3 ^2 T

  63. & A; M- g! m  X4 `  @6 ?3 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* h6 ?' z3 O9 ^1 m- B* Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 S# O/ c5 @' f+ l( _$ W2 q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) O8 p. B; U  U5 A/ i3 `7 ], V
  67. 4 W) v/ O% e( R9 e4 n  \5 l
  68. dma_addr_t dmaphyssrc1 = 0;( y( }$ t2 _$ {1 f; n
  69. dma_addr_t dmaphyssrc2 = 0;
    4 C* i2 c9 R# ?  V
  70. dma_addr_t dmaphysdest1 = 0;
    . _$ x. B" X0 F% Y. y% H1 g. `
  71. dma_addr_t dmaphysdest2 = 0;
    5 `8 U/ |1 |" C0 ]$ Z/ x% P
  72. $ D2 n- |. j, D6 J6 b) t0 F3 T
  73. char *dmabufsrc1 = NULL;; p1 c# v) I3 C, j; z* J
  74. char *dmabufsrc2 = NULL;
    " b' W2 f" |) I
  75. char *dmabufdest1 = NULL;
    $ E2 v& ~( r" {' W
  76. char *dmabufdest2 = NULL;* Y. |% s: D- I
  77.   Q+ h( S; l/ }( u
  78. static int acnt = 512;% E6 |0 @: n& y: q
  79. static int bcnt = 8;
    ; }5 \8 k* L0 y4 h$ k
  80. static int ccnt = 8;
    9 k0 \1 W- d: @5 k

  81. 8 _- B# n# U0 L) g8 U% H. z
  82. module_param(acnt, int, S_IRUGO);3 P% C3 D* f: {* M; ^) ^2 l
  83. module_param(bcnt, int, S_IRUGO);
    ! p1 D4 A3 c- c' h% Q  p+ U% T& S. Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 d* K. O: |+ n5 {# ^( z
1 x" P8 f& \( _! J$ h  t' U# v& P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! N" g. ~6 K1 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ g7 t* W/ Q0 O2 q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& G/ g' o  I: n9 Z: t3 B
  y3 }. _) r4 k; i2 F. U0 m7 M) i$ L( G$ N* A: c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-19 12:50 , Processed in 0.037927 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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