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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - c; r! v% v2 n: L5 d
  1. [code]EDMA sample test application: `9 l4 x2 h& E6 N  s
  2. /** z& s4 H) m3 W+ {* N
  3. * edma_test.c
    5 w! |8 v! V* @7 i
  4. *
    + B- s1 s. @3 v& W) h7 `/ Y* q
  5. * brief  EDMA3 Test Application7 A& \6 E& g9 `- q/ |
  6. *
    % {/ q: N5 d. u, X
  7. *   This file contains EDMA3 Test code.- j: {+ p5 o& {. M
  8. *
    # y- R" D* _) w; f& a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % P3 z+ R+ f) X0 E4 [8 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 {6 ^  g6 ?* |
  11. *         TO CHANGE., l0 O8 b1 r& y* |- _; y
  12. *
    % ~6 N) l, t" d1 P( q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 R$ c- h1 p+ N9 ^
  14. *
    ( e8 X+ m7 M. Q1 e, f1 {
  15. * This program is free software; you can redistribute it and/or
    ! r' ]2 E$ ~$ v; S7 A: M# k) A
  16. * modify it under the terms of the GNU General Public License as) {* P% e3 }4 _' A
  17. * published by the Free Software Foundation version 2.) A/ Q2 T/ u# U5 o5 P: T
  18. *0 u) h/ s$ q) u7 I5 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 z* _% d. T  p
  20. * kind, whether express or implied; without even the implied warranty
    , i* n9 |& e4 [8 H% `. }! }* P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) J7 ~& h1 S$ |
  22. * GNU General Public License for more details.
    8 V: Z% o, O( F1 T0 ]
  23. */
    4 d1 o) o. M: r! u6 ^, ~

  24. 6 W2 }6 Q/ O2 K
  25. #include <linux/module.h>
    9 x) h: ]7 B; z# [" y1 R
  26. #include <linux/init.h>$ y1 X, j6 ?  s& p3 t  f. D
  27. #include <linux/errno.h>
    / m$ C3 E* G! g% Q( B- h6 f: [
  28. #include <linux/types.h>- ~0 E* I4 U! `9 G
  29. #include <linux/interrupt.h>
    ( q0 U( V2 s7 @$ A7 a
  30. #include <asm/io.h>4 `( @3 `$ J$ |! T& Z
  31. #include <linux/moduleparam.h>
    ; X5 e8 T4 k6 m
  32. #include <linux/sysctl.h>
    + J; L' X/ Q1 V" L+ ^5 k
  33. #include <linux/mm.h>8 h" ^& A4 Y: E7 o! _' v
  34. #include <linux/dma-mapping.h>
    " {; M& c2 H4 x3 E
  35. ! a7 N  n/ G- M, Z
  36. #include <mach/memory.h>8 T3 Z# T! V7 t1 q9 ~
  37. #include <mach/hardware.h>4 M: _5 ^$ W) y
  38. #include <mach/irqs.h>% ]3 R# P1 t# O8 E8 ~% I8 I+ N
  39. #include <asm/hardware/edma.h>
    / |/ G; v% N7 t3 k0 B- h
  40. 6 ?% C' J3 V! Q3 v
  41. #undef EDMA3_DEBUG7 N: O: l+ @6 N. l/ m. j0 F  i
  42. /*#define EDMA3_DEBUG*/
    4 c9 U) Q4 z5 O' h

  43. # g2 j& s$ K, Q; j6 E1 t( p. h9 x
  44. #ifdef EDMA3_DEBUG
    1 m& s/ C( z7 B8 T$ _1 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) X1 \+ j* O. O1 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 \8 a# _* c! m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), Q" z3 ~' j5 G* |4 s3 A
  48. #else1 @# K+ e  z* X# s2 m
  49. #define DMA_PRINTK( x... )
    ' W; {" M: m& i3 L1 M/ ?5 }
  50. #define DMA_FN_IN
      U3 R! G& x) r$ ?! c
  51. #define DMA_FN_OUT& \" K1 s0 [+ O$ l
  52. #endif# `1 Z+ Z3 C8 L+ t* i8 I

  53. 0 E* s. e0 K$ n4 d; e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 W3 H& M  A* W- T' b
  55. #define STATIC_SHIFT                37 c7 w! X3 ?- p# m2 i' D
  56. #define TCINTEN_SHIFT               20) U; P% R! n9 m2 N# z8 E5 ]
  57. #define ITCINTEN_SHIFT              218 P& O9 ~! W4 ^+ y2 [+ p
  58. #define TCCHEN_SHIFT                22
    & y. ^  n/ J, h3 Y
  59. #define ITCCHEN_SHIFT               237 y/ s4 Q: m8 n4 P, v# F% [4 B

  60. # ~  w0 H9 F2 u9 R! m% }8 m
  61. static volatile int irqraised1 = 0;2 C% Q- @& n3 U& \! D+ z" W
  62. static volatile int irqraised2 = 0;
    0 Y; K8 n, _  L1 A

  63. . i7 J5 }0 C  H* r$ L) Y, g4 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * @, d8 g6 \2 W! u4 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 S1 j6 l4 `/ `% F0 K2 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - I1 e3 D) q& ]# p! u. ~/ N! _

  67. " _7 b7 G2 Z$ D0 w% d
  68. dma_addr_t dmaphyssrc1 = 0;
    7 w6 v  A; j1 {2 D  N
  69. dma_addr_t dmaphyssrc2 = 0;
    9 o0 o. K; r4 {( u
  70. dma_addr_t dmaphysdest1 = 0;
    - S3 X/ o* y* Q
  71. dma_addr_t dmaphysdest2 = 0;
    $ c2 F( y3 t- C  K6 V

  72. 9 ^, S3 u' a$ U: R/ T# b! e5 M
  73. char *dmabufsrc1 = NULL;
    7 H3 |+ D( X( b9 O: Y1 \& i. y. W1 e* S8 r
  74. char *dmabufsrc2 = NULL;
    # m( b4 f" z* W! J. W
  75. char *dmabufdest1 = NULL;
      J* k* N( Q' P) ^8 S  Y
  76. char *dmabufdest2 = NULL;
    % K; P% O- l: E' y
  77. ! N- \3 A; r) ~* M5 n' ?! U6 E, D$ e
  78. static int acnt = 512;
    2 I' [, `) z/ c, D+ L, l9 L
  79. static int bcnt = 8;
    1 l5 {2 b: P) r% z
  80. static int ccnt = 8;
    7 i- d! A/ h% z4 z6 R

  81.   s1 J; A5 d4 u# ]. N# X. L
  82. module_param(acnt, int, S_IRUGO);8 @- E* `% [. K$ L# c; I
  83. module_param(bcnt, int, S_IRUGO);
    - x3 ^$ ^- k9 `$ d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% O2 }9 u" W6 W4 p  U5 i* J- r0 q
/ U5 G. s2 g( Y3 c* t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ^. w7 `, X; _+ \; n+ ~# J% a. Harm-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 s& B* t, a' k& C2 y5 I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ T; r) t) l4 F- s, H7 w% c
2 U, P6 C8 X  y
8 ~- E3 E  e$ r, ?* W) G8 d& ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 08:44 , Processed in 0.038153 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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