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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 m  k0 V+ u0 b2 O, V9 Y
  1. [code]EDMA sample test application8 a. H! }( Q4 k
  2. /*
    ) z$ C4 @! F1 b9 T. x; k/ L# ~
  3. * edma_test.c! M8 _) S9 P% Y) ]4 ~4 P
  4. *4 J9 H& [" b9 n7 C1 s
  5. * brief  EDMA3 Test Application
      D# y/ ^* m: `
  6. *
    1 R1 Z: N- ]. h$ Y* Y6 E. P
  7. *   This file contains EDMA3 Test code.
    - N; k2 s( ]! ?4 S* T4 P/ P2 Z# |, `
  8. *
    2 b  B7 F6 v7 Y4 w. g, b! y+ l" [$ w" h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ^5 u3 t1 r8 ?  d1 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 O- _, s, f) |& U# f( T
  11. *         TO CHANGE.; P* [+ u8 y# t$ j
  12. *
    2 _$ q. p" T" K+ w% \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- A. S, p/ f9 v% G% |
  14. *% `) X- q8 p* ^9 {, z
  15. * This program is free software; you can redistribute it and/or9 U& P: H/ r! t+ H; K* _* I+ ?
  16. * modify it under the terms of the GNU General Public License as$ B& d9 Z' m. N" [4 r- ~6 A; O
  17. * published by the Free Software Foundation version 2.
    9 V! h- U- ]* S
  18. *! ^6 `5 E6 y) p. h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 G! \( c- J1 N( T) ]
  20. * kind, whether express or implied; without even the implied warranty+ l1 J" [! N9 p0 L6 i1 @/ }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 ?/ J# f$ M2 i
  22. * GNU General Public License for more details.
    2 G1 V1 J+ v, U( j6 ~$ ?
  23. */
    ; c' X0 N# U( g, w8 v1 S6 O. N
  24. ; X  I  O  q* @
  25. #include <linux/module.h>+ n6 d+ r' K/ D3 ~  n
  26. #include <linux/init.h>
    2 I) R6 H+ O$ X+ [" {
  27. #include <linux/errno.h>
    ( H0 {. t4 d/ t7 j. g
  28. #include <linux/types.h>
    7 V$ ]2 `' U5 X" c9 E
  29. #include <linux/interrupt.h>
    3 Z6 Y& W/ {, B3 Z7 ?
  30. #include <asm/io.h>& g) M7 F) e; Q6 c3 J& L+ o6 B; t
  31. #include <linux/moduleparam.h>
    ; M% Z# R! \( {% S) ^/ k% H. h
  32. #include <linux/sysctl.h>  U3 v2 }( w4 m, y
  33. #include <linux/mm.h># Z1 I6 \2 F7 A
  34. #include <linux/dma-mapping.h>8 Q; w! D7 r: @& o' M. Q; b; L% x

  35. - q- e* F$ _! O1 N9 z" i
  36. #include <mach/memory.h>
    $ I9 H( W7 Z$ C9 ^" L% C
  37. #include <mach/hardware.h>
    % m4 N, \8 M- a# b, ^6 _" I8 M
  38. #include <mach/irqs.h>1 ^$ P( k6 a" P3 ]0 [( ~& G  A& ^
  39. #include <asm/hardware/edma.h>
    1 O! o( R0 N5 p( _. x1 f, K
  40.   d+ A) l/ o6 p% e
  41. #undef EDMA3_DEBUG
    8 c3 O$ H' V4 y( @
  42. /*#define EDMA3_DEBUG*/0 c7 Q7 c& P% S& `3 d
  43. " }' r7 |: V) k) g; }& K& M* f
  44. #ifdef EDMA3_DEBUG
    0 K& e/ l: P# v2 a9 R% J. ]0 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 \& e) q9 V; R8 R9 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* T6 W) G/ D) h+ @& D5 T* Q' e5 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % p4 I3 u2 W8 z/ d
  48. #else
    8 t( f# N; P) S( p' C+ ^: r
  49. #define DMA_PRINTK( x... )
    0 ]4 l' ]  }  E# f; u  F
  50. #define DMA_FN_IN
    : y6 o4 x" V2 l9 G
  51. #define DMA_FN_OUT' S- P+ c6 R9 g& Z- Q" u1 W
  52. #endif
    - E7 i. ?% I8 w4 v7 V3 h$ ?

  53. 3 u. O1 b# [' S" r0 B. I- h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      v: @2 j; Q" Q
  55. #define STATIC_SHIFT                3
    9 g& |; O, G+ Y; o7 n
  56. #define TCINTEN_SHIFT               20# A2 D! N) N/ N, @/ f8 t) J
  57. #define ITCINTEN_SHIFT              215 Y# E2 Z+ A3 t( `4 y: n- G+ i! f
  58. #define TCCHEN_SHIFT                22
    / `- l, \* h$ A( a: P
  59. #define ITCCHEN_SHIFT               23
    . p, b. v& \% W1 a& m: n" ?

  60.   V( ^$ Q9 c1 c! m4 c/ c3 X" p. W( h. ~
  61. static volatile int irqraised1 = 0;) D4 c' h* h  S5 u; g* s+ b* f0 d8 Y
  62. static volatile int irqraised2 = 0;
    + Q4 n+ `1 Z( d7 A% J4 Z7 J& u
  63. 5 b6 m  Q% E+ L4 _5 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 }8 c2 d4 e4 h0 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : ]* I- N* X. Y1 X5 U' N/ f2 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 E4 G3 j) {( ^3 Q/ b. S
  67. 8 q+ P5 y/ `2 d' @$ Q
  68. dma_addr_t dmaphyssrc1 = 0;+ M* |* q4 X3 Q2 G% T+ W
  69. dma_addr_t dmaphyssrc2 = 0;9 L' }8 O! _1 o, o# Q! h
  70. dma_addr_t dmaphysdest1 = 0;
    + g* u8 [. R7 u* Q% ?- ^
  71. dma_addr_t dmaphysdest2 = 0;
    8 O0 J5 U' {5 w

  72. 4 s3 C& [% Q8 G% n# P
  73. char *dmabufsrc1 = NULL;
    3 ?- R( n( d% J
  74. char *dmabufsrc2 = NULL;% f& {" A. q1 e. h9 ?: d
  75. char *dmabufdest1 = NULL;
    : f2 y- S! o+ ?/ J& i+ c
  76. char *dmabufdest2 = NULL;
    2 r8 B* E0 |3 L; G: k
  77. ; |0 X' M3 S3 X3 q- X0 I7 R9 I! v
  78. static int acnt = 512;
    " h; N" u  u/ s+ J% W, z4 |
  79. static int bcnt = 8;2 W* G( z- b7 a+ M; P9 C( D
  80. static int ccnt = 8;
    ' f4 U; |' O. t- B! a: B4 ]
  81. ! o7 G; \# p2 C: y  o/ _( g+ a; F
  82. module_param(acnt, int, S_IRUGO);
    . H/ K5 C( N9 x; T$ w
  83. module_param(bcnt, int, S_IRUGO);% d+ F  }$ B$ y' [& I4 K' Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: Y) R* _# _4 V" ^$ F6 Q7 ]9 l- ~; n" j
. o4 y/ L$ I& w" e! q6 D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ y1 ]& B7 t# _/ N/ N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ Y' v' Z) @& l1 l+ x+ C2 H+ H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 ~2 [# J" C% l5 k& O8 w2 i; T& l/ X3 @* L/ S( a
0 x* B7 C/ S' v, V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 05:15 , Processed in 0.055514 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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