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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + m1 Y& m. V. K8 ~$ x" s
  1. [code]EDMA sample test application
    % G' |1 y9 Z. z: z
  2. /*! M( _5 [( P& M% p
  3. * edma_test.c) `5 |  M, `- y, K" F: R
  4. *8 w9 G; ?, Q0 i0 G& Q
  5. * brief  EDMA3 Test Application
    & N6 r$ f, |! E' u) X
  6. *
    & l$ M: U( x& i8 U* Z. W4 H
  7. *   This file contains EDMA3 Test code.
    * M4 f# R5 d8 f9 e* `/ y. v6 U: t/ m
  8. *
    ; t/ W5 Y% m( B9 ]6 m/ E* n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! o$ N8 `3 b- `& ]0 s' ]# ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' F! R) h0 W1 @) y9 m" T' L3 W
  11. *         TO CHANGE.1 z$ l0 G- y4 l: o9 _
  12. *  U0 {% u& W2 ~: k$ k! a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( c" ]' v( ~2 O2 G3 G$ h' b
  14. *& N, Y( p& C) T) H- }
  15. * This program is free software; you can redistribute it and/or) Y! p/ S( x0 ]/ ~- [
  16. * modify it under the terms of the GNU General Public License as
    7 T5 h7 o$ C; K3 d4 ?
  17. * published by the Free Software Foundation version 2.9 I; ]- w8 g1 u4 ?* J
  18. *, H! n; M2 f8 X4 h# J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 q5 V" W- P* v* ~9 L
  20. * kind, whether express or implied; without even the implied warranty
      a( I- a5 r# r& g- {" D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! l& F4 ]8 G9 n3 l" ~1 b' j1 r2 f5 u
  22. * GNU General Public License for more details., X# [: Z0 p- d# f1 B5 z
  23. */
    3 |- I5 ^6 r% W0 M8 q

  24. 5 x& S5 _. {7 r' ~
  25. #include <linux/module.h>8 k7 {1 }  L8 `# Z& q  ?
  26. #include <linux/init.h>8 |. j: F6 @+ w" P  N
  27. #include <linux/errno.h>
      M: }6 d+ G# M5 W
  28. #include <linux/types.h>5 ], L" i. s; C) J7 ^3 I, I
  29. #include <linux/interrupt.h>: R& g- Q" w" u( L) T
  30. #include <asm/io.h>
    / J7 a) r0 g4 R1 K
  31. #include <linux/moduleparam.h>9 @& m+ f! v$ S
  32. #include <linux/sysctl.h>: V, L+ }1 {% F1 h( N
  33. #include <linux/mm.h>  a! o7 Z3 }4 W7 H6 R$ d+ N
  34. #include <linux/dma-mapping.h>& \1 K% ]3 h) m
  35. 6 E4 f1 Z+ N$ Y% M/ z+ b
  36. #include <mach/memory.h>. ^! C6 @/ S! E# ^+ |' n
  37. #include <mach/hardware.h>
    7 e4 o4 u7 l& ?! [# k
  38. #include <mach/irqs.h>
    . }) [1 D- N5 A& [5 u  c& l" W0 x
  39. #include <asm/hardware/edma.h>( M0 T3 l  \% u; S
  40. 2 ^4 i* f* r, q3 K. j' u
  41. #undef EDMA3_DEBUG3 }. k% Z  u& S2 M  c0 S: g. i+ I9 c( i
  42. /*#define EDMA3_DEBUG*/. L; ]; K3 M2 o

  43. / D8 ?- _) r( F4 E
  44. #ifdef EDMA3_DEBUG( `4 t3 R5 [3 b2 h2 f2 `, o$ j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; m. H, a5 o% U4 ~" E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # Q3 n, n$ k/ y7 W2 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + S0 @/ p9 J, S: h2 e. j% g
  48. #else
    2 W6 G8 R2 c, v
  49. #define DMA_PRINTK( x... )- U6 B: w! x1 K& g2 c- E
  50. #define DMA_FN_IN% {: B, s9 c) O, ?
  51. #define DMA_FN_OUT
    / p& f* D& Z4 G( {+ A  x1 N
  52. #endif3 C3 e8 {! f3 R2 ~5 B, M$ M

  53. ' U% Y* O; n- z8 Z% h( z$ w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , X" X: J8 E: b0 e8 ^5 i4 h
  55. #define STATIC_SHIFT                3/ w3 c1 O. I: |( s
  56. #define TCINTEN_SHIFT               20
    " ~# V, R4 Q+ V  v0 \
  57. #define ITCINTEN_SHIFT              21
    ' `# Z+ i# C! \" o! }+ n, m' x
  58. #define TCCHEN_SHIFT                221 ^# s; p+ U$ H( k. k
  59. #define ITCCHEN_SHIFT               23
    ! H( E6 w+ R* J& K& y4 T$ M- |
  60. 8 G  @, R3 T. I1 R8 N6 n7 U! t
  61. static volatile int irqraised1 = 0;0 J; d! D% _4 _' ^& G1 I) V
  62. static volatile int irqraised2 = 0;
    8 S5 P# A7 l0 s" x( ~2 n, Y
  63. . {! C" s# X7 w& E4 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: U! @2 X6 Y% f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 R5 [4 s1 {. }+ L8 H: }3 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ q( ]7 z7 b8 P+ H2 J# K0 _

  67. 7 m) F0 `- z5 A- j, y0 U
  68. dma_addr_t dmaphyssrc1 = 0;
    # R0 ^. n6 m4 @
  69. dma_addr_t dmaphyssrc2 = 0;
      f6 l. B" J8 |/ x
  70. dma_addr_t dmaphysdest1 = 0;! r! g: ~2 ?# A- L& Y+ C9 }
  71. dma_addr_t dmaphysdest2 = 0;" c& |* e/ l: v5 t5 w" L

  72. . e& B& @" v9 z% a6 V& z
  73. char *dmabufsrc1 = NULL;" ]6 f9 c- h4 H+ \4 I0 n8 }5 ^
  74. char *dmabufsrc2 = NULL;
    # h9 S/ S7 N# z
  75. char *dmabufdest1 = NULL;
    " a1 L" z0 x, c1 a) j; B# |, ?4 ?
  76. char *dmabufdest2 = NULL;
      k$ w" W  d1 Y
  77. , _( `) t/ W0 W/ \8 o- R4 K+ ^
  78. static int acnt = 512;+ a1 J/ a  u" n, r5 S
  79. static int bcnt = 8;' q- D) s# l0 g. W) B
  80. static int ccnt = 8;" p0 `+ C; E1 o; s1 J3 V& R  p/ E

  81. 8 ~9 l3 L0 ]/ Y( u# Y2 ]. N
  82. module_param(acnt, int, S_IRUGO);9 P; m2 }4 a8 H6 t2 W
  83. module_param(bcnt, int, S_IRUGO);
    ! w& V4 W, `6 y5 J9 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ p! E, S7 @; c& D# I1 @1 i+ \; H0 d, i" I; m) J0 W3 k  H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 T6 G" M9 w1 `) x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) H  v0 v  m: s9 O2 _* I" a1 W" Q$ b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" k; b& r- d. d1 _+ g+ U

, u9 `0 A0 p8 Y( r! w/ l
% e! Z/ r1 z& k6 v* ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 22:29 , Processed in 0.040610 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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