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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" k' j+ x5 ~5 g/ t; x$ x% S
  1. [code]EDMA sample test application5 `/ D& k* V" P" a1 V$ _
  2. /*
    * U3 N8 b3 e! b- i7 b  f. V
  3. * edma_test.c% Q: v+ W) ?8 [0 G7 z. r
  4. *; H: d- r3 e# T* X* z( S
  5. * brief  EDMA3 Test Application4 K& H. q  P7 B" Y- N6 W! O0 x
  6. *
    * j9 n) e# ]2 j& Z
  7. *   This file contains EDMA3 Test code.
    8 E/ s/ T# b0 g  z* T
  8. *$ s  i1 _- H! W! E4 c. y" s9 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! F' _+ h% I& |' [% O5 Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ |3 \: V. H4 K/ D
  11. *         TO CHANGE.
    6 u4 }) D5 E+ }
  12. *
    , u4 I8 ?$ c/ o% f: ~6 p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* O6 \1 ^+ d  ]3 L: B2 v2 X
  14. *& B. U: [% `5 U, Q; Z/ ]( `+ Q7 g
  15. * This program is free software; you can redistribute it and/or
    0 r/ D3 o# R6 j! ]8 D
  16. * modify it under the terms of the GNU General Public License as$ N* m) [4 `' t! w
  17. * published by the Free Software Foundation version 2., [* `- J( h- {  N9 D
  18. *
    6 p  A3 e$ s, i; ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % H$ F) P( \5 V; n, [
  20. * kind, whether express or implied; without even the implied warranty
    ) x, b% U! K) @! r( C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% s+ X/ W& F! @
  22. * GNU General Public License for more details.
    7 A0 H5 Q% Z. i% F
  23. */" q% h* R7 k+ ?/ Z- L; l
  24. ; {. a$ c, N% K- m) U8 v
  25. #include <linux/module.h>
    3 y$ S" I' q; P/ e# k) j
  26. #include <linux/init.h>  E) Y+ C3 Q- }5 U
  27. #include <linux/errno.h>, d+ o2 c# q( L7 C7 }4 H& T  ~
  28. #include <linux/types.h>  C" D9 z+ V5 w" N
  29. #include <linux/interrupt.h>  X5 z" B9 R& @7 O
  30. #include <asm/io.h>' |, G9 B$ w5 c7 A- z8 u
  31. #include <linux/moduleparam.h>( ~3 D; m% d8 a1 [2 i3 F$ j8 y
  32. #include <linux/sysctl.h>
    : Z# K$ g3 x7 H
  33. #include <linux/mm.h>
    ' Q; Y2 e( D( p
  34. #include <linux/dma-mapping.h>: ?0 V! e: Y/ Z# d7 |# K6 Q' S
  35. / \2 c( @# ?- ?  a/ o
  36. #include <mach/memory.h>5 g4 o2 w/ Z5 y; @. E. a2 K" z
  37. #include <mach/hardware.h>
    9 @( n% S0 i" f! j: \& L, M  U; {- L
  38. #include <mach/irqs.h>
    3 F. o( m$ o0 @
  39. #include <asm/hardware/edma.h>
    2 v) T7 S; T% z; C, s5 L
  40. 4 ^, K7 x& g5 I6 Y% W- ?6 ]
  41. #undef EDMA3_DEBUG
    $ T5 I* F; y, L' ?1 T
  42. /*#define EDMA3_DEBUG*/" C$ U2 z+ M$ i2 C3 L

  43. . U8 {( b4 t$ [
  44. #ifdef EDMA3_DEBUG
    / q% ?; r) K) Y* Y" m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' o  N8 ^' S' F  y/ R: N3 r* ]% a- L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & H# l0 g4 G4 t% a* L6 R) n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      u% [: S5 D+ U# I8 y! W9 _8 ^/ Q0 `
  48. #else4 K: ~, @' U" k! }5 M. y
  49. #define DMA_PRINTK( x... )
      k  S. l# u* J" g1 f
  50. #define DMA_FN_IN/ ~4 \0 L. W4 C# K
  51. #define DMA_FN_OUT5 A1 F9 n1 E3 g  C
  52. #endif
    + P2 \, U& i, R( B/ t. Y6 c

  53. 7 l' A# \( P2 w8 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ c  I' _9 h1 l/ D4 @$ i4 A4 z8 i
  55. #define STATIC_SHIFT                3
    8 n2 f$ F' p, t# O) V2 r
  56. #define TCINTEN_SHIFT               20" x; n: X- v# t7 c5 d: b3 G1 }5 N
  57. #define ITCINTEN_SHIFT              210 l/ l. m# m, d, s! e; V6 d& L
  58. #define TCCHEN_SHIFT                22
    . F& `3 X  s2 x" c/ m
  59. #define ITCCHEN_SHIFT               237 x/ Y/ p0 S5 t+ K0 x+ D8 `. m: r2 Z% ^

  60. # @- O7 v( f0 C$ u1 j0 U
  61. static volatile int irqraised1 = 0;
    $ A& O, V3 y, Y% j1 P2 S) W8 f3 T
  62. static volatile int irqraised2 = 0;& |& `  ~! s" \

  63. ! b& H, J/ d: S6 ]9 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ T+ t* J0 _  x* Q/ d! k% m3 d, R5 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: |0 X7 ?; n* Q2 D, V' l& X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , X/ j& ]; s) Z4 @$ W& A

  67. 7 Q2 }* b/ X( H& B5 J' @( V
  68. dma_addr_t dmaphyssrc1 = 0;1 n& N# ]% E2 h  w0 o- k* Q9 h7 i
  69. dma_addr_t dmaphyssrc2 = 0;
    0 }- s4 [1 b% p' \' m8 m
  70. dma_addr_t dmaphysdest1 = 0;. B5 J, @+ [  H- H+ H/ y, a* u/ {1 D
  71. dma_addr_t dmaphysdest2 = 0;
    , z" B. @1 t1 |# X' y  n
  72. ( N; c- Q& x! Y% {' O
  73. char *dmabufsrc1 = NULL;
    ! n5 v; p0 Y# ?# g; }- q' h* y
  74. char *dmabufsrc2 = NULL;$ D: O$ X5 c0 q, F! j
  75. char *dmabufdest1 = NULL;
    ' P- V9 g& |5 ^$ Q
  76. char *dmabufdest2 = NULL;
    ( Q( {6 T) V* d8 n! Z
  77. " i5 z8 L  r2 F" t
  78. static int acnt = 512;
      g1 W' |( g' W. O2 j' r
  79. static int bcnt = 8;
    2 H6 m* m2 E% I; B. h  u
  80. static int ccnt = 8;- n! d0 e2 Y: `1 m

  81. : i* t, d" i) X  G8 D: P1 Y
  82. module_param(acnt, int, S_IRUGO);
    % o6 ?3 A4 A& z! q' |& }. j: F
  83. module_param(bcnt, int, S_IRUGO);1 O2 D( ]7 W$ d) Z" F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( d9 H* K" c1 \# W8 H- t3 n
& Q! d9 }/ R7 ]  H6 c& S2 a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 y( @' A- A% `2 x2 N9 c  oarm-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: }7 E* [3 M" x7 L1 B6 G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 g( C) f1 q' d) M6 P/ u$ N8 x! J7 h: C' M0 K3 v. |7 E

  }0 x5 Q* z4 l0 G. Z4 m5 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 04:33 , Processed in 0.040713 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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