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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 _- O5 y  H3 H% c2 Y: {
  1. [code]EDMA sample test application6 i- A; U6 H( K; O7 C# q  p* g/ ^+ ?2 m
  2. /*% x7 l+ B% h0 x5 {! J, S6 J- Z, Y
  3. * edma_test.c) _. @2 v1 i$ j9 o/ @0 t
  4. *
    8 v% ?% A+ ?: h4 x1 Z
  5. * brief  EDMA3 Test Application
    ! W( d! v5 W. s! P
  6. *6 U4 J* z: w, u9 q, M6 A2 y# I
  7. *   This file contains EDMA3 Test code.
    : [8 J5 h" e2 V/ p5 `
  8. *
    ! b6 u' o2 U/ ?# w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      @. u/ |8 C/ v% _+ i% }, D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 M8 u8 t* Y, P" i% {
  11. *         TO CHANGE.
    $ C$ J6 j: U- h  ^6 p0 E
  12. *
    ' }1 L/ D6 a" Y4 j/ k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  m, P4 R  [5 Z3 O
  14. *
    7 s) e/ R  D6 V$ [
  15. * This program is free software; you can redistribute it and/or  o2 O8 u2 C" X; L# M( F
  16. * modify it under the terms of the GNU General Public License as& \: H7 p# @/ i& b! F6 J- a' V
  17. * published by the Free Software Foundation version 2.$ O0 y$ Q1 h3 _5 ]" S6 C
  18. *
    4 K, C7 O6 q3 F; R& T  @7 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* k9 n3 n1 ]- o1 ]7 s# s- A
  20. * kind, whether express or implied; without even the implied warranty: i5 H5 x  N( w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . ?# {) h4 p$ d0 J. X1 J1 F0 m9 U. |
  22. * GNU General Public License for more details.( [. U2 N% q9 N. O$ v
  23. */
    & u: c: v% Z( @, J
  24. & a# W, k8 m8 r7 y
  25. #include <linux/module.h>5 W. Y2 W+ {, _
  26. #include <linux/init.h>
    & }, A. z* w2 T; w
  27. #include <linux/errno.h>
    5 o1 z* u/ T; a8 C& _3 s
  28. #include <linux/types.h>
    3 u, n9 Z, Y# g1 j8 t
  29. #include <linux/interrupt.h>& E! z: @$ d* v# m
  30. #include <asm/io.h>
    7 |5 y# f1 v0 Z/ W1 S
  31. #include <linux/moduleparam.h>) U6 e6 }' D8 H- g( U4 ]5 f/ E! q4 K
  32. #include <linux/sysctl.h>
    ' w1 L6 A# O( n+ w
  33. #include <linux/mm.h># W  [, z6 k# I! ]( h- n% A
  34. #include <linux/dma-mapping.h>8 C$ s, }# ^/ C8 \+ ^7 n

  35. & O4 g8 z2 Y( }& u5 L
  36. #include <mach/memory.h># w! v, Z. i. i. b
  37. #include <mach/hardware.h>
    0 V- Z$ J, B5 E1 g1 a
  38. #include <mach/irqs.h>
    ' R1 \, C7 y1 d/ i7 y4 C# Z
  39. #include <asm/hardware/edma.h>
    - L, s8 f( f4 X2 k. n1 U7 T9 \
  40. 5 g! p" G8 G6 ?- U
  41. #undef EDMA3_DEBUG
    / l5 |7 G; ?* x% C
  42. /*#define EDMA3_DEBUG*/4 [2 o  n& M' z3 r
  43. 0 E8 C) p( _- _; [
  44. #ifdef EDMA3_DEBUG, G! X( i7 V1 i2 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % j: K- J4 W# s0 t% }# o+ r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 ~* R9 U/ v  |% o% r5 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " N! X2 W, o6 Y% a) F& j6 F
  48. #else/ X' @' k! N9 D9 g4 [+ \+ \
  49. #define DMA_PRINTK( x... ). Z. h0 J* m( q  O2 j; a* a
  50. #define DMA_FN_IN9 G( z# z+ c4 ], n6 S
  51. #define DMA_FN_OUT
    # Q0 ]% z( h# d+ x8 D- e
  52. #endif! e: ]; Z' A+ w/ j6 b0 D

  53. 1 A8 u/ D, a8 w& i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 |, g# w5 f, P% T' j( F
  55. #define STATIC_SHIFT                3
    6 ]/ V, r1 v3 ]/ V1 y% I
  56. #define TCINTEN_SHIFT               20' ?; x' s. O' {9 i
  57. #define ITCINTEN_SHIFT              21! g. b0 I4 i: h3 S, [2 a, @3 r
  58. #define TCCHEN_SHIFT                22
    & A' Y) z! `8 i: e
  59. #define ITCCHEN_SHIFT               23
    " G4 p$ w+ t8 r! O8 b# @$ V

  60. . e: r5 H8 f- S/ g
  61. static volatile int irqraised1 = 0;7 b( ^; k# e4 B9 e. p
  62. static volatile int irqraised2 = 0;
    : ^1 S4 f+ ~( u$ K
  63. + A1 {$ `1 I8 \) P$ G! O7 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " `' s6 C/ A- z& W, {+ a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * Z5 J' G4 Q) h" N! E) m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 {" q: Q( N4 \% d  D
  67. : k7 v  R9 O0 H7 l% |  k/ l+ j
  68. dma_addr_t dmaphyssrc1 = 0;
    ) I* j; g6 b) a
  69. dma_addr_t dmaphyssrc2 = 0;
    1 R. U0 _: s  @
  70. dma_addr_t dmaphysdest1 = 0;
    , F9 j% W( s, i% X, b
  71. dma_addr_t dmaphysdest2 = 0;
    9 R; Z/ h2 O* R, r. u6 @
  72. ) ?7 t) I' V  y% T1 S
  73. char *dmabufsrc1 = NULL;: M$ Z" `5 n; y9 O) Z1 v9 E
  74. char *dmabufsrc2 = NULL;7 _- a7 j; a3 t& g/ F9 _
  75. char *dmabufdest1 = NULL;
    8 K2 V  a' Z6 z2 D8 Y; ^9 D$ `
  76. char *dmabufdest2 = NULL;
    ( F* X6 u6 h, u" Z0 _; w# N9 J
  77. ' w5 @# w( a3 q6 K; R
  78. static int acnt = 512;
    4 H. z3 r$ Q* Z) H
  79. static int bcnt = 8;- S% C& M! \& o, S
  80. static int ccnt = 8;
    # x/ u9 z, _7 N& `$ X. R" ]

  81. ; j2 I- P# t. T" j8 O4 g
  82. module_param(acnt, int, S_IRUGO);
    3 A1 A: O! d. |2 n6 s0 I
  83. module_param(bcnt, int, S_IRUGO);
    8 a  A: x0 R% m6 I2 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% g2 E6 k4 m; y3 f( j& x, `3 ~) C
/ a1 Z. D$ V; b# C5 t/ n& _( H5 ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; f+ V* S8 N7 H' ~: u+ @" `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  b, s4 b/ d- v( b& Z% X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 ]' B# A7 B1 i

, w3 Z5 D3 \- u# J: `$ f1 o* _( D6 Y$ P) O4 t- U+ @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 11:21 , Processed in 0.045477 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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