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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 n$ L  P, h2 D: T! h: P5 a
  1. [code]EDMA sample test application
    0 N! a3 P/ v5 o4 Y1 E( h
  2. /*
    . Q! Q; n+ m1 A1 ?1 k5 D( w
  3. * edma_test.c$ R) w. K: i& D9 E) i
  4. *
    , U8 T0 k$ g% }: G& `9 d
  5. * brief  EDMA3 Test Application
    % j* j8 V# k, {1 w0 E
  6. *
    : c* P4 t$ S, U; B$ A- \7 U. h% l
  7. *   This file contains EDMA3 Test code.
    & ?/ L4 }, F( J7 r- G' [
  8. *
    & q& b8 z; Z) }' ]" {( m# i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: m# i1 p- u4 T! ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & `/ h9 ?1 b; G7 @8 u* L1 ?
  11. *         TO CHANGE.
    - O, q& ?' D- V! R  Q
  12. *$ v& C/ ]- ~, Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 e5 B' Z  X: v/ w" W
  14. *, d( E0 Z* C: f0 X% D! U8 Z
  15. * This program is free software; you can redistribute it and/or
    ; ?/ s6 ~  M0 m% m6 _
  16. * modify it under the terms of the GNU General Public License as
    , O4 m% k) B( \! h& g* B, d* A( S
  17. * published by the Free Software Foundation version 2.
    8 t$ i  B5 m+ ]/ ?
  18. *
    ' i1 @# S+ A6 x* \5 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ f3 D2 ]+ D5 G6 o
  20. * kind, whether express or implied; without even the implied warranty" g4 C( y1 a# r# i! Z9 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 [; P" }2 z9 D  V8 C# J9 V
  22. * GNU General Public License for more details.
    ; h6 p6 N: l5 \; P
  23. */
    % T; I4 j' j0 [- Z, o/ v

  24. ' Y8 ~* U0 D0 q: ?5 L3 o
  25. #include <linux/module.h>
    $ c; K3 y8 i3 Q
  26. #include <linux/init.h>
    % c! r/ H2 b! o6 J2 K9 n
  27. #include <linux/errno.h>( q$ g9 m) S/ ^( p( c- j
  28. #include <linux/types.h>3 I* r: b7 ~7 E, O4 s
  29. #include <linux/interrupt.h>
    $ M* Y8 H/ l4 K
  30. #include <asm/io.h>  l% ^$ c3 }" G4 {! F: F
  31. #include <linux/moduleparam.h>4 y; _8 Z- b9 G
  32. #include <linux/sysctl.h>3 n# h- P! ^# w) H# e9 ^
  33. #include <linux/mm.h>6 o2 m2 z! y' W2 k) O! W
  34. #include <linux/dma-mapping.h>: d. S0 ]# P6 J5 @5 V, f- W
  35.   X6 ?+ R6 u5 t, `
  36. #include <mach/memory.h>/ C$ w6 @0 ~1 e$ B2 a) u/ c
  37. #include <mach/hardware.h>6 N, E5 x' @- |" H/ ]/ v. I
  38. #include <mach/irqs.h>2 A1 z) L1 u; m+ v. }8 g3 [4 r- o
  39. #include <asm/hardware/edma.h>
    4 x6 [1 N, ?  u2 W% P- R
  40. % l4 F6 M6 L: h9 C5 R7 ^
  41. #undef EDMA3_DEBUG* {5 B& V3 Q4 |' f: e, ^
  42. /*#define EDMA3_DEBUG*/
    8 w8 c* y- k: d% o# @
  43. % m# q3 y, p* x5 D. q8 Y: X. o
  44. #ifdef EDMA3_DEBUG+ @& d: S! ^: Z% l, G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : _- _8 |4 K: o- ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 ^- G( J" e. m& q) L2 |. O! e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 {. y$ N2 g9 L
  48. #else! E6 `9 c# q+ N: Z4 O7 D  {/ S2 q
  49. #define DMA_PRINTK( x... )
    8 D5 `3 Y( f" U+ I0 E. y
  50. #define DMA_FN_IN
    ! f1 R9 {- w! ~& F% M( w3 x5 ~
  51. #define DMA_FN_OUT/ P0 H! p6 |$ w% D7 ^
  52. #endif9 o* \, N6 f$ v: Q
  53. ( K2 c1 U/ `* [- ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      u( c5 K8 Y( |; f. x4 h
  55. #define STATIC_SHIFT                38 ?6 Q( e. P, X4 Q
  56. #define TCINTEN_SHIFT               20
    * q3 }  P9 X) q( O
  57. #define ITCINTEN_SHIFT              211 _4 h; a) X) Y, U! g
  58. #define TCCHEN_SHIFT                22
    & N8 o' n1 e, \% W2 e7 j
  59. #define ITCCHEN_SHIFT               23
    , C5 ~/ Q3 T2 F+ C& L8 q

  60. ; D( ]% }* v4 ]* J3 J
  61. static volatile int irqraised1 = 0;
    . C/ c- S/ A  p' G
  62. static volatile int irqraised2 = 0;
    $ l" V- S- k! M; b

  63. 8 y+ Y  W, r/ Z' B! T5 [# {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , [# ~0 a8 J4 \) F+ s6 W2 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ?% ~' N6 a; k" |7 B8 H2 a2 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 o- e8 }9 Z3 D
  67. " S% P+ l' d) z8 z: c2 R) b
  68. dma_addr_t dmaphyssrc1 = 0;
    ; i+ ]! L, n/ O0 N/ E: Q/ _
  69. dma_addr_t dmaphyssrc2 = 0;: v# L$ I7 Q( e: @1 K- t7 s
  70. dma_addr_t dmaphysdest1 = 0;
    ( a5 }# z# A# D6 E+ ?! C0 b) p
  71. dma_addr_t dmaphysdest2 = 0;
    / W& [5 T3 u) Y/ e6 v6 \

  72. % k+ Q' e6 ~& o: T% T- ^6 o
  73. char *dmabufsrc1 = NULL;
    ! e. y; v1 P- N
  74. char *dmabufsrc2 = NULL;
    ) I- ?* D7 P0 H
  75. char *dmabufdest1 = NULL;  f4 m& m2 H; M+ E
  76. char *dmabufdest2 = NULL;8 O7 W$ c- c  d4 }# A
  77. ' ^' _2 e3 b" w' @! E# D! s
  78. static int acnt = 512;8 o6 R/ t6 j. s! }; V0 P! J
  79. static int bcnt = 8;
    . t' I$ N1 x% O/ ^
  80. static int ccnt = 8;
      H0 X: i  R8 E# c; V- p6 J

  81. 5 x8 c- K3 x6 R
  82. module_param(acnt, int, S_IRUGO);4 l5 b+ Q, _+ ^8 h
  83. module_param(bcnt, int, S_IRUGO);$ Z- h" ]5 U7 g2 E' P" a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: O7 ~2 M/ H+ {+ n; a; o; N/ G/ E, s7 q7 g  l; ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, f# f% D  R& A8 a' ~. Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! z. s5 Q2 N( a* `7 }3 s9 O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 O6 |! k4 f" v. ]0 n( P5 ~  L' L2 v/ I
8 L; y7 f1 p% C. x0 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 12:46 , Processed in 0.042759 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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