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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 r; ^' i" D, E: P( t; k
  1. [code]EDMA sample test application% ^& z, \  z/ I, B6 a: @
  2. /*
    # I# D# k, z, ?! }* _; d" x
  3. * edma_test.c" O8 K% `6 `6 y5 C
  4. *! @/ |; s+ s9 Y& [- E4 F# h& u
  5. * brief  EDMA3 Test Application3 G! O6 O4 [, ?- q# g( s
  6. *7 v/ r6 U2 E) @+ G: [  ]
  7. *   This file contains EDMA3 Test code." i3 \6 O# T. ]
  8. *- |- s$ F  A3 ^! M0 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! _% H, `7 H2 F' T0 q2 M9 c4 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 G$ {) |8 e3 \9 p. O
  11. *         TO CHANGE.
    3 k4 |: I* G- e* u
  12. *
    ( ^1 M5 ?# ~6 i+ D  f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 A: t7 l1 e" T" c, z# N+ h
  14. *
    ' _: v& N3 ~" p! N" H, `
  15. * This program is free software; you can redistribute it and/or; Q2 X) j4 X3 W2 h
  16. * modify it under the terms of the GNU General Public License as
    ' r1 d3 g$ _- A+ o. E
  17. * published by the Free Software Foundation version 2.; c$ c, }5 U) }' {
  18. *
      k5 z1 I4 q5 \' b) O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 O" a! |+ x$ |7 n
  20. * kind, whether express or implied; without even the implied warranty  z: U' p9 b( X1 }' k4 o& _5 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * i, v2 f+ [/ i2 g" t
  22. * GNU General Public License for more details.9 {# ?- z8 J5 g+ u! N
  23. */8 y# e4 P, o& a
  24. 6 z- d7 a' j& O
  25. #include <linux/module.h>
    ; C# @% R$ i6 t4 [7 X# }" P
  26. #include <linux/init.h>' I9 T. d* k% I2 s; A% |6 C
  27. #include <linux/errno.h>
    . e# M2 a7 d+ C) |' V* Q9 s$ a! R
  28. #include <linux/types.h>
    ( w% T- X, U$ B& a, K2 ?
  29. #include <linux/interrupt.h>
    2 Q0 Z1 }! i5 Q! `4 w
  30. #include <asm/io.h>
    0 p5 ?: @' c/ z) Y7 K9 E# Z
  31. #include <linux/moduleparam.h>( l+ C; N8 I. c: Z5 V4 r. \
  32. #include <linux/sysctl.h>' p) |/ N5 {, d0 A- d4 C
  33. #include <linux/mm.h>/ G- M9 U' M3 `8 \5 F# F
  34. #include <linux/dma-mapping.h>" O1 C" a) Z: C5 f: `

  35. ; b' R' k) x* h# y) w  w
  36. #include <mach/memory.h>
    7 M: A; h0 j8 M1 x
  37. #include <mach/hardware.h>2 e+ S, ^& f$ H! S$ S5 A1 p2 H% `5 c$ @) ]
  38. #include <mach/irqs.h>
    * M" \$ y- D: Q6 T( u% W( w. m
  39. #include <asm/hardware/edma.h>* ^4 U" D  R7 Y- k# p

  40. + t% \) B3 {8 T/ q2 w8 r, e7 t& ~
  41. #undef EDMA3_DEBUG
    & s% ~4 g% W* V, P
  42. /*#define EDMA3_DEBUG*/
    - b" Q" U7 _8 r1 H+ V( `: Q
  43. ) G% E# Z4 |, j& `
  44. #ifdef EDMA3_DEBUG
    $ s# N% E' w, e2 H- `. p6 k- Q& }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . B; Z4 E) K9 e# I2 E" _( s( G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / ~# I: S- y8 ~% `5 d% ^. g3 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! A0 D! R8 h* S" w9 J9 x
  48. #else1 O1 @; G3 V& T" C) {
  49. #define DMA_PRINTK( x... )* }+ A3 |* |& R3 Y( b& B) @
  50. #define DMA_FN_IN0 B' c0 k4 [" Z" a$ \
  51. #define DMA_FN_OUT
    * `- X; F( n! g; [; T
  52. #endif
    % g  k! Y$ Z) R" Y" c

  53. - z; P8 G) \5 X- h9 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ c8 x8 n' d9 b
  55. #define STATIC_SHIFT                3
    5 b  j! Q( N. A
  56. #define TCINTEN_SHIFT               20* C$ [5 [; k6 ~5 t, t3 W( v5 S
  57. #define ITCINTEN_SHIFT              21' s7 W7 B- P% u* L! |% P
  58. #define TCCHEN_SHIFT                22  \" {8 `! j7 _1 g) x) c
  59. #define ITCCHEN_SHIFT               238 P4 g; A; W1 E; W$ q. [

  60. * b; i) h2 g6 L% ~- p1 B. V- }
  61. static volatile int irqraised1 = 0;5 }% _& Z* ]; ?. g, \& A) c
  62. static volatile int irqraised2 = 0;
    9 L+ q3 e) ~& Y5 J( j

  63. 7 U7 L# T# J& X/ j. P( @1 c0 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / W% D% j, P/ C1 o( ?: @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : N) K6 ]8 o1 ?5 R, C5 J+ e+ C2 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + p- @) S3 h& h3 q0 N* {9 E

  67. , T: }5 @) B# _3 J& Z, o2 m
  68. dma_addr_t dmaphyssrc1 = 0;9 Z3 [: t  A6 f( {; C. b6 Q
  69. dma_addr_t dmaphyssrc2 = 0;7 V3 e& }, ]. R% D3 L6 f$ ?
  70. dma_addr_t dmaphysdest1 = 0;( ~% N8 q5 K% t. ?
  71. dma_addr_t dmaphysdest2 = 0;
    1 U8 D3 Q$ \+ f4 Q
  72. 9 v* X" K  Y; U& i- p1 ^
  73. char *dmabufsrc1 = NULL;
    5 @* |# {2 u& f" F  R
  74. char *dmabufsrc2 = NULL;+ V8 \% |. Z* h, g0 B
  75. char *dmabufdest1 = NULL;
    ' w0 u1 P* R  P# Z
  76. char *dmabufdest2 = NULL;
    4 h3 K0 f  g( k

  77. , m; c9 v( Q' a% k! x2 ]4 ]
  78. static int acnt = 512;
    5 E5 k& Y$ K# L2 P6 W' j
  79. static int bcnt = 8;
    / A4 U4 d( \* Z- N) Z7 r# Y
  80. static int ccnt = 8;
    ! K' V* X0 S7 C+ `$ `
  81. & g- i5 [6 T) a% a8 b2 k; I1 ~8 h$ g
  82. module_param(acnt, int, S_IRUGO);$ N3 g4 n2 K( i7 _4 r$ k
  83. module_param(bcnt, int, S_IRUGO);
    - F: _. H! l# n/ k! K4 H! E  q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 S3 ?7 C1 ?% B8 a  v( F( o
! G7 `) K" ]% h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 F( Q5 ~0 e# I+ N' Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" ~) x9 t+ [, o& S+ V9 i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; h+ |7 P) |! W6 q: Z& B+ C" e

+ O) A& T! _0 L$ T) d2 I# L: ]; E) N# ~) d, q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-26 09:58 , Processed in 0.040515 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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