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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ P# U  h) E4 e& ^+ e
  1. [code]EDMA sample test application3 P- ^- l3 J$ H- x1 u) F
  2. /*! v' k+ h0 E' n
  3. * edma_test.c5 z0 ^% H; t2 m5 b! D' T: }
  4. *
    6 g8 Y9 h, i- ?# E4 l" ]
  5. * brief  EDMA3 Test Application. j, Q. I4 R" |1 s6 I2 Z
  6. *
      y: x1 x% ?3 [8 f' s# K$ _
  7. *   This file contains EDMA3 Test code.3 l, c) S% X' X1 K
  8. *0 \) |& _8 a: F6 }6 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % E0 }% m3 O- N- _! f1 |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! Z; c0 N/ `( Q6 V5 E/ j; i4 {; j
  11. *         TO CHANGE.
    # ^% f5 `+ o  P7 E9 s
  12. *
    3 I3 e* x1 j; q6 U' P4 B1 b1 e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' H) i5 _8 q/ I9 l. f9 c: S
  14. *% t# S4 z1 X& T  F1 z7 \
  15. * This program is free software; you can redistribute it and/or
    " {/ k* c# F2 p& k
  16. * modify it under the terms of the GNU General Public License as4 G. _, c7 [+ U1 R0 B7 T9 ]
  17. * published by the Free Software Foundation version 2.
    0 M, y9 N) r; b! K9 I7 L  W
  18. ** W; E" \- M# \6 Y2 z& @. A0 n& d  S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! S; f& m* R/ R. d
  20. * kind, whether express or implied; without even the implied warranty* H% c+ A5 m$ H# Z3 L* m/ D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 @6 p4 i, Z+ v" {
  22. * GNU General Public License for more details.
    8 R# y  ?4 i+ w) @3 R
  23. */
      k* R: E& s: f! Q( r8 p  P

  24. 9 T: G: j( ?! o  \
  25. #include <linux/module.h>
    " h1 h8 `7 b$ M) f# r( w
  26. #include <linux/init.h>
    0 Q1 n" c# Y/ `  N5 S
  27. #include <linux/errno.h>2 k; O) X( k6 T  Y0 q
  28. #include <linux/types.h>
    ' G0 O3 L$ i% L% V+ H
  29. #include <linux/interrupt.h>( A; ]$ B; `6 v2 J5 S
  30. #include <asm/io.h>( o) c2 ~4 L/ K; g
  31. #include <linux/moduleparam.h>
    3 D# k$ g2 J0 c: O+ {
  32. #include <linux/sysctl.h>
    5 c4 U3 a* X, F4 N9 C
  33. #include <linux/mm.h>, f$ G1 Z% f$ Z% }8 m8 g
  34. #include <linux/dma-mapping.h>. D. y- y! \/ |2 j+ h

  35. 2 H5 A8 Y, O' ^& Z) _; T
  36. #include <mach/memory.h>+ M: S% i' @0 k4 k2 @5 p
  37. #include <mach/hardware.h>
    2 r" C9 ~) s3 X1 e+ f
  38. #include <mach/irqs.h>+ H/ ?4 }1 X+ p' F
  39. #include <asm/hardware/edma.h>
    3 @% W4 }2 ~; W8 M2 _

  40. / [6 ?& l8 h( y- A4 a
  41. #undef EDMA3_DEBUG
    % O$ ?5 l& v. Z  n  H
  42. /*#define EDMA3_DEBUG*/! @6 j5 I& R& a' Q) O1 G7 x+ j+ p
  43. 3 r1 }2 s' g3 h% ?
  44. #ifdef EDMA3_DEBUG1 @: D/ D; b2 N& Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 a4 ^5 u6 m/ s/ `3 o9 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); `5 W' i2 |2 D" T# p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) F* z$ L* ~* i4 X# o4 F
  48. #else) E% B) _8 {8 h% h7 R: k
  49. #define DMA_PRINTK( x... )
    $ H6 `) E9 E1 i6 _, k3 N: M4 |! ]
  50. #define DMA_FN_IN
    " y+ E( y. T6 s4 Z& V% {
  51. #define DMA_FN_OUT: m1 c: G9 ^8 R& g- ^6 k
  52. #endif
    ) W6 y' h5 w. }- d. F
  53. - v, B$ D, v* A- @6 m; n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' F; ~6 Q0 l) U; S; p, o/ U
  55. #define STATIC_SHIFT                3
    9 g& n4 \5 m6 T. N8 R- f: w
  56. #define TCINTEN_SHIFT               20
    7 E: V. X$ m7 w# M$ U
  57. #define ITCINTEN_SHIFT              214 P* L4 p" W% o2 Q
  58. #define TCCHEN_SHIFT                22
    + [' ~; S8 r* i# V$ w
  59. #define ITCCHEN_SHIFT               23" f5 p: [3 w* Z9 h( f6 d$ q$ i, r$ d. f
  60. ( b5 ?* N  }% L/ V/ T# E) G0 A' |
  61. static volatile int irqraised1 = 0;
    1 c! V* z9 W) A2 P8 b1 c, s
  62. static volatile int irqraised2 = 0;
    , U: w9 `; v' s# n7 B4 D

  63. " g; z, l5 s1 S9 ]' G: ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 q3 L: A9 J; `3 |! Y( A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, E0 S; f9 O* W8 z# ~2 P7 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 F& }- T: P5 W$ c1 O  P% F" }
  67. " J/ x# P4 r/ e2 L* z
  68. dma_addr_t dmaphyssrc1 = 0;4 Y' a1 h! p; r( ?
  69. dma_addr_t dmaphyssrc2 = 0;
    & r, s( ?3 k- q% b' `2 q+ u9 s
  70. dma_addr_t dmaphysdest1 = 0;
    & H1 N- X" H( L0 x
  71. dma_addr_t dmaphysdest2 = 0;
    + y( \/ @1 V% ^) d, a
  72. ) H5 P2 R/ D# m3 R
  73. char *dmabufsrc1 = NULL;
    ! g: r/ Q; H; S/ E& q( d/ P
  74. char *dmabufsrc2 = NULL;
    # T9 F0 C0 x8 a2 m$ H. Z
  75. char *dmabufdest1 = NULL;
    6 E- O9 V/ k( p. M8 R2 N6 D, e
  76. char *dmabufdest2 = NULL;) Y% d: p: H* `# ?$ f+ @8 Q9 |

  77. 7 D2 y" W* f  z: w) g, [! @$ X
  78. static int acnt = 512;
    7 J3 B% y8 m* n; F
  79. static int bcnt = 8;3 z& K$ e' ?  C
  80. static int ccnt = 8;! s) w; Y) t- Y$ M( h

  81. 1 G* a/ G0 T6 w
  82. module_param(acnt, int, S_IRUGO);) |5 g! b# i; a% U0 f' Q
  83. module_param(bcnt, int, S_IRUGO);2 W! i2 x' l7 g3 l8 M' n' t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 O* f$ p5 b! |8 Q2 O1 `
+ ~8 F" J+ c+ c2 \* j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 _2 G0 R( w  h' T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ g5 \# y  E& q" W7 B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- a9 _$ [: [4 L% L
$ o- E4 b& M2 i0 I5 Y( L- f: x) y! e2 _( J9 p* k4 R8 ]4 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 01:59 , Processed in 0.047350 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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