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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, O- [) r- Q# b! k- ?$ L& K
  1. [code]EDMA sample test application
    ) M$ b2 v3 ?+ }
  2. /*
    . V/ t5 q. f9 k* @! c
  3. * edma_test.c+ [7 D. ?+ q2 P; w7 t' G: A
  4. *+ Z8 A6 P: R! R# G; f/ W# y
  5. * brief  EDMA3 Test Application
    ; ]6 _, H. E" B4 Y5 O6 i* c
  6. *
    - I- \1 B! N. y0 k' _
  7. *   This file contains EDMA3 Test code.& @7 x3 q% {" P0 i
  8. *
    / ]( U) _/ J% G6 C! U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / G+ S# d) R! a/ U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) G9 E( q6 z" ~; R. c1 z
  11. *         TO CHANGE.
    ; a& }& S0 H) {1 r
  12. *4 Q& t# Q1 [2 ]' Y6 O4 K7 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. c. O2 Z. S, [! ?  w
  14. */ F+ h( g( q' d+ ?5 S. ]
  15. * This program is free software; you can redistribute it and/or9 O% u( P2 \  I  O
  16. * modify it under the terms of the GNU General Public License as1 F3 P; p: s1 f6 ?
  17. * published by the Free Software Foundation version 2.) h7 ?3 n4 Q! p* k
  18. *# I# @$ h, y' s9 z! q( U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 D/ o' V- Y$ ^) V- d* p, a% E
  20. * kind, whether express or implied; without even the implied warranty) s$ D; r2 S1 v+ r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " t4 N: t% c) j6 q, b. t# W
  22. * GNU General Public License for more details.
    5 t; K/ @9 e% Y2 P% Z+ D& F
  23. */
    ; h$ P/ c+ N. o# ]0 n; D  C* t
  24. : A/ F9 b4 l; g3 v5 ?
  25. #include <linux/module.h>5 ~3 W0 N6 V7 i  n$ k1 @+ A3 M+ l
  26. #include <linux/init.h>
    - `/ Z+ ]9 Z$ t- c2 B
  27. #include <linux/errno.h>1 c% Y0 F/ f: B" r: J7 g3 M
  28. #include <linux/types.h>
    : Z! o5 k. |4 d3 s
  29. #include <linux/interrupt.h>. E& G' P. o( G2 \: N$ W
  30. #include <asm/io.h>
    6 n5 y3 G# q7 e: L. L4 [
  31. #include <linux/moduleparam.h>
    % H0 n; r8 W" ~/ x8 ?+ x0 {2 y
  32. #include <linux/sysctl.h>
    6 l) R5 W" S. S* R! ~) t0 }' z
  33. #include <linux/mm.h>0 k! k3 I$ m2 l3 C9 K5 n, y2 Y
  34. #include <linux/dma-mapping.h>
    8 z, u- I6 Z8 F" m8 D

  35. ; k; H' b* `- k0 s" Q1 b2 X
  36. #include <mach/memory.h>2 Z9 _, u/ O) h$ N
  37. #include <mach/hardware.h>0 U1 J2 ?. D8 R( H! ~7 ?  F0 T
  38. #include <mach/irqs.h>; I7 L) K4 ]0 K. ?! p1 S) F# V
  39. #include <asm/hardware/edma.h>
    ; B; D+ y- V5 `# F( ^# m

  40. 6 q2 C1 g4 B8 q" |8 L2 {
  41. #undef EDMA3_DEBUG
    + w  [% u0 f6 J) V  H
  42. /*#define EDMA3_DEBUG*/
    . I6 P9 K( P  {6 g- l' L  a
  43. % j6 }9 l6 R6 c5 x7 K5 h
  44. #ifdef EDMA3_DEBUG
    / J4 y& H5 C" ^% F% ]& [5 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # O: j6 [! v  m0 D& ~% B/ V# ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , E5 N$ f  @; X* b9 {5 ^/ B( L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + e# L# P$ m' i& Z/ h: j' Q
  48. #else
    / G# l  G+ L( m: o* b1 g: Q
  49. #define DMA_PRINTK( x... )5 `/ j: E: |, E
  50. #define DMA_FN_IN6 n+ P3 O7 t$ u9 ]$ q6 ^2 ]# I3 w/ C
  51. #define DMA_FN_OUT. M1 ]! c6 K9 g" B
  52. #endif6 J, F: D  j. r2 y6 X

  53. % O; k: E, g2 P  G2 m& w6 r- V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 F# E1 z  c8 Z
  55. #define STATIC_SHIFT                33 c" }- j$ q* Q  D: T$ N( M' W. f6 ^; q
  56. #define TCINTEN_SHIFT               20
    & N! }6 R& s9 C$ [4 F
  57. #define ITCINTEN_SHIFT              21
    6 ?0 r0 j& d6 [, e, N
  58. #define TCCHEN_SHIFT                22
    ( G( w" [- ^3 q; [- a- f: G
  59. #define ITCCHEN_SHIFT               23
    5 t0 L+ O. p. a2 Z8 ?
  60. 6 X* o( K" E$ k9 ]) p
  61. static volatile int irqraised1 = 0;
    1 g6 |1 f$ U; _0 b
  62. static volatile int irqraised2 = 0;
    : Q) h$ C7 E0 M8 C# Z# I

  63. " p& c+ n/ j$ B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ H. R, v3 _. z$ _- Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - d% \) e# F8 `4 c; A2 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 |5 I, i, B$ x& c# o
  67. - |, e/ j! E' y
  68. dma_addr_t dmaphyssrc1 = 0;
    # x4 N, S- M% l: [7 L6 j$ o$ {/ l
  69. dma_addr_t dmaphyssrc2 = 0;
    & \/ `" I) r" z6 Q2 d/ ^! C' [9 J! |
  70. dma_addr_t dmaphysdest1 = 0;
    . \/ C" D" P' [
  71. dma_addr_t dmaphysdest2 = 0;
    / w, h9 m5 R% p
  72. , S) l2 g$ L7 s3 _: ?% _
  73. char *dmabufsrc1 = NULL;* p' v- K' ^; h
  74. char *dmabufsrc2 = NULL;
    8 n9 H# e) b' w: o% E& Z, @
  75. char *dmabufdest1 = NULL;
    % X8 o, S8 Z% u
  76. char *dmabufdest2 = NULL;
    4 C. s6 k- Q& f: A# X9 f! V0 x
  77. / \: x2 x1 \: W4 i3 l: C! R1 d
  78. static int acnt = 512;
    " ?. ~: `. @% F' d; i' w6 K
  79. static int bcnt = 8;+ g) u: B( p/ a* U/ ?$ R4 Z4 l
  80. static int ccnt = 8;
    + k+ U* T; `) F* T0 l
  81. % u/ k: ?: Y! b
  82. module_param(acnt, int, S_IRUGO);
    % M" Q$ r' i* V3 y! F+ n+ N6 v
  83. module_param(bcnt, int, S_IRUGO);/ P) r4 I" p. d0 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; L5 Y! a" a' K2 g; \
% l$ H9 z! `9 K% Q  A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 j- c9 a2 C5 }$ G  n- D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# Q. \. m7 j: ]. S4 Y$ k; o6 b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; s& y& f0 c5 q& x3 H) b; E- J+ L! s6 b8 e( y
- B. r" U( V) j; P* D/ C$ F' I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-15 06:44 , Processed in 0.041894 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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