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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; q9 W$ g% @, Y% C( y
  1. [code]EDMA sample test application9 H+ l" {" b. b" ]( c! \0 w# n
  2. /*4 }# `9 i, B+ H
  3. * edma_test.c
    ! D+ I3 {+ V% L2 y
  4. *
    4 S$ m6 G' Y  F5 S% v0 E/ e
  5. * brief  EDMA3 Test Application
    : ?% i! E  g+ h% R* O  r& v9 A
  6. *
    1 D7 Q" `5 _1 y
  7. *   This file contains EDMA3 Test code.
    4 ^" q+ k" I9 |0 T+ D' J: J7 `
  8. *
    5 Q( [* _6 ^$ V) _9 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 O" s, ?7 e4 s! _+ X& k- y" u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# O) i+ |  @. b
  11. *         TO CHANGE.
    . m: l# Q% Z& Y. U& Y& M
  12. *
    6 i6 n8 K0 ?# z1 T! X1 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// m- o/ H6 x/ ?5 J
  14. *1 R2 ^& S* \- u4 \) j
  15. * This program is free software; you can redistribute it and/or
    + p: B  O. _3 j/ a$ Q5 o8 n
  16. * modify it under the terms of the GNU General Public License as
    * H8 F2 G$ M% n2 ]' C$ M
  17. * published by the Free Software Foundation version 2.
    - X  k+ `$ r" U. h3 J: O. j9 o
  18. *
    ) |  y. A/ I) t% Y' Y8 N. j1 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  f% L8 [- c4 S0 A' x
  20. * kind, whether express or implied; without even the implied warranty) P$ P. N2 ^! n9 C- q) ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! Z/ d0 I& {8 H- B
  22. * GNU General Public License for more details.8 y9 n5 ?8 u& e& L
  23. */
    / X6 M: W4 t  K9 ]

  24. : _* _: n- q8 r
  25. #include <linux/module.h>
    " M* k* ~; e$ W' W6 {
  26. #include <linux/init.h>, S/ ~" L( g5 E# q4 v2 @
  27. #include <linux/errno.h>
    - R" e9 e- e+ t+ {/ ?! ]/ ~2 v
  28. #include <linux/types.h>
    : V/ A1 ]& ?+ H$ ?
  29. #include <linux/interrupt.h>
    9 }  z3 y6 F" x0 H) |
  30. #include <asm/io.h>1 H5 [- V( W8 H# {' `
  31. #include <linux/moduleparam.h>
    1 ]! K" [" o6 y* L6 ~
  32. #include <linux/sysctl.h>. v$ ?' M4 G( E
  33. #include <linux/mm.h>8 o; w) Q- S4 }8 h( Y5 f8 S
  34. #include <linux/dma-mapping.h>  M4 t5 K9 M* e! r' J; r1 O
  35. , q" o9 V4 s4 p$ L4 A$ p
  36. #include <mach/memory.h>: u7 `8 A9 z4 v6 I, R
  37. #include <mach/hardware.h>& y& \9 s" P3 ]1 o
  38. #include <mach/irqs.h>
    6 H7 ]( ]3 W8 Q, z+ P/ o
  39. #include <asm/hardware/edma.h>, b& g2 d6 _' ^: \% t# M
  40. 5 j' |1 L" G: N, K) M# ?
  41. #undef EDMA3_DEBUG
    , ^8 {, W, F6 y$ e7 g; j
  42. /*#define EDMA3_DEBUG*/
    + b" R$ m4 X0 q$ e
  43. 2 }. k  ]& v1 f5 E, ^( X. F* {
  44. #ifdef EDMA3_DEBUG
    $ i" N. q0 S1 z4 S1 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 ~9 A6 \0 n9 H( W! a5 |7 X7 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ T! t& ]$ r+ V* `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 R5 H/ \# ~/ [( c: N8 \( a+ R
  48. #else5 K( N# [- z7 i7 i4 ]# o( q
  49. #define DMA_PRINTK( x... )
    * b! j6 Q( d6 k/ [
  50. #define DMA_FN_IN
    ' K5 v8 w' G6 w; `# J& e% m4 h
  51. #define DMA_FN_OUT# Z0 l& C7 G4 z8 Y. l
  52. #endif
    9 _0 _: @! u( ^' Q. E
  53. ! u- x$ R  H* Q/ k' E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( V2 x' H- m1 F" U/ k0 y
  55. #define STATIC_SHIFT                3
    ( @% L5 \) h) _3 e, C* I
  56. #define TCINTEN_SHIFT               20! z5 m9 d/ F& R9 `4 O: Z! }
  57. #define ITCINTEN_SHIFT              21- v$ S& V$ E) w) n5 m  z
  58. #define TCCHEN_SHIFT                22. |: a' J! [  @7 b+ s( }
  59. #define ITCCHEN_SHIFT               23$ q- f! s: Z, q7 [

  60.   {. t" y1 |: M3 e" q- W! p4 A  |
  61. static volatile int irqraised1 = 0;
      G. k% t* e" a: q
  62. static volatile int irqraised2 = 0;) R. h& J0 c2 v

  63. 9 z8 A% b' L- h1 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 z* V; L% F+ v6 [7 ]5 g' b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( f( t& m/ }( c9 R. M9 e& P# w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % \3 }+ d+ q1 O. ~: f
  67. 0 ?  U' x# P" C0 N. c
  68. dma_addr_t dmaphyssrc1 = 0;' ?4 n8 t* q7 j* _! ]
  69. dma_addr_t dmaphyssrc2 = 0;
    : f6 `  h3 K% g  H7 [/ L
  70. dma_addr_t dmaphysdest1 = 0;  Y9 k! Q$ \, Q9 ?  T4 ~' d7 I
  71. dma_addr_t dmaphysdest2 = 0;
    / J4 c' l. f; V5 E( g+ i

  72. 2 s$ J/ h3 K# k% W$ R  S5 h! b# H- x
  73. char *dmabufsrc1 = NULL;
    1 d" R6 n. K: `: E' r
  74. char *dmabufsrc2 = NULL;- U2 e+ W  O. f4 S( P  [
  75. char *dmabufdest1 = NULL;2 z, K+ {/ c# P3 {
  76. char *dmabufdest2 = NULL;
    & c  i  U! F! B' R3 I
  77. 2 r7 [! d" H0 y) o
  78. static int acnt = 512;
    - t* i8 U0 h' T, Z, v2 a, T
  79. static int bcnt = 8;
    # A; O5 a: x% h3 A2 _1 U  r. U% C# Y
  80. static int ccnt = 8;
    # Y4 F$ ^; S) U
  81. 8 U2 i- _/ I+ t6 W7 A9 {+ M
  82. module_param(acnt, int, S_IRUGO);
    % W$ v" a* G6 I1 V# _
  83. module_param(bcnt, int, S_IRUGO);9 T" L, a& G# Q- p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 x. e2 \/ g( s: x: q7 o
' v7 s2 m/ _) z  ]9 s! x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( d) g$ |1 j( f7 Z2 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 v: q0 I2 D9 ?" [5 \8 L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, h1 G) D  y7 i; k

7 o6 l' a! l0 g7 _$ N6 Y! m2 X; w* o- l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 05:29 , Processed in 0.040067 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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