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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 E1 x$ Y. ^9 t3 A5 j' Q; w* K, ~
  1. [code]EDMA sample test application
    1 g) o3 R; Z  t- g2 @
  2. /*: O& W- j/ E5 O1 }
  3. * edma_test.c
    3 W% w6 o1 I' n" ~' K
  4. *6 k0 n  h4 O- M; r% ]; }: Z& `
  5. * brief  EDMA3 Test Application8 Y  a* u$ l9 E
  6. *! s6 I# q5 E. E% A6 o
  7. *   This file contains EDMA3 Test code.
    ( ?" T" w/ d" c# T: c7 l0 F* s& I
  8. *
    . C' X, U6 Q7 E( F$ w# h+ ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % b* l5 \+ g" [8 V* b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! U: |; ~5 @! P, m5 R- P
  11. *         TO CHANGE.6 D8 P4 u0 c! ?" r! R: ^
  12. *( V" S9 A: `4 Q8 {1 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 ]4 A5 F' [+ G* |: H6 m* I
  14. ** C$ ?/ s1 |9 g% T/ o4 B9 X! |
  15. * This program is free software; you can redistribute it and/or
    % Z3 A! a* S9 ], C9 D
  16. * modify it under the terms of the GNU General Public License as
    * I7 j; v4 H, `' w4 p- \
  17. * published by the Free Software Foundation version 2.
    7 a9 q8 \/ d, M$ _1 H: X
  18. *1 Y: M; y. ~$ l3 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! \& s+ [' a- q
  20. * kind, whether express or implied; without even the implied warranty
    " y/ c; [% f  _$ e& C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # w. H7 Z- t( J
  22. * GNU General Public License for more details.
    $ `( e- p& a- _+ @& s0 Y5 I* u; J9 n$ F
  23. */% ~! D8 T9 x! ~; S; Y, Q" X

  24. 4 |, ~3 {4 ?! U+ P6 D* N1 Y# f
  25. #include <linux/module.h>0 c( F# d5 _5 A5 K- C
  26. #include <linux/init.h>  q, i8 F- ~; e8 g8 t( f
  27. #include <linux/errno.h>& ?: S7 `* x1 Y' N
  28. #include <linux/types.h>, u" ~9 o" G! E/ m9 M
  29. #include <linux/interrupt.h>. N" T- D) K- r  Q9 U
  30. #include <asm/io.h>
    & {+ Q, E1 V! E5 u  s0 X
  31. #include <linux/moduleparam.h>) Q/ e" b9 [* y* [5 s, y. u2 {% L
  32. #include <linux/sysctl.h>( O; S7 r0 r4 l% X- J" z! ]1 U
  33. #include <linux/mm.h>; V) ?) u: z- T, ?! N& @: K/ ~: r
  34. #include <linux/dma-mapping.h>
    , M3 i% l$ t5 N; x& Y9 q; a0 ?/ x

  35. # q- c0 s; a/ t; I, Y
  36. #include <mach/memory.h>
    7 C+ S( ]5 {& B) _6 d! ~$ Z
  37. #include <mach/hardware.h>
    $ l  J. P, A. Y# w$ q# F
  38. #include <mach/irqs.h>: q% h( x' j( V/ @
  39. #include <asm/hardware/edma.h>
    0 U! [/ Z! h: g9 z

  40. & ~4 M# e3 a! I
  41. #undef EDMA3_DEBUG3 i$ ~* A* p( p: c3 h0 [: V4 }/ Y  G
  42. /*#define EDMA3_DEBUG*/7 z+ T1 P) g. D7 F* ^0 z: D/ U

  43. - e8 [* r% u: _0 P/ t2 }
  44. #ifdef EDMA3_DEBUG0 w0 r9 m, c) P' l3 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( G+ `# w  i, }+ _, K% K  y& i) m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 D7 Y9 i/ q2 m6 B& R$ W; h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ f+ ~8 t0 l  X% y# S1 s
  48. #else* K. ?, H+ P+ Y; V- u& Z
  49. #define DMA_PRINTK( x... )3 A+ [; S' P0 |
  50. #define DMA_FN_IN$ @, m$ N. ?1 |& t' j: V
  51. #define DMA_FN_OUT
    " _( T4 Y0 H1 ^+ e4 [) ]$ p* A+ S: Q( X
  52. #endif" |% R3 Q3 j# A1 s1 |; z2 G% d/ ~4 T, }8 x

  53. 8 b) Y4 p* D* P; \7 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & N7 u5 ]' V+ H# N& J; F
  55. #define STATIC_SHIFT                33 }: V' X+ v6 @% |
  56. #define TCINTEN_SHIFT               206 V4 s' `: B% V& ^" L; I9 T8 A+ m4 G7 J, Y
  57. #define ITCINTEN_SHIFT              21' ]+ e. ^6 ~$ `/ p/ t3 Y. k! C
  58. #define TCCHEN_SHIFT                22
    7 n  l4 g6 W2 @
  59. #define ITCCHEN_SHIFT               23
    , `# J& \' E& y. ]
  60. & [0 k' P" H' O' F
  61. static volatile int irqraised1 = 0;+ W0 ], `! L( Z% F: G8 S
  62. static volatile int irqraised2 = 0;
    + p( W( O* f1 H& V  a* n

  63.   v7 ^9 P# q0 D; r8 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * h% O9 Q4 @- s, n) S  u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( S) r+ T. y5 ]: A0 s; F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: L- b5 T& n$ w1 W
  67. ; v* r+ o6 h" [. d& n
  68. dma_addr_t dmaphyssrc1 = 0;
    + ]  n1 ?3 N" |  q
  69. dma_addr_t dmaphyssrc2 = 0;$ k( J5 e7 h% y; J& H6 `  a
  70. dma_addr_t dmaphysdest1 = 0;% q( o) S! d, z/ g
  71. dma_addr_t dmaphysdest2 = 0;
    2 G* ?8 |0 r' i; ^3 Q. k  [

  72. 4 r& u" ?" `. n% h$ P6 j
  73. char *dmabufsrc1 = NULL;
    : a9 u  N4 S9 Z0 W/ e( |7 Y
  74. char *dmabufsrc2 = NULL;
    ! N* Z. e: W( r' g2 h
  75. char *dmabufdest1 = NULL;4 u5 S. c7 \+ J
  76. char *dmabufdest2 = NULL;
    9 u3 e7 x+ g/ Q  n7 d6 k
  77. 1 q2 D- D: W/ l8 r: Y  {
  78. static int acnt = 512;; A/ v7 s( z, B  w0 M8 x' e$ o
  79. static int bcnt = 8;
    . s1 k' [/ u+ u0 b
  80. static int ccnt = 8;- I( O+ K3 @% j; }: h2 c4 s. U
  81. ; g  l7 Y" v& H2 P
  82. module_param(acnt, int, S_IRUGO);
    6 E  M: r* B$ y( b5 L# m0 ^$ h
  83. module_param(bcnt, int, S_IRUGO);
    & b2 X% e5 B. a' f7 s! c+ k' f# \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" I# `' y% b8 `8 R6 x1 C* ^+ i
8 m4 L- M. F4 z- g1 v% v, e( z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# V/ s/ m! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) @4 B  \8 U5 I* Y/ H6 {$ `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  R- p" Z0 `* c* e/ j

3 o5 Z3 m& X8 K) D1 ]* Z+ W4 }: ?* s- n! B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 16:10 , Processed in 0.037963 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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