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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  [4 b- y  e( ~* D# Q
  1. [code]EDMA sample test application
    & A  r( o! @2 @) y' G5 @; P. J
  2. /*
    % ?* W; t5 U$ ^' a5 `; c- k) G
  3. * edma_test.c6 o! k/ O" ~! c, K" _( Y7 W
  4. *+ p' b" Q" i, O0 n! O
  5. * brief  EDMA3 Test Application
    8 N+ j% R3 ?' y* y3 ^; E+ a4 w
  6. *: W6 u! ~$ U3 w3 \" P
  7. *   This file contains EDMA3 Test code.( W1 L+ d4 Y! ^0 X5 x( S7 Y
  8. *
    6 ?0 X* n- J" d! C) c( e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# |9 m$ P# I; D% G$ g7 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * k1 d( f, H8 O( k6 ^
  11. *         TO CHANGE.
    # \& Q# a5 y3 N2 J4 r5 w8 u" }
  12. *9 O- j8 l( O. u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 ]5 X$ a9 ^1 H+ r  X9 V. q9 w
  14. *
    + T0 _, W/ \- C* P+ @% g# f
  15. * This program is free software; you can redistribute it and/or
    % }' W6 C4 C- m( O: j  X8 v
  16. * modify it under the terms of the GNU General Public License as
    4 r0 N# L3 F/ W* r
  17. * published by the Free Software Foundation version 2.
    9 C. P6 V; N- y* G
  18. *
    9 i8 @# u. u9 g& n0 ~: c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " A% ?- e: E* W* ?+ f
  20. * kind, whether express or implied; without even the implied warranty
    9 _7 D+ A# q# }, d* ?0 ]. h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. `. _- f' a; \/ ^; _' |3 b) y/ x
  22. * GNU General Public License for more details.& ^1 `# W  H; c4 h
  23. */1 B. e; D( j; W& c; i5 ?0 U

  24. - |7 P$ @2 d9 U0 g( y8 Z$ ]4 v
  25. #include <linux/module.h># F( g2 S8 T' r1 @5 L9 ~: W9 V7 Z& L
  26. #include <linux/init.h>
    5 G4 }& k. ^" Y1 U  V5 m
  27. #include <linux/errno.h>1 `/ F5 c  _1 c0 B; C9 J9 z: S3 R, f
  28. #include <linux/types.h>
    0 X5 d* M9 f" v) d+ \1 ^+ g/ Z6 I
  29. #include <linux/interrupt.h>2 J3 f3 o1 k) \1 c/ a% u$ x4 ^3 R
  30. #include <asm/io.h>) ^3 n" B) F8 @; K& C
  31. #include <linux/moduleparam.h>7 g' V/ a/ t  K  p' k
  32. #include <linux/sysctl.h>
    ; K* F& ?) V. d3 i; X& `
  33. #include <linux/mm.h>7 z4 I0 J& I  B) B* h' p* M7 A
  34. #include <linux/dma-mapping.h>
    7 n3 Z7 ]8 d4 d, ?' [, Y* z; g; R7 G
  35. 6 h+ M, \( N/ d; V5 G
  36. #include <mach/memory.h>  A6 |. X4 P7 @1 z9 K
  37. #include <mach/hardware.h>; Y  L! ~4 p$ u8 K8 ?& }- B% l
  38. #include <mach/irqs.h>
    ) M9 f0 v* Z" l2 D1 c( P5 p
  39. #include <asm/hardware/edma.h>
    6 R0 a" o( F7 G) Y
  40. , h3 O: \/ ~- D$ `6 H) n0 I! v' I4 v
  41. #undef EDMA3_DEBUG
    - K1 g; R2 u! q* |
  42. /*#define EDMA3_DEBUG*/3 p6 Q2 w8 B; J; E4 W9 Z% `* z

  43. 2 F6 J. a0 [# }3 c: h8 y3 V" |
  44. #ifdef EDMA3_DEBUG
    1 o$ }; N4 C7 S1 w0 \) [/ _4 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( H# _# Q2 n, N0 J- ~3 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 N1 R$ L6 g: S) f& l! ~  y/ I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 @& d0 M2 F* s' x, G
  48. #else
    9 c2 d# _) \* u2 ~) d4 y! m8 {
  49. #define DMA_PRINTK( x... )! }2 |) C4 F& J' d& G
  50. #define DMA_FN_IN
    5 d0 Y: i! h0 `7 P. U( e# H, @
  51. #define DMA_FN_OUT
    * y/ L2 z! {4 n2 E. q& G# g
  52. #endif! e# L, `+ f" F" j
  53. 0 |. w# p( J+ e# J  U9 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! P1 R$ X7 B% D
  55. #define STATIC_SHIFT                3
    & ]0 ?) Z9 h" p" B" t. g  e
  56. #define TCINTEN_SHIFT               20( @( O; T9 O5 F  o7 v6 k
  57. #define ITCINTEN_SHIFT              21/ H5 f0 L2 F, n& `" W+ U5 F5 M
  58. #define TCCHEN_SHIFT                22
    8 n2 q1 k  j9 @0 L5 W
  59. #define ITCCHEN_SHIFT               23
      c; ?; T4 k* m. d* s& i- V( h
  60. 0 z$ r. k2 @' E3 q; q8 _
  61. static volatile int irqraised1 = 0;  W1 y' w2 S$ g7 `- z7 o$ _
  62. static volatile int irqraised2 = 0;
    # E8 u- z3 k6 W1 O9 p

  63. * J. @7 c' X( W( C. n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 q3 p  w& f3 z' Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 z  R' ?, X( t  r, z8 N/ `  C; W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Z& h, r. K8 n( x5 |3 F

  67. ) R! Q0 O( A1 r, J9 v( y8 V
  68. dma_addr_t dmaphyssrc1 = 0;
    7 \: ]/ p6 B* o8 S/ t
  69. dma_addr_t dmaphyssrc2 = 0;
    $ c2 i: z" ~) C( L7 y
  70. dma_addr_t dmaphysdest1 = 0;
    / Q7 a: d: j5 D1 g5 X5 l- F: Z
  71. dma_addr_t dmaphysdest2 = 0;% g% O9 U' f1 Y2 K$ G) t5 W

  72. + A9 r7 Q9 i$ p) O; y) Q
  73. char *dmabufsrc1 = NULL;) R. N' f! c/ S4 I9 n
  74. char *dmabufsrc2 = NULL;" h- {, Q: V1 p+ r' S
  75. char *dmabufdest1 = NULL;$ S7 j/ T2 N# k) U9 p
  76. char *dmabufdest2 = NULL;" m5 _3 Z! r$ _

  77. 6 X6 l% V, w; B7 R; c
  78. static int acnt = 512;- U. K1 G- M4 g4 Y
  79. static int bcnt = 8;& `/ u1 g& W( @* ]0 }
  80. static int ccnt = 8;
    ! k1 A$ ?' f/ m' f- N! r; R+ O( _; [
  81. & V' w$ N8 S  Z  h
  82. module_param(acnt, int, S_IRUGO);
    0 a1 A$ `- ?) h& X1 Y
  83. module_param(bcnt, int, S_IRUGO);
    + L4 b, C' ~5 u, ]* c: C4 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  q+ C7 F: \$ m! P" u0 A
7 R& G" R9 y$ N" h% z  |# _4 m9 u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 X8 k5 S. }% J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ E1 R( B; r) [" `% `/ h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: `3 f5 K* ?5 s* v; a; q
9 Q( Y2 w; I9 `3 a0 ]
: T7 }" z+ o/ B; G% Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 12:23 , Processed in 0.038120 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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