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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ A/ ^, R. g1 p) _$ [, H$ {; i
  1. [code]EDMA sample test application
    % [. C3 n4 X! E+ }) ^1 O
  2. /*
    ' ?6 z) P9 y- B/ @. m
  3. * edma_test.c# L; G1 r5 V3 P- j* }
  4. *
    + K" U* S% e; n$ {
  5. * brief  EDMA3 Test Application
    ( \% X" i7 Y5 \7 T/ _+ h
  6. *
    ; W  ~( i: r! P& U
  7. *   This file contains EDMA3 Test code.! w3 e6 F$ V9 E
  8. *& ]3 z5 ?; B; r: R3 x  p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 Q4 g3 K1 m! C: L8 Y( q# L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! \' K3 ?- O2 F5 t6 n- N
  11. *         TO CHANGE., h2 m$ K+ D* z5 b1 ^0 d' |8 x% z
  12. *
    ) M* v% X) H4 g; @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% l. u/ {2 p$ M/ x5 t9 z
  14. *8 `0 H& h7 j8 e) n( H3 Y
  15. * This program is free software; you can redistribute it and/or
    , Y: N) T5 ?. h7 w
  16. * modify it under the terms of the GNU General Public License as
    $ R( O  p) }  U9 Y* \0 x
  17. * published by the Free Software Foundation version 2.9 t" j* C2 I7 ^, z
  18. *! T8 |+ z1 D' \5 r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; C& o/ Y2 p9 ~. L
  20. * kind, whether express or implied; without even the implied warranty: J- n! _# }) ]: C8 ]4 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- b% `/ C8 W; q- R) Q3 V
  22. * GNU General Public License for more details.1 |$ g2 N: m$ |! X
  23. */" g3 Z% o$ e! M6 g8 ^2 `  Y
  24. ! q0 p, C; z; Z4 T
  25. #include <linux/module.h>
    1 t( q! k: _8 w. e6 S& k; o
  26. #include <linux/init.h>
    1 b" q2 Q& u* p& c# _7 c# T# G9 O  c
  27. #include <linux/errno.h>
    4 l% x/ f1 H$ w; b6 b. Z* T
  28. #include <linux/types.h>
    $ Z8 N8 A3 X$ L+ T0 d: z  i( H
  29. #include <linux/interrupt.h>
    ; |1 A% `! o( e8 `9 T6 W" X; c
  30. #include <asm/io.h>
    : B3 F! x- y+ L" a4 m) p
  31. #include <linux/moduleparam.h>
    ) Z" {% v; f( W0 ~
  32. #include <linux/sysctl.h>
    3 r6 Y' p! a* f  _& p* _' I
  33. #include <linux/mm.h>
    2 |9 {, n' }. {% }8 V6 B: [
  34. #include <linux/dma-mapping.h>: p$ [" F! E5 u# F4 F. b1 U
  35. 2 S, R* I8 C& S8 S* \
  36. #include <mach/memory.h>
    3 ], ~  C& ^7 U9 m0 g1 |
  37. #include <mach/hardware.h>
    3 z& Y  d" d: [$ R8 ]: j2 F
  38. #include <mach/irqs.h>
    $ B4 ]/ ~3 `0 p! P" v
  39. #include <asm/hardware/edma.h>
      U! q' Q% b8 {0 `

  40. * H. l$ m0 v! p3 l
  41. #undef EDMA3_DEBUG/ X4 C6 i8 J2 a  g1 O4 `
  42. /*#define EDMA3_DEBUG*/
    + w, o$ N; M* `5 _: v
  43. ; L5 A0 d, u  w. a
  44. #ifdef EDMA3_DEBUG
    - G$ `2 f$ }  _- f- K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # |( P0 |% F( m' w) t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' b5 i6 S4 R! ], w6 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 ]% I! L/ n' }) x( ?
  48. #else9 W7 P* Q, e4 u9 u! g; o4 n
  49. #define DMA_PRINTK( x... )6 d: T/ D; [1 N& j: h* r
  50. #define DMA_FN_IN
    , }( ~0 Y2 L8 B# g% w" n5 `1 g
  51. #define DMA_FN_OUT
    $ B* N& d8 T: \2 m. V
  52. #endif& J( R& l3 b% _! v+ D  y

  53.   T6 [& j. q7 a3 D. K' n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 m4 p+ Q/ B5 m0 N  g/ n! o6 e# g
  55. #define STATIC_SHIFT                3
    0 p) O) V% y( V: _
  56. #define TCINTEN_SHIFT               20; M' h) [6 q' x. z) Z
  57. #define ITCINTEN_SHIFT              21( y" t& B1 ]2 U% c- O
  58. #define TCCHEN_SHIFT                22
    $ \$ M/ U- \& A4 i0 O9 I' o/ t
  59. #define ITCCHEN_SHIFT               23
    6 Z: }5 C6 I& ?1 h% I+ V7 i& l+ u

  60. & p6 s- X$ O. a- m1 v7 Z
  61. static volatile int irqraised1 = 0;9 I! m1 k# c& a6 M9 O. z
  62. static volatile int irqraised2 = 0;$ v- x: Z3 {$ }5 Z. C

  63. 5 S2 r, e0 i" g! [, k" @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 [6 b4 o8 Q7 z- b* S) U. o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ {6 w! z' J; K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  B- d6 Y3 i& E1 g

  67. ; h: H. d0 T( _4 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    8 D3 m, o- u; ]) V8 q7 O" j0 F
  69. dma_addr_t dmaphyssrc2 = 0;
    5 y. \4 R9 C( H4 s2 g
  70. dma_addr_t dmaphysdest1 = 0;
    2 z9 O6 K1 m+ `# H6 y/ d- Z1 \: M
  71. dma_addr_t dmaphysdest2 = 0;
    & v/ i( a) b4 \$ [( p, Y
  72. * @' V  B- W, w8 t4 f8 |8 A
  73. char *dmabufsrc1 = NULL;
    * S- e$ w4 f# q  F" |) P
  74. char *dmabufsrc2 = NULL;
    " ?) X' T7 L" `) _) A* X* K: w! T, k
  75. char *dmabufdest1 = NULL;) s# s7 Z+ Y# v- c
  76. char *dmabufdest2 = NULL;
    , U5 [$ `! G( w3 x
  77. $ v* d5 u: {4 F
  78. static int acnt = 512;. i( E  a: o; m; M7 H" J+ J! k
  79. static int bcnt = 8;
    " N- M: Y- q3 ]
  80. static int ccnt = 8;
    0 Q- v+ B* K& \: O0 J! P. ^7 E
  81. # |) s( s* _  q) S. E
  82. module_param(acnt, int, S_IRUGO);
    - O' M6 a3 d2 i
  83. module_param(bcnt, int, S_IRUGO);
      v9 ?  F1 ~# e* U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ g" m0 i; S8 R( g

1 u3 v" V" j& L9 y4 T5 ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: O, W5 ~3 v: r# varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ s* k$ r  H5 q; Y" w7 c4 w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ G" u5 E) G% d
) t8 ^& [' L; l
% g8 T# _4 ]4 S2 H/ k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-13 11:18 , Processed in 0.036551 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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