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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" T& {8 A- f9 e  O- j! G1 ~  v
  1. [code]EDMA sample test application- \. J! }& d; G6 J( ]
  2. /*
    + D; P# E' s% O/ [2 d/ n
  3. * edma_test.c: f. s* f; o& V+ f5 g/ u/ S
  4. *( y! [/ u9 f; S1 Q
  5. * brief  EDMA3 Test Application
    9 k9 S5 L' ?& P% H
  6. *
    0 f: F$ [& n' a
  7. *   This file contains EDMA3 Test code.
    0 @0 A% t! _& F) k
  8. *
    " V/ V4 v$ |4 o% c  ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ g6 o" T& D% P' I( i" g" J- T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; E/ [2 [( y7 I5 ?+ i) Q% f
  11. *         TO CHANGE.
    % n1 I$ O6 P1 b0 ^
  12. *) `& C! p$ r" \6 F9 u' M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , ^) ]- |! j' M) S5 N) i! x
  14. *& I# d' A+ y/ Y# x, b! S: P
  15. * This program is free software; you can redistribute it and/or
    " r$ C; j6 {* s! I$ P  [2 {5 A3 ^
  16. * modify it under the terms of the GNU General Public License as. h9 x* k& ~( n9 W
  17. * published by the Free Software Foundation version 2./ n/ o$ c# S5 Y1 ?/ q& |
  18. *
    ( d, P3 v# q4 j' t; a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      m  k" D  |  D5 ]
  20. * kind, whether express or implied; without even the implied warranty  w7 z% p1 T2 U4 S& w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' \4 F( Q, ~5 y# e" O; f
  22. * GNU General Public License for more details.* s$ s1 ^% i! a. }/ l+ E" N9 U; X
  23. */
    : y; M1 I1 ^! I3 a+ E/ L+ F

  24. % C. q4 V- ~& C+ o! O$ G0 P2 }
  25. #include <linux/module.h>
    8 J- k! b8 |, F" p4 ]* C* p3 x
  26. #include <linux/init.h>. Z% C2 F. T6 u
  27. #include <linux/errno.h>4 I* W# N9 E" S2 s4 X  C0 w/ o$ q
  28. #include <linux/types.h>
    ! b1 k& `. f/ k; A, ?
  29. #include <linux/interrupt.h>
    9 S0 D$ R. a7 O# g2 T( R; G+ b1 D
  30. #include <asm/io.h>
    . T! V' Y0 a, [+ ]
  31. #include <linux/moduleparam.h>0 E- S& a# t  B9 H: U
  32. #include <linux/sysctl.h>
    $ J! z: o( a3 c
  33. #include <linux/mm.h>
    + ]$ ~2 F4 u1 T0 N, z+ x+ W
  34. #include <linux/dma-mapping.h>+ H: I9 G: {  {/ Y
  35. - f1 e% W2 y! C$ i: A0 m# T
  36. #include <mach/memory.h>; l6 B2 d4 A3 ]
  37. #include <mach/hardware.h>
    , R0 ?  L6 o% ~% p+ t$ P
  38. #include <mach/irqs.h>3 w# M7 v$ Q8 m! b; H
  39. #include <asm/hardware/edma.h>9 W4 X, w$ b2 k$ {; |& L9 y
  40. & U/ [4 K3 w4 s
  41. #undef EDMA3_DEBUG1 ]( z, b6 M# }1 l& x( Q
  42. /*#define EDMA3_DEBUG*/1 y$ U1 V8 W3 h* h4 V; y) J

  43. ; e) H. n5 s; k/ M1 j1 m
  44. #ifdef EDMA3_DEBUG+ T. Z: ?+ \- Q9 f+ ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # h  I' g2 l* N: i' X/ l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- C0 j2 i/ j1 ^4 v- g2 ~$ |$ C! W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ O/ S' g- X& G% m  Q5 W9 I; x
  48. #else
    8 F# q- c% a9 g" G
  49. #define DMA_PRINTK( x... )( [2 S+ u$ i/ J
  50. #define DMA_FN_IN' h! z6 U* [5 w' ~4 X
  51. #define DMA_FN_OUT* G0 s; Z' c# [) G9 \
  52. #endif
    - ?4 ~4 L+ W$ {/ z: \  G
  53. 3 f& P2 g$ \3 y4 i7 \9 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 d, D* [  T/ f1 \) T% O& i
  55. #define STATIC_SHIFT                3. f& E  X# J- Q0 Y& ^1 O
  56. #define TCINTEN_SHIFT               20
    7 v. a3 V" q7 T  r$ V' G( Z1 r% X, Z1 S
  57. #define ITCINTEN_SHIFT              21
    - _/ [/ y9 x; t1 \, o! w
  58. #define TCCHEN_SHIFT                22
    2 C+ f6 F9 U! b% M8 |
  59. #define ITCCHEN_SHIFT               23$ c' @; E7 S7 |' |) ~2 t

  60. ' q/ x5 b  R8 j: t' b" D: f# T* t
  61. static volatile int irqraised1 = 0;
    7 x/ r( [7 g4 p) l2 |# C! e
  62. static volatile int irqraised2 = 0;5 _, X# u/ r8 g. x
  63. 6 r& f% ~6 r- `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& |3 y# s0 X8 ?: o3 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 n3 d7 f- D4 {1 A1 H! {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( s2 d8 W% V& ~
  67. ; `+ G7 m4 _9 Q
  68. dma_addr_t dmaphyssrc1 = 0;
    6 {! C% Y- x* O0 c' c# I
  69. dma_addr_t dmaphyssrc2 = 0;$ E3 a( c5 Q; d* b
  70. dma_addr_t dmaphysdest1 = 0;
    $ ]/ g0 B- y! i; g. O
  71. dma_addr_t dmaphysdest2 = 0;
    ; Z& Y+ L5 @- {  E1 I
  72. 1 k; o' }- x% |$ R* t
  73. char *dmabufsrc1 = NULL;
    : z, A* x. \1 A' k+ ~& q+ i5 [
  74. char *dmabufsrc2 = NULL;
    7 p# m5 ?# Z) W; o' f
  75. char *dmabufdest1 = NULL;
    * j4 X8 z" ]2 T- k2 o  b) x  ?
  76. char *dmabufdest2 = NULL;4 [. h) Q5 G# w
  77. " G* ~: \, C0 o+ u) U- m* I: g
  78. static int acnt = 512;
    ' W9 m; P* p( c1 `; Z4 H
  79. static int bcnt = 8;$ A$ k4 r8 V) _! `3 ]
  80. static int ccnt = 8;
    " u1 {7 G1 M+ A3 I2 i* B
  81.   ]  X2 J8 U1 v5 J! S- Y
  82. module_param(acnt, int, S_IRUGO);
      P, D' b, w: a# ^! I
  83. module_param(bcnt, int, S_IRUGO);
    $ P$ u- U/ i2 w3 D* S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ `. f3 a6 W' _( c0 K8 R$ m5 X* M9 {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) u$ _. |6 E# j( E) L. U) @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ g! E9 q  `9 A3 Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 g  g$ c/ b( E) }6 S* P$ t' g/ ^$ |) H
" y: w. D4 Z/ ~+ ?7 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 08:31 , Processed in 0.037293 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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