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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 h. s& I6 W( l, N1 Y
  1. [code]EDMA sample test application
    0 Q5 S4 t8 W0 J: Y1 {3 k1 l
  2. /*
    1 }% ]# a& q5 k! Y% b! l( m7 i
  3. * edma_test.c
    0 p7 a* m9 p1 p  i' V1 y
  4. *
    # i3 f0 R* H8 {2 [1 Q3 A, `
  5. * brief  EDMA3 Test Application5 C: w: c4 z& k" _1 ~
  6. *2 c) s. C/ G2 k. v- b
  7. *   This file contains EDMA3 Test code.& L3 i9 |% X' x, U( O% n
  8. *8 l0 R; t" |, ?+ [/ z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      B7 n6 w4 ^; K9 b' t: x2 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , h( {. J4 [- V+ P2 T
  11. *         TO CHANGE./ }1 Q" h) }& o" K5 j! _8 h( Y
  12. *
    ) ?) E& |, l/ g0 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! K( y9 V. |" m* t! R6 ?
  14. *
    " ^( L! i9 H* R0 v% ~- K
  15. * This program is free software; you can redistribute it and/or, x( J# ~; U; e
  16. * modify it under the terms of the GNU General Public License as
      u( r" V& Y( G. ~
  17. * published by the Free Software Foundation version 2.
    , w' ^4 c# |. l# |4 @. ]( }
  18. *
    # @( Q4 |3 d7 E, _9 ~$ ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 Q# Z# M. y+ |7 E! m" b  y
  20. * kind, whether express or implied; without even the implied warranty
    5 `# @! Q9 ?2 G8 x& U4 X4 N9 a8 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- Z0 i' @/ h) A* P* J* q
  22. * GNU General Public License for more details.1 B5 M" L- b6 R: t, b
  23. */
    6 \: }5 d' z- M7 v4 X% ]. V/ ~/ L
  24. & G% P8 {& Q6 p, Y
  25. #include <linux/module.h>
      `( H. Q& {7 j0 p1 {( \
  26. #include <linux/init.h>
    % Z$ |, I8 t2 B  r7 U0 `! t" N- `
  27. #include <linux/errno.h>5 `6 R! z# w/ O- N0 l) K
  28. #include <linux/types.h>! ?1 O- s" x: _/ B
  29. #include <linux/interrupt.h>
    7 f; Q- O1 o7 Q% o& A7 ]
  30. #include <asm/io.h>
    / S, z! P- K0 Q. w  ?
  31. #include <linux/moduleparam.h>' G. {! o( I& T8 k" P
  32. #include <linux/sysctl.h>, l0 N& g% z3 t+ Q) {6 g
  33. #include <linux/mm.h>
    ( R5 m; p: T9 b
  34. #include <linux/dma-mapping.h>
    ! E! C" A% Y9 N. P& Z# q7 ^

  35. & @3 G( [5 r1 I5 |8 N' l
  36. #include <mach/memory.h># i: s: u+ k1 W- |
  37. #include <mach/hardware.h>
    5 d" J* f3 P0 X) U. N
  38. #include <mach/irqs.h>  M3 R1 @, D: A" m# |# n
  39. #include <asm/hardware/edma.h>: e7 v& H/ ^& d* [: j+ o

  40. $ f" O' J) x  W, R7 n( K9 d3 ?; z3 s- r
  41. #undef EDMA3_DEBUG7 I) H5 b& P! E8 N
  42. /*#define EDMA3_DEBUG*/
    * G" _, R$ ?& E, Z8 J

  43. ' E; n7 W: h+ S, h: `
  44. #ifdef EDMA3_DEBUG2 j8 F, E* I6 |/ m  i0 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ e1 p, n3 i# R: C8 t* c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* |7 U7 \# O- {- l5 @1 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % B1 p% \' q1 n) [8 W) \
  48. #else
    , S8 N$ e8 f  o4 s$ K
  49. #define DMA_PRINTK( x... )' w. F  K' }1 \/ w8 Q/ m
  50. #define DMA_FN_IN3 O) y8 M5 H& y- ^8 @& w
  51. #define DMA_FN_OUT: x; x8 s! S- O1 a+ |
  52. #endif
    - ~& ]8 \8 ~0 O1 \0 V
  53. 5 ?1 w6 _4 l( G1 `, o" k5 z  X( c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / W, F. {8 q4 u: m# o0 m/ F2 d
  55. #define STATIC_SHIFT                3
    % q) |! c% ^/ O0 R
  56. #define TCINTEN_SHIFT               20
    # n% z( L5 I; b4 u6 V2 v4 ]6 S
  57. #define ITCINTEN_SHIFT              21
    + |% r# W: |  u6 e
  58. #define TCCHEN_SHIFT                22" w4 f( C4 W( N, a* j, I
  59. #define ITCCHEN_SHIFT               237 A2 e* g1 {+ Z& ~

  60. * d3 ?% {+ ^9 o) O+ C3 R7 T
  61. static volatile int irqraised1 = 0;! h& X# `- A2 I
  62. static volatile int irqraised2 = 0;
    ) C. |) g! Y% E/ K9 {( t+ q  l# G

  63. ' T$ l9 O9 X; u+ C. w% W/ c: x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) G8 v" F1 Y2 U4 v( V! e5 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 @6 d5 r% L  f- U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 N+ ^4 O  z: W  d9 f7 P% G$ X

  67. 2 ]- ~6 s, r6 M8 _, i6 a
  68. dma_addr_t dmaphyssrc1 = 0;' U5 W& z) e+ q( \5 J. j( H/ h
  69. dma_addr_t dmaphyssrc2 = 0;
    ; ^4 S4 O+ d- [: g! ?6 Y
  70. dma_addr_t dmaphysdest1 = 0;
    6 M  N2 E7 i: y! _" W8 S  {
  71. dma_addr_t dmaphysdest2 = 0;
    ! q  \2 b, s4 V  {

  72. 9 l6 J+ _: K/ d
  73. char *dmabufsrc1 = NULL;& Q  {$ Q! X, F/ t
  74. char *dmabufsrc2 = NULL;
    # R. K! B1 c" X( Z, ~5 P
  75. char *dmabufdest1 = NULL;8 D  j3 d1 d/ o7 h, f
  76. char *dmabufdest2 = NULL;
    0 f) ~: J  A0 L6 H3 H3 H% b9 r8 M

  77. % }- u( L5 U5 T) z2 I3 S4 y
  78. static int acnt = 512;  v% p! X1 O; {" ^7 w
  79. static int bcnt = 8;/ z4 q. ~. \* p$ D9 y- U/ m" Q
  80. static int ccnt = 8;& N+ Q) G/ T3 Y, ^' x- M0 o9 d# h
  81. 9 G/ |+ V6 m9 Y* \  P
  82. module_param(acnt, int, S_IRUGO);  c0 G' m3 ^% J( z! {8 T
  83. module_param(bcnt, int, S_IRUGO);
    $ J6 ^  u! S- ?% b- G1 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 l% Y3 E1 l: Z# S

9 t, J/ c. |8 }- _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ m7 Q* j. H# q& h! Q0 P1 l5 X; V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 N$ S" f' f3 U% x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ h3 q# Z- f1 n9 ]% [

9 f7 o( }* C/ l/ Y* n+ Y, u/ _- P2 _# k; O% \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 01:20 , Processed in 0.038374 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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