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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# n/ l1 w  x* q1 H9 I: B. [
  1. [code]EDMA sample test application, k" X" K4 n% N& A: F/ B2 d
  2. /*4 g% |' S0 w! g5 B; n  k0 p
  3. * edma_test.c
    , S! r  o5 t2 E9 I
  4. *
    % n( Y. u4 e& L- r& E. H5 _: r
  5. * brief  EDMA3 Test Application
    0 D% h! w' e4 J/ V, h! k& u
  6. *
    ! L, V& n8 U( s4 D+ ]) W) m, ~
  7. *   This file contains EDMA3 Test code.: K+ }. c) T( ?+ b
  8. *
    ; J( A$ `: x/ |0 x* D8 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / u  ^! _% h& S' ~2 H/ V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - y; b8 L0 Y0 S1 E$ b
  11. *         TO CHANGE.- i3 D# o- `. S% w, L% n
  12. *- N. k  Q: y4 \3 |7 D2 b1 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, |$ q2 {4 A( z  |6 H) O9 x" j1 h. @
  14. */ C$ p9 [* L, p* @" c; Q
  15. * This program is free software; you can redistribute it and/or
    $ j+ `1 g0 K  I
  16. * modify it under the terms of the GNU General Public License as
    ' [0 H0 p* x/ Y$ Z0 [$ n
  17. * published by the Free Software Foundation version 2.. @. m* d! F5 D0 g6 q8 s$ H
  18. *: `" v4 {. J& E# p6 l( W" t& ~# V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 r9 {; L% n+ t
  20. * kind, whether express or implied; without even the implied warranty
    # M. w  q' f8 }7 S% v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ X; A/ A4 |+ i6 P& Q+ `
  22. * GNU General Public License for more details.% g; r/ u+ R7 u1 l8 J
  23. */
    / _+ M3 f$ n5 }' C, C

  24. ! W6 x- d4 [" C2 r1 g- ^: |
  25. #include <linux/module.h>' v( G7 L+ i6 O
  26. #include <linux/init.h>; D1 }) [: |9 L; @
  27. #include <linux/errno.h>
    9 s/ A% |+ ^3 W
  28. #include <linux/types.h>
    - A( B  P% K5 N, \3 o& w
  29. #include <linux/interrupt.h>
    % b+ a! p5 W5 _  v+ X
  30. #include <asm/io.h>8 |6 d  ?+ {) W! \4 k% r
  31. #include <linux/moduleparam.h>
    " N1 O! ^* @, e
  32. #include <linux/sysctl.h>
    9 f$ o% t+ F2 n  `# M' u4 M) c
  33. #include <linux/mm.h># p; @5 Z0 k7 Z. g
  34. #include <linux/dma-mapping.h>
    & ]0 I3 `2 S) v1 v) U$ O
  35. 7 ~' z# C% R) A3 w  m4 O0 ?) f& d. ?
  36. #include <mach/memory.h>
    % Z6 b  `8 F7 e! L, L
  37. #include <mach/hardware.h>
    - _8 v2 m  x1 w8 v/ }9 S) F
  38. #include <mach/irqs.h>
    7 b8 T* n$ u9 y
  39. #include <asm/hardware/edma.h>
    # H- T" X2 f) I/ x

  40. 0 z( x0 r) G" J" d
  41. #undef EDMA3_DEBUG+ ]- v; a# V9 }  h
  42. /*#define EDMA3_DEBUG*/' e1 p" B* Z% Y0 T; u
  43. ( X' I9 _1 E# P
  44. #ifdef EDMA3_DEBUG
    3 t) D7 l4 s7 }: G1 a, y( o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ q6 q) s: D/ F) s: D$ w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* G7 G' e6 ~% v7 ?7 t8 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% |' ~- `" `; Q! y) U# \3 V/ R
  48. #else
    % D6 E4 y9 Y, l2 M' t0 Z( h, S5 X
  49. #define DMA_PRINTK( x... )
    7 K. F6 k/ |* m
  50. #define DMA_FN_IN
    : M/ h& ^6 O4 e+ v3 \  z* C
  51. #define DMA_FN_OUT1 j- N* k2 J. Z" {0 o, D/ }' t# f# P
  52. #endif$ Y4 I  R2 P. O" u0 N
  53. 9 x1 x* j4 o$ K) E! I" r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , @& k' x% S- Y1 g, f( o' |
  55. #define STATIC_SHIFT                3
    9 Z+ |9 _+ r$ ~- ^( D  A
  56. #define TCINTEN_SHIFT               20" b/ q4 s% g/ @: Q5 V: p* _
  57. #define ITCINTEN_SHIFT              211 |4 n4 K- ]0 c% ?
  58. #define TCCHEN_SHIFT                22
    # F) {, k/ o9 E* h" k4 D
  59. #define ITCCHEN_SHIFT               234 \2 a3 u* C- {9 R

  60. * s; _3 z- F1 G
  61. static volatile int irqraised1 = 0;
    4 P5 k9 o5 v+ U
  62. static volatile int irqraised2 = 0;; V  ]5 N  J) W/ F) s
  63. 1 V7 v5 R4 A/ l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 z! ^3 i5 _) b* i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; W2 T8 y% N8 Z# f& ~  x4 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( k/ u% u9 ?5 ^2 T. v1 y+ r
  67. 8 [* _: S8 u6 O+ H, v) ?/ K4 r
  68. dma_addr_t dmaphyssrc1 = 0;
    6 g! T6 E% |- _$ B& {+ F7 \% N
  69. dma_addr_t dmaphyssrc2 = 0;( ^+ O% s  l  u3 A
  70. dma_addr_t dmaphysdest1 = 0;3 K6 o  W7 {% R+ ~+ ?5 c) i
  71. dma_addr_t dmaphysdest2 = 0;
    ; e) |1 h) t. K' f3 h6 S) e
  72. 6 ~1 a% c2 ~6 q. v! A' [/ q
  73. char *dmabufsrc1 = NULL;
    * m7 V& H( w3 G0 }& S; c5 q
  74. char *dmabufsrc2 = NULL;
    : `! f9 B$ d" y
  75. char *dmabufdest1 = NULL;" |+ d0 G/ H0 b6 S$ e# t4 Y6 k
  76. char *dmabufdest2 = NULL;9 _' c9 h# c. F
  77. ( Z$ q' r7 @- @8 z$ ^7 P1 i. \  H
  78. static int acnt = 512;  P! v: _: p' z
  79. static int bcnt = 8;
    : f8 Z3 J8 X( o+ C7 {7 L
  80. static int ccnt = 8;
    5 l* _0 x. b& U6 h
  81. 8 \* s5 N) |" K/ T" b- ~' a. b
  82. module_param(acnt, int, S_IRUGO);8 j1 b5 ~& T8 f$ H) }/ M/ P2 v! a. R" f
  83. module_param(bcnt, int, S_IRUGO);
    & U' C! v( @' t* v7 M( E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" W/ ?3 O9 E3 h( G! C( ^" L
4 p5 _  p2 y% I8 \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. {* ^* E4 |1 O" X9 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 Z4 H+ t. u! D8 E+ Z' g) }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 j* e# x; T0 `; E7 _! g" v' `! U3 e; z2 H, ]6 Q  U

, J) {* V" K+ g2 C% T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-7 06:09 , Processed in 0.037302 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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