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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 L3 ^, F# R6 z) I
  1. [code]EDMA sample test application
    / p* n; s  c) x3 B- I; D
  2. /*
    ( W$ p% f2 R: U" |
  3. * edma_test.c+ s8 F0 j. i0 g% V9 E1 g* h
  4. *: w6 `! ~" I' w. S: S* |+ O- `  N$ Q
  5. * brief  EDMA3 Test Application( J& d' y: l/ }9 \3 M; `5 |% h
  6. *
    * ^9 B7 G2 Z' H4 m9 k' n. ?
  7. *   This file contains EDMA3 Test code.  l+ a8 X) n5 ]. `
  8. *  Y8 U, G4 F7 Y- f7 D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) p+ C! M% g3 l7 G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , Z/ v3 _" }+ s) ?# p3 a6 T8 i
  11. *         TO CHANGE.
    1 o, H6 Q: q+ d% x% o* k
  12. *5 d# _$ S+ y0 P8 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      H! b0 I, e6 {
  14. *
    3 \' w5 A- Q8 y8 g: `  d! R
  15. * This program is free software; you can redistribute it and/or9 q! s' c7 q% z9 C" }* N( s6 _  a
  16. * modify it under the terms of the GNU General Public License as/ }+ u  t* {, D5 m* _
  17. * published by the Free Software Foundation version 2.2 ~  s2 Q% H! l9 r! r
  18. *
    . V1 @8 }( i0 H- }& j1 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# O, g( ^% T4 d; g! I3 f
  20. * kind, whether express or implied; without even the implied warranty) n8 D- s8 ]' k% u* w7 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& N! Y- R1 y( e8 V% ]. ~+ D3 P
  22. * GNU General Public License for more details.
    / Q8 V8 s, L" a8 j7 k& t; ]) }
  23. */
    8 i$ L7 A! ~  z) [) f+ f% u; P
  24. . I. @, s. Q( ^# y9 W5 j6 G
  25. #include <linux/module.h>
    0 k2 e- \9 H! s, X/ H2 l+ O" L
  26. #include <linux/init.h>, {& o9 W; v* R( V9 k
  27. #include <linux/errno.h>
    5 d; q* K1 W* \/ q
  28. #include <linux/types.h>7 Y" `, \( M( ?* {
  29. #include <linux/interrupt.h>
    1 i; Y% ~. L6 x7 k; |
  30. #include <asm/io.h>$ J2 d( I+ o" V9 [1 c: T
  31. #include <linux/moduleparam.h>
    ) ^+ |  i3 M  B# r# t  C: k1 F
  32. #include <linux/sysctl.h>
    2 @* N- ^' ?; S# H, h
  33. #include <linux/mm.h>
    ; N) ^2 c3 a0 B- }  @* U
  34. #include <linux/dma-mapping.h>- k, J% i- g8 D" u
  35. ) v# v3 n, q/ T' m# T2 _8 E
  36. #include <mach/memory.h>6 V1 y+ F5 K6 W# G$ L' V- d
  37. #include <mach/hardware.h>
    " F0 m" I  C( \5 V# \
  38. #include <mach/irqs.h>  q. c- V, f# B. J3 E7 R; F
  39. #include <asm/hardware/edma.h>3 ^* K( `5 U8 H1 l

  40. ! p+ n7 p3 c# w( o6 h, J% k: s
  41. #undef EDMA3_DEBUG, ?% O7 _/ _5 q" d
  42. /*#define EDMA3_DEBUG*/; U$ p8 _; ?+ e, S4 A
  43. 9 H0 w) t) c3 O8 ?1 u4 x' P
  44. #ifdef EDMA3_DEBUG9 o: Y' Z: ?; U- o, d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 ^% ?4 W# R! ?) A7 l! f4 V. v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) p7 ]! B6 ]- i" Q4 [* c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); {- u, d4 g: \# a- e) `- J
  48. #else
    . x1 f# F6 X3 ?1 ~
  49. #define DMA_PRINTK( x... )
    - L8 x& }1 L9 s  m1 M
  50. #define DMA_FN_IN
    5 q( w0 ], E7 k
  51. #define DMA_FN_OUT
    , u3 q% h  J9 S! r4 }2 [8 C
  52. #endif4 O' o$ a# w7 B8 `8 ^" Z! v

  53. , ~1 l; l; i6 M$ u! e8 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); `# _  ?* R& m" u* C  X
  55. #define STATIC_SHIFT                3
    , R$ T: R9 {0 A) h; g7 o, s, H; u. y
  56. #define TCINTEN_SHIFT               20
    ; ^! _3 V/ @. c" @, ]! p
  57. #define ITCINTEN_SHIFT              21
    # j5 J2 q  y& |
  58. #define TCCHEN_SHIFT                22" {  c, S$ ^! _+ S5 {$ T3 y
  59. #define ITCCHEN_SHIFT               238 c% Y; f$ D: S' E, d

  60. 0 R  m" [+ V7 U6 n/ n
  61. static volatile int irqraised1 = 0;0 P8 o4 x8 B# ~
  62. static volatile int irqraised2 = 0;  U+ q2 O4 w2 j( I5 K$ w* J
  63. & m1 w! i- s$ H' p: c" d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " s+ W( O7 B5 K+ d5 `, P( K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 q- O' E5 v/ l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 `! n% U. |. [+ V% e% B6 P

  67. : {! d2 i  S/ o, I* G8 p) t
  68. dma_addr_t dmaphyssrc1 = 0;; p& X) l8 i& I1 @0 c3 V
  69. dma_addr_t dmaphyssrc2 = 0;4 @, Q" Z8 }( l' F  t! q2 R! n; }
  70. dma_addr_t dmaphysdest1 = 0;
    0 s' n$ B# @& R$ T) O) W. h0 \
  71. dma_addr_t dmaphysdest2 = 0;
    4 D* ]3 f# u9 ?0 C

  72. 7 g$ K0 B5 _2 K9 e7 C! h
  73. char *dmabufsrc1 = NULL;
    $ I+ a6 I& V! [4 G( b+ H# ~
  74. char *dmabufsrc2 = NULL;
    9 |$ ^$ I) C; P& N) m
  75. char *dmabufdest1 = NULL;# n0 w/ |% i( m# a+ A# M6 z
  76. char *dmabufdest2 = NULL;
    : K: q' C# h. j4 U$ I
  77. 9 L+ z* ^7 g, Z+ _5 E) a4 q
  78. static int acnt = 512;1 Y( [% w" a- A; s- R- C
  79. static int bcnt = 8;: J1 ]# I" g) p8 k" T9 W: P/ u2 r
  80. static int ccnt = 8;
    7 m# a# k& `- p

  81. ' l* @3 L" P- S' g9 C8 S8 ]' h4 A/ y
  82. module_param(acnt, int, S_IRUGO);
    ( Z. U* W: u  I
  83. module_param(bcnt, int, S_IRUGO);3 n+ J' x# W0 [7 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 @( R! t: S# F  x8 M# P& c0 r  p

! k/ t0 Q1 m6 Q- Y  \/ ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 q/ K- D: Y5 r) V2 g* g, tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ T; a0 Q! U8 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 {4 ^; R4 E) n- R& x
' I/ L5 q; G7 H+ ^
5 Q2 Q# e: `! h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 21:28 , Processed in 0.044072 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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