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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : n% f/ r* M$ Y' s5 p* \2 K! e
  1. [code]EDMA sample test application3 c, P+ j9 P& y
  2. /*
    ! s5 K" @" T6 C
  3. * edma_test.c# D9 u3 U) D2 U" m& M+ B/ M' ?# U
  4. *" W) ]& n- s% z' S/ O
  5. * brief  EDMA3 Test Application
    3 s" q" W7 w4 ?7 ]
  6. ** T6 k& X) ?+ N! ^. J+ T! X7 C' E
  7. *   This file contains EDMA3 Test code.
    + c' d; `# B) h4 x5 m5 h
  8. *
    % K4 Z4 E0 |; r8 J. d4 C; l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" x7 Z0 x% A% ~3 ]$ d( v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 t& Y* f- F( K/ q. g- B3 r
  11. *         TO CHANGE.# h  H5 F/ w* h" e: F
  12. *; v" q' G+ \" r) p" R/ Z9 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# }  B' _9 B% a( E6 g, ]6 b5 v+ T" W
  14. *
    & G+ N2 U1 I9 `( p7 H* p3 a% ~
  15. * This program is free software; you can redistribute it and/or
    % X, ^; s6 E" c* S8 j& o1 e6 P
  16. * modify it under the terms of the GNU General Public License as+ O+ _/ g8 j3 Z! |
  17. * published by the Free Software Foundation version 2.# R/ a# k- q3 Z. }* n8 h# ]
  18. *3 {' {( L5 g/ g' \& V! c4 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! P. w. ~+ Z9 R5 m* b+ @! ?% \  P
  20. * kind, whether express or implied; without even the implied warranty
    8 A9 L! c0 |! f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! J1 G! K( B( h  v
  22. * GNU General Public License for more details.. y! J3 A6 T! L% {8 S0 ?
  23. */# U' \% g5 m% U- G) z6 B4 h* Y1 m

  24. ) U& q1 h6 k# u( `
  25. #include <linux/module.h>
    8 m# h" w" l' @3 L3 c; y6 _' n
  26. #include <linux/init.h>6 b9 W: a0 K/ ^: x+ X+ m. h
  27. #include <linux/errno.h>0 {% m+ k' Q$ f  l" a
  28. #include <linux/types.h>
    1 {2 C# r6 k% _* D/ E) b
  29. #include <linux/interrupt.h>$ Y- O6 t- f% z# j
  30. #include <asm/io.h>
    ! [  a' q6 D9 z( {& ~
  31. #include <linux/moduleparam.h>2 v; ?$ S& ^' x
  32. #include <linux/sysctl.h>
    4 Y! z2 _2 z  ~) F* l+ d
  33. #include <linux/mm.h>
    $ G% B! o$ ]1 t  _6 b. C/ ^* B
  34. #include <linux/dma-mapping.h>
    3 n0 W( Y# `. e* w5 f% k' q' V

  35. 5 \8 e' z& U) r: o) _- z
  36. #include <mach/memory.h>6 Q& W$ l/ w8 V2 R
  37. #include <mach/hardware.h>5 l( M& J1 q* U. d" n
  38. #include <mach/irqs.h>
    ) H! {; i" A% L( `
  39. #include <asm/hardware/edma.h>4 ?% Z' u$ i# Y0 U5 k

  40. 5 ]1 ?" ]6 o, R$ r: Y5 O
  41. #undef EDMA3_DEBUG
    8 M. R3 e9 y3 d. E! I1 P' U0 Z
  42. /*#define EDMA3_DEBUG*/
    0 k. m: B" b% X4 b: O; x9 b
  43. & m# |0 f" y- f: c. ]- ~) F8 @: R
  44. #ifdef EDMA3_DEBUG
    - j% a; `  H0 m" ^  i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# K/ x( H" m4 r% l- l: s: d2 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 z: u  @/ t, I5 O1 w" V' U* b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " b% @! ^6 Y) @/ v3 g. Z' R4 E  q
  48. #else
    . l8 C9 [* R4 y' d* V2 E. W- m
  49. #define DMA_PRINTK( x... )
    4 [% s( N' `# d) O# l$ ?
  50. #define DMA_FN_IN
    2 r2 Q6 u$ s1 ]  @
  51. #define DMA_FN_OUT: ~+ B$ O# _& ~2 x
  52. #endif
    7 P, z& X2 J/ y0 G
  53. / N/ f; y) f4 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 \/ u- ]% q3 L& T& D4 s3 _
  55. #define STATIC_SHIFT                3
    + r' f, j8 W7 }3 f
  56. #define TCINTEN_SHIFT               20  g& Z* p1 p0 z
  57. #define ITCINTEN_SHIFT              21
    ' |- V- {9 P6 E" ^/ h; r& A$ z
  58. #define TCCHEN_SHIFT                22
    8 A0 ~% k8 g6 n0 b* b
  59. #define ITCCHEN_SHIFT               237 i, c5 l/ z( ]: z6 |
  60. - w* P) v8 F) h3 y" I1 o8 K( A
  61. static volatile int irqraised1 = 0;
    3 l' W" y7 C0 B6 J
  62. static volatile int irqraised2 = 0;
    1 z8 q4 t, X0 L0 L% g

  63. * |: n9 N. ]' x' F2 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ s9 i! n, u) Y7 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      w6 v' Z. O8 G3 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 _+ X, ^0 @0 x, f9 k% W

  67. 6 J. r% F4 V5 _! F) A/ Q
  68. dma_addr_t dmaphyssrc1 = 0;' n" t! C! n& x
  69. dma_addr_t dmaphyssrc2 = 0;
    " Y( X: i7 s; j: }2 {
  70. dma_addr_t dmaphysdest1 = 0;* e  P/ p: T; f* S/ o) N; P, m# T4 p
  71. dma_addr_t dmaphysdest2 = 0;
      m/ Q  T# ]" k/ b; Y  n1 Y7 Q
  72. / c) w. y0 O2 L
  73. char *dmabufsrc1 = NULL;
    2 J$ {0 C- I/ c$ t1 Y5 l+ ?( d( w% x
  74. char *dmabufsrc2 = NULL;
    : v: M/ M' V5 d0 q8 w6 p
  75. char *dmabufdest1 = NULL;
    - b' R: V4 G' T- G
  76. char *dmabufdest2 = NULL;
    % ~5 L* K$ k9 b  V
  77.   N0 y8 ]2 a* @# Y3 C
  78. static int acnt = 512;
    ; u  R  v5 M7 C' ~, k! c  c
  79. static int bcnt = 8;
    5 C  P2 W' K" j( A6 \
  80. static int ccnt = 8;. J6 Q8 ^" }6 u& H6 N
  81. % y# Z( e9 ?& I3 \) k
  82. module_param(acnt, int, S_IRUGO);6 m$ D! C. Z: M9 P  I( U# S3 P
  83. module_param(bcnt, int, S_IRUGO);
    $ r% B, I: |$ L; I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) z$ _* z* [& V( T. b
1 e2 U$ R+ X  Q4 a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 P+ b  x! A8 k3 x" p5 C) _& L( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, C: |* E4 s, e9 F( H. P2 m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ e/ b/ I  q9 P5 }% l/ y/ L
3 T* J4 F. c1 ~5 {( s) S; ?' X7 K1 b- j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 20:21 , Processed in 0.051307 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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