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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 z$ e3 }, [7 G6 d3 _0 R; f7 ?
  1. [code]EDMA sample test application8 _' K9 i* u3 d0 V2 B+ M
  2. /*/ B7 t5 Z  F) T/ ~( s4 k
  3. * edma_test.c
    3 q0 E& J, ?+ r
  4. *
    % d: Z9 h$ O$ _! ]4 O% p
  5. * brief  EDMA3 Test Application( q. `; ?, e# c; K3 K/ r. Z$ X
  6. *
    . B- C& [1 u2 R5 d) j, w
  7. *   This file contains EDMA3 Test code.
    ) H0 x  Z) k3 C5 C( J. b
  8. *
    ) y% ~1 `2 B7 h6 p7 W, c3 O2 v7 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . Z) S' T! J% [( O5 s- ~1 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 d* j2 T4 X) `+ p( l% ~
  11. *         TO CHANGE.
    " d" ^# p9 G$ y" w5 u
  12. *
    5 m/ s, R" m6 N& I% K- z3 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' \+ K, _" A3 @0 v- e8 z  y/ x
  14. *1 ?6 p: I) H0 c7 W0 P7 x# l+ R
  15. * This program is free software; you can redistribute it and/or
    " g( G3 B# h8 t3 P7 \
  16. * modify it under the terms of the GNU General Public License as3 r; e' f; [, e) o+ K
  17. * published by the Free Software Foundation version 2.
    + `7 J" \6 B- S
  18. *
    ' X# o0 w! `* M1 b7 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : m3 @6 A+ G; C! r+ A" e4 u) P: o% |
  20. * kind, whether express or implied; without even the implied warranty9 d; J' C( k0 n3 s2 w; x$ }; }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 V9 m' Y: ?! [, G% j! G
  22. * GNU General Public License for more details.
    ; l) K3 |+ f$ W! s6 K1 g3 J( Z! q
  23. */8 l' `2 M% G# U

  24. ! S% W' q' }3 W; B! v  ?& ]2 a" |
  25. #include <linux/module.h>8 b9 x4 W4 A# v2 J- O0 I3 t* l
  26. #include <linux/init.h>
    1 u: u6 G) x* \) X, q. S
  27. #include <linux/errno.h>, M5 Z/ ~: L( {" _
  28. #include <linux/types.h># O+ I- c- {! e
  29. #include <linux/interrupt.h>
    + A% J0 O5 @5 k  M+ B7 {% h
  30. #include <asm/io.h>% j7 P6 h" b# f: Y: b1 B6 I
  31. #include <linux/moduleparam.h>$ [7 V+ w$ U' }) `6 M
  32. #include <linux/sysctl.h>& F$ o- h9 L6 ?
  33. #include <linux/mm.h>+ @; @1 Z  [9 {# V9 w
  34. #include <linux/dma-mapping.h>% B% U  w- ]; e7 B1 l

  35. ) {8 \% ~) B/ a  T) }
  36. #include <mach/memory.h>
    ) I6 h& f. d9 u, P7 D/ o
  37. #include <mach/hardware.h>
    0 [& E5 N3 B) y' M
  38. #include <mach/irqs.h>9 ~4 e6 k0 Y+ \* _
  39. #include <asm/hardware/edma.h>$ e# p7 W4 P  h  E

  40. / w. }% ~  D. i& h4 N: l
  41. #undef EDMA3_DEBUG# h, c0 d7 O8 E6 Z
  42. /*#define EDMA3_DEBUG*/
    . p  t5 G, z  L) |% J/ G

  43. ) W. @6 Z* r; L1 E1 n. O
  44. #ifdef EDMA3_DEBUG
    ! k; Q. R$ x) \' v  U6 Z% b" S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( e0 {8 S$ d3 Z8 K3 t- R4 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ l- U% F7 s0 T% j7 n9 `% `3 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . y, q2 J1 D7 v3 I! L# Q9 {6 J
  48. #else
    1 b. c# p* {& [
  49. #define DMA_PRINTK( x... )& L7 g" [7 `- c" S
  50. #define DMA_FN_IN
    * |3 I  X. \; ~* t
  51. #define DMA_FN_OUT2 |4 f% o& l0 q
  52. #endif
    & o3 s2 C6 _% O* W9 T* V* U9 G& c; _
  53.   w* V9 c; U2 @0 a# V' n+ Y6 {" F- A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - h; i2 z- ^& ^6 c; I* [' d/ l! A
  55. #define STATIC_SHIFT                3
    1 j# V$ G8 C$ Q( p4 b
  56. #define TCINTEN_SHIFT               20
    - E0 n; A  R7 w7 o6 y
  57. #define ITCINTEN_SHIFT              21
    # R, l0 K. f1 B6 z1 Y
  58. #define TCCHEN_SHIFT                227 C+ k) C2 m; N! D
  59. #define ITCCHEN_SHIFT               23
    9 h, j9 [3 E, i% {. I% x( l

  60. ; r: X7 m+ T; y
  61. static volatile int irqraised1 = 0;8 [3 E! R3 [! ]+ Z5 o
  62. static volatile int irqraised2 = 0;
    . S1 i0 I5 F; _) h) W+ D
  63. * T; m# w' V" w% g4 Z; N: v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 S0 l. \6 ^8 j$ A! ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* x9 w" C1 f$ [- q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 _7 m  t8 a" G  [/ C, g6 l

  67. & _, [: W& O4 T  B7 u' l" E0 o. l; C
  68. dma_addr_t dmaphyssrc1 = 0;' R% i/ n0 E; O, g( w1 e
  69. dma_addr_t dmaphyssrc2 = 0;
    % J/ v, m( r8 j$ A  y* b
  70. dma_addr_t dmaphysdest1 = 0;
    6 B* g7 f7 \4 k' g. T
  71. dma_addr_t dmaphysdest2 = 0;
    " }  q% K9 v3 W9 y$ T. G
  72. 2 X8 K, O- g& n* n5 Q% V% ^: ~
  73. char *dmabufsrc1 = NULL;
    ( n2 e, H) M; i6 d7 v% b( W
  74. char *dmabufsrc2 = NULL;% _9 [; \8 ?4 O4 ?* j" [
  75. char *dmabufdest1 = NULL;
    # Q# a" I5 \" e8 S
  76. char *dmabufdest2 = NULL;  I) n2 T3 X3 n, Z  ^1 e" b
  77. 7 k9 I7 J) u" @6 g, }  `2 `3 ~1 S
  78. static int acnt = 512;0 M! m( c& L+ v# |" x7 u
  79. static int bcnt = 8;
    + y+ X* K$ v! @
  80. static int ccnt = 8;
    7 Y5 H) B. |2 n' D
  81. ( L/ k( w% u6 d; L7 ?
  82. module_param(acnt, int, S_IRUGO);2 [: X; X7 C( S, x: @% ?2 `
  83. module_param(bcnt, int, S_IRUGO);( D% |2 ^+ D5 h+ ~2 _8 p9 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; E& V" T; f9 L1 q" ~2 P
* k% k* P  {# I" S: P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* J. i9 M( T( }+ x( g/ a, f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% a, y$ y  v% f6 W2 r" V1 g. P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  t2 _* l1 o1 ?/ H

9 I# ~5 u7 U' g% m/ H+ x  V! G1 P1 H8 |" z) L, L! `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-16 00:29 , Processed in 0.045847 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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