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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 f1 y; K% p- m( v
  1. [code]EDMA sample test application
    0 W5 n, v8 S4 Z( N
  2. /*
    ! E6 a/ m: l/ B, o; [, d8 I2 R
  3. * edma_test.c' C# a$ B9 j9 Q# `+ t9 i( j
  4. *1 i' r# ?7 L7 Q1 Z
  5. * brief  EDMA3 Test Application
    . D: s2 e& M. d9 G4 A2 r
  6. *
    , [4 @7 N- _) D
  7. *   This file contains EDMA3 Test code.9 Y0 K  \" J* E/ z' O# \
  8. *! T0 v" a. O7 }) M/ Q. A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" ~0 Q/ L# ?8 T2 z/ a  |( j0 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. K/ U- l* D2 j5 H
  11. *         TO CHANGE./ ~7 G- F9 P- A" |% S$ `( h
  12. *  @( Y8 |( {& A$ _' u( q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  y  p- Q2 o6 I
  14. *- p( a. v5 _% r5 d, G+ G
  15. * This program is free software; you can redistribute it and/or
    / ~' q. y- T  A6 T- L% k# T
  16. * modify it under the terms of the GNU General Public License as
    ) l/ o7 z% I+ Y* ~* i5 q+ G
  17. * published by the Free Software Foundation version 2.
    - s% S& F6 ~# l. k/ n
  18. *
    / C3 r* t; c6 C/ N9 ]/ |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. v. `$ v; d4 h! _, h* m
  20. * kind, whether express or implied; without even the implied warranty
    ) s- R/ B1 C& o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. \0 h' |2 p* H4 g
  22. * GNU General Public License for more details.
    . z, R9 j; Z) P
  23. */
    2 b* }& S7 w$ h" D( F

  24. 5 a1 l) ^" Z7 R3 D
  25. #include <linux/module.h>
    3 v$ C, Q+ R/ Y! R4 E
  26. #include <linux/init.h>
    ' I/ W' H* B! b& X$ |$ [: N8 A4 J
  27. #include <linux/errno.h>
    6 \  k3 T6 ~, m6 D
  28. #include <linux/types.h>
    . w6 p" }. [. Y/ N9 B
  29. #include <linux/interrupt.h>. ^2 t2 e; V6 s8 C* t1 l  W9 v
  30. #include <asm/io.h>. N2 F# z: m+ W: T7 B8 o4 y
  31. #include <linux/moduleparam.h>
    & }9 H! G: _% O0 o1 \6 ?
  32. #include <linux/sysctl.h>
    ) `" a' v+ {5 n- R
  33. #include <linux/mm.h>, p1 Z6 B* B# W6 ]# [& z& t
  34. #include <linux/dma-mapping.h>% _& v8 j4 L" x, ]
  35. 0 I2 P% a% t; o, f9 `
  36. #include <mach/memory.h>
    & a$ j5 {: w: K9 y! H
  37. #include <mach/hardware.h>
    ! v1 C- u0 f3 k
  38. #include <mach/irqs.h>
    3 p' r4 W3 d$ H! G! g
  39. #include <asm/hardware/edma.h>0 z! p, K' L, D

  40. * H2 L" u6 ~7 W7 m/ a
  41. #undef EDMA3_DEBUG- q' X, y4 ?5 d8 r* Z' V  L& k2 O
  42. /*#define EDMA3_DEBUG*// l, ^/ r" @: ?8 E

  43. , Y! @$ R4 ~3 h. x: f$ a
  44. #ifdef EDMA3_DEBUG: H4 M0 F8 T/ H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % T/ Q2 d! i) @: c* g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " x" S: Z6 ^. e; g* I5 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  O6 t, Y) ?4 J. f3 D
  48. #else! @9 g; W$ o! D- {( p! B8 p9 ^
  49. #define DMA_PRINTK( x... )
    + k0 y9 r9 d  c
  50. #define DMA_FN_IN
    ! Y9 b) g9 Z9 s8 ]- Y" p6 d
  51. #define DMA_FN_OUT
    $ C( E) V: R& K
  52. #endif
    ( y; u, ?! p1 z& q6 M
  53. 9 `9 O# W0 Q0 o% r3 s6 j% |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) c) Y- W4 K/ J& w
  55. #define STATIC_SHIFT                3+ i5 ~2 l! Q( f3 M
  56. #define TCINTEN_SHIFT               20
      x: m8 s7 y' B: {
  57. #define ITCINTEN_SHIFT              21! ?5 \2 @( k' ^
  58. #define TCCHEN_SHIFT                22
    ( S) x& r0 C6 P8 m
  59. #define ITCCHEN_SHIFT               23
    ( e) z, t7 t% s

  60. $ i3 ?& M7 ?+ G7 w) t( p
  61. static volatile int irqraised1 = 0;: w* O, E$ p! J9 q) a( b# c% L
  62. static volatile int irqraised2 = 0;
    - J' s3 D/ Z1 J, M) V
  63. ( t) J- |' F/ }% h* D. q' P1 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * ~  N& e3 R, y  l) e9 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 L8 d( f5 {4 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . [4 z8 Y7 K" y. O7 S5 f

  67. : o2 k+ c  [) r) }+ I
  68. dma_addr_t dmaphyssrc1 = 0;* r+ C+ X5 _6 ]+ t; e4 S
  69. dma_addr_t dmaphyssrc2 = 0;- L5 d" a) c9 E3 y. @  Y
  70. dma_addr_t dmaphysdest1 = 0;# y# O- w5 I& [6 h2 e3 O/ k+ M
  71. dma_addr_t dmaphysdest2 = 0;7 W* c6 d: Q! W9 ?$ v

  72. " I. i5 P9 W& ?
  73. char *dmabufsrc1 = NULL;0 l2 U" r: ?) l  I4 |) L
  74. char *dmabufsrc2 = NULL;
    2 C: c% U. ?- l" C: Z
  75. char *dmabufdest1 = NULL;
    4 q6 V) Q; f- D; k( k% O; y- r8 s
  76. char *dmabufdest2 = NULL;! |% [$ J3 d- H0 @9 h# c8 A/ M4 x
  77. ! K% j: C6 g8 E& p& K
  78. static int acnt = 512;
    / q6 X% z  V' H
  79. static int bcnt = 8;; O( ]7 f6 x  b# p( e$ F, ?1 D
  80. static int ccnt = 8;
    " P9 c, K  W' y# y3 Y6 u( `

  81. 4 ]) O! U9 H: P) O8 B' H
  82. module_param(acnt, int, S_IRUGO);5 S# F, `) f0 C
  83. module_param(bcnt, int, S_IRUGO);
    % X/ C0 S5 ~0 D0 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 [  V2 n0 H  P) Z* I2 O2 v8 `: A0 H/ O# r8 |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* A. Q1 h9 U8 F" K! V  l+ ?. a# M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' Z8 {0 D5 i2 A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* ]- i1 a# }# V- j: g( d0 o
: w1 u! f) Z2 ]
9 R1 e5 N0 g4 Q9 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 10:32 , Processed in 0.040597 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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