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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 |& k1 q; {6 x9 }! L0 A2 H
  1. [code]EDMA sample test application! e; E, D- |- `1 |  T/ ]4 Q$ o
  2. /*
    1 ~6 E, [' r: t) h. U9 Z7 Q
  3. * edma_test.c; J8 @( i' ^2 w% b
  4. *1 J# k$ s# T% B7 C
  5. * brief  EDMA3 Test Application, _; ?  e/ i- C0 M
  6. *7 N% y' e) N6 U  c" Q4 ?
  7. *   This file contains EDMA3 Test code.0 S! q9 Y2 o; }
  8. *5 p# ~+ t- w' G( e- t7 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) W) m- T) `. {6 [; m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# V; V* L/ W! y6 `  |
  11. *         TO CHANGE.
    2 b' ~% u9 a' Y8 l& W: G( c
  12. *
    2 J2 [% u% _4 I2 J/ e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 N4 P. S) |+ H8 k6 C9 M
  14. *. }: X& |! I, d( i
  15. * This program is free software; you can redistribute it and/or
    ' k% x+ y& F( H+ G) {) ^
  16. * modify it under the terms of the GNU General Public License as
    ( S9 u! Z0 D9 h. m3 m5 Z
  17. * published by the Free Software Foundation version 2.+ t; w6 o) ]$ N* S2 B
  18. *
    7 u* r8 Z* a, R2 m8 H8 b, W6 [5 Z9 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' W& Q. G  M5 z
  20. * kind, whether express or implied; without even the implied warranty
    / h( O$ C& p7 K# Q0 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # h. Z7 E* s: j+ G  a0 A
  22. * GNU General Public License for more details.
      X0 j8 M; N+ A1 c$ R7 n* G
  23. */
    . r8 r$ D/ w$ v% g
  24. 8 x0 Y5 `% ~! M& @
  25. #include <linux/module.h># w0 w  q8 s% ]: ]( r
  26. #include <linux/init.h>
    * E" r2 w: k9 k+ Y! c, q
  27. #include <linux/errno.h>
    ( S# b7 B! T0 ^1 \0 v9 b# x
  28. #include <linux/types.h># m- Q/ V8 K" m& C; h
  29. #include <linux/interrupt.h>
    7 G- q9 Z% x* z  N
  30. #include <asm/io.h>" E7 D2 u5 W7 L# W. I7 g
  31. #include <linux/moduleparam.h>+ D1 k5 r3 f) \
  32. #include <linux/sysctl.h>
    # V5 B6 D9 }  c2 j' G& Y) X
  33. #include <linux/mm.h>" b2 V; ]# I; V* ^* ?
  34. #include <linux/dma-mapping.h>
    2 S, `1 I& ~- {: ?6 x! O, E% R- @) }

  35. ( p# W5 l2 L4 C
  36. #include <mach/memory.h>$ J4 `: j3 O# l7 s
  37. #include <mach/hardware.h>
    9 {8 s# g7 h* B2 V: ]9 j5 [
  38. #include <mach/irqs.h>7 ?2 e" ?5 \* v8 N$ S
  39. #include <asm/hardware/edma.h>
    $ |9 @( }9 n2 c6 Z- ^. I$ v  a

  40. % w& Y* U; c9 t3 d
  41. #undef EDMA3_DEBUG7 Y7 ], B0 \+ p8 M
  42. /*#define EDMA3_DEBUG*/
    4 ^2 @, h, s" c- b
  43. " [4 t$ ]) J9 ^; r* A  J  `9 Z4 G+ X
  44. #ifdef EDMA3_DEBUG
    ( }- k$ c. i9 m7 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 \+ n8 x( x' B7 g  F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 I7 ~1 H" @+ P: S' P7 \- a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " h) U) r% @/ Q3 G+ D
  48. #else
    . T7 F0 C) `  ~; [5 W, o$ F
  49. #define DMA_PRINTK( x... )
    0 _' O+ @/ E6 j( w
  50. #define DMA_FN_IN2 X# n( w) _( {8 F( g( V3 `$ C; H
  51. #define DMA_FN_OUT
    $ M. O  o* Y' m( ], h3 g
  52. #endif1 F8 e& ]" X/ `

  53. ! I' L7 c4 w. N) `4 e! u! F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 n& Z2 ]) D. W# l/ K" r: F
  55. #define STATIC_SHIFT                3
    + ]) ?% v8 k' V$ t! u
  56. #define TCINTEN_SHIFT               201 Z; d% t9 d  n" M. F- a" i% \
  57. #define ITCINTEN_SHIFT              211 t, A$ t* n1 a# }9 k
  58. #define TCCHEN_SHIFT                229 X2 r) ?4 D+ f$ P  M
  59. #define ITCCHEN_SHIFT               23
    % M$ O' j8 D/ n4 y5 O( q  i

  60.   G1 r$ b  u) P
  61. static volatile int irqraised1 = 0;. g; r- H! C2 i5 J
  62. static volatile int irqraised2 = 0;
    ! Q# H. `3 Z$ |* M: O! K; }! g

  63. 3 G$ G. @" Q! ?4 x7 b& Q2 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) h2 |, U% H+ Z1 L  I  d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# R9 B/ \5 `) m& Z" b$ }. q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & g; H9 r. _5 x( S* z$ D

  67. / D9 s  F  Y9 U- g: C( g
  68. dma_addr_t dmaphyssrc1 = 0;- T' `4 O- D/ F4 E/ v
  69. dma_addr_t dmaphyssrc2 = 0;, q$ {+ f# w9 ^3 q5 z# N
  70. dma_addr_t dmaphysdest1 = 0;
    * R4 F2 `' L, o1 w: C0 V
  71. dma_addr_t dmaphysdest2 = 0;7 F0 v3 E5 @& g: C5 a
  72. 2 D* q/ b$ i+ G6 Y% U
  73. char *dmabufsrc1 = NULL;7 E" n. c9 \) w+ M0 x
  74. char *dmabufsrc2 = NULL;
    - _9 s, o. A  L+ [- ]2 X4 C" o, V
  75. char *dmabufdest1 = NULL;+ s3 E' }9 @6 P  v: l- ?3 H6 m3 D
  76. char *dmabufdest2 = NULL;0 r8 u8 e' l7 x) g

  77. ' R5 a* q, J* B9 C; U/ n3 K. W
  78. static int acnt = 512;
    + o. C- l; k& ], [9 V9 |
  79. static int bcnt = 8;: X5 c4 t" v/ `4 j
  80. static int ccnt = 8;
    " r+ a/ A- ?, E* i3 ^
  81. 7 d$ {3 C7 c7 W  ~" R5 ~2 M9 M
  82. module_param(acnt, int, S_IRUGO);, @  Q" b0 Z/ ]( [
  83. module_param(bcnt, int, S_IRUGO);
    # m" _( j  f* `* |1 k0 r& Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 n# f$ u% {; f" b
9 x. @2 x4 K/ l$ I+ b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; F7 y0 |5 A7 t8 v, m3 ]+ Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) y* d% }$ }8 ]9 c1 A& G' ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ ]) P+ j' j6 x# i
1 i9 x6 S) [+ O8 f. p
6 i, V* o5 O& l- V( b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-31 07:07 , Processed in 0.037265 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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