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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 D0 `2 P7 C3 w; t- r6 U' p: h" F
  1. [code]EDMA sample test application/ s; F! i  B8 P9 x9 B2 e3 V
  2. /*
    2 ]; ]3 o; V3 B" Z7 _- Z2 \
  3. * edma_test.c' M0 x; Q- Z* L2 m( `6 z
  4. *
    7 j- O1 H7 m  Q. ?2 [+ [
  5. * brief  EDMA3 Test Application
    1 M( q/ H/ I5 `6 M
  6. *4 n% ]9 m/ H5 z
  7. *   This file contains EDMA3 Test code.. e6 ~8 }1 u5 T* O
  8. *& i9 p; j5 ^: _* D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 J* f3 X3 k/ y  R$ }! f9 n" h: L, x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & e2 P* ^- R! ]5 V# H5 ]
  11. *         TO CHANGE.; H! y6 }$ v" X8 u
  12. *. p9 U- M1 |/ d7 }, L: K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 I5 O4 i) x8 S7 c& u  O  B2 F
  14. *7 h2 c- a& s6 e' |  {+ p
  15. * This program is free software; you can redistribute it and/or
    $ g4 g6 B# J$ f, k# |( l
  16. * modify it under the terms of the GNU General Public License as
    # D  g4 r/ W2 S& G( @4 v
  17. * published by the Free Software Foundation version 2.
    * u; {! ^7 m. W7 E3 a
  18. ** q, R6 B6 D" x% c3 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& q; F" }; i0 f7 k
  20. * kind, whether express or implied; without even the implied warranty5 P# |+ f. j/ W' a' ^% t" L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ z$ ?# {! G, ?: f- y
  22. * GNU General Public License for more details.) q# \& n2 @' q+ o' f6 z
  23. */
    ' w/ q7 Q  J; }/ |+ Z
  24. ) d# s' a. f" [; F
  25. #include <linux/module.h>
    ; F1 E% {- P' k  P
  26. #include <linux/init.h>) u% |) W0 d2 i$ X! @: I9 c9 |7 }
  27. #include <linux/errno.h>
    : \! y. ?0 d: o0 {7 p- c9 j
  28. #include <linux/types.h>
    4 p4 p8 h. i- D- n% F
  29. #include <linux/interrupt.h>
    * h+ a3 r- d/ O" ~9 l6 w
  30. #include <asm/io.h>
    3 e. M4 \8 O) l
  31. #include <linux/moduleparam.h>" o0 A" f  B. |% C
  32. #include <linux/sysctl.h>3 v2 a5 n! q3 K# s% }
  33. #include <linux/mm.h>
    . P. A% U9 d* P" c  K
  34. #include <linux/dma-mapping.h>' ]4 o5 ~# N, ^. M+ l
  35. * E- @7 k( y7 V; D& z4 ?
  36. #include <mach/memory.h>6 P: k' ^7 x. r$ G$ f
  37. #include <mach/hardware.h>
    # r0 V5 {& G) Q+ H6 s" q8 j  e$ ?! a
  38. #include <mach/irqs.h>9 P2 I, }' }. A+ f7 A4 X2 H
  39. #include <asm/hardware/edma.h>
    ; h( k6 K1 m1 v; }0 U" i0 T2 n
  40. , Y0 E0 m9 Q7 g* g' W
  41. #undef EDMA3_DEBUG
    6 v  {8 n5 S! [& f9 ^
  42. /*#define EDMA3_DEBUG*/
    3 R0 ~7 x7 d$ I$ D. |2 \$ i* C4 [

  43. 5 }7 Q, S# X( Y# z' Z% [5 M3 t
  44. #ifdef EDMA3_DEBUG
    6 h) V& m( h7 O/ o5 A! q+ {5 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 T  @; M& x  A: m3 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : h0 P# U' @5 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 a6 j3 _* U/ Q" k3 n: l  {
  48. #else! M) m8 e! a) B* V+ H0 P# F
  49. #define DMA_PRINTK( x... ): ~. c* ^( u9 K* r( O& B4 z
  50. #define DMA_FN_IN
    . k# A2 C3 W# ?, |# {; h
  51. #define DMA_FN_OUT' f& f7 f: e: }0 Z- S7 L( q
  52. #endif2 D' S8 `4 F1 Z% i9 M9 z

  53. , {; F9 }/ C8 {* k" Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      m. f  n$ _; S1 Z
  55. #define STATIC_SHIFT                3
    ; f5 L* D7 f0 A  ~" u
  56. #define TCINTEN_SHIFT               20" K# ^4 T: F) W0 m: @% G
  57. #define ITCINTEN_SHIFT              21
    6 g) G. r& D8 }: M5 y
  58. #define TCCHEN_SHIFT                22* T  m# ?  T9 _, u
  59. #define ITCCHEN_SHIFT               239 H7 H1 ]: `" |* {) i
  60. 5 a5 p. M: M) S2 @0 R
  61. static volatile int irqraised1 = 0;
    6 p  g7 N$ p- P  s# S
  62. static volatile int irqraised2 = 0;
    2 [% a3 }; S# V0 E( |. O
  63. 5 N# F! Y3 t4 h+ a+ }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & ]: j" z+ Q, O$ U: y1 _# U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 k/ b7 B0 k9 q( U% r, X! g, n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ q) [3 e: H2 a; y

  67. + f; x' @1 o& K" G5 `
  68. dma_addr_t dmaphyssrc1 = 0;; @5 R! D9 r7 s7 }
  69. dma_addr_t dmaphyssrc2 = 0;
    7 M( w$ ^) c1 w! K
  70. dma_addr_t dmaphysdest1 = 0;  U3 q- l) @; H% Z
  71. dma_addr_t dmaphysdest2 = 0;' u" j0 j, D% B- n
  72. 0 W$ ^4 h% I" U( a
  73. char *dmabufsrc1 = NULL;
    + v  D, W. U2 E7 P& M) Z4 z' C- K% K, G+ b
  74. char *dmabufsrc2 = NULL;
    ' m8 R# T4 q3 M) X" [, x
  75. char *dmabufdest1 = NULL;0 |4 H2 a, k& ^1 o9 w( i+ B
  76. char *dmabufdest2 = NULL;. H0 l, ^5 J8 u

  77. 2 ?% n% }; L2 D2 E
  78. static int acnt = 512;
    6 V+ O; }5 ~6 h
  79. static int bcnt = 8;
    ' n' {# P% U" L0 d7 e: @3 c. m( J) k
  80. static int ccnt = 8;$ a% \" H* l6 f& w5 N
  81. - a" b2 g" w: o! Z# L7 j
  82. module_param(acnt, int, S_IRUGO);
    8 u- l. I; B  K% ]  C
  83. module_param(bcnt, int, S_IRUGO);# V6 i. T5 M  |4 t4 V' k8 F5 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! N; o8 E% l% M; Z' i2 i4 ?" O6 L9 N# z5 n  g/ @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; o0 {9 M9 K0 larm-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: l' D# ~$ H! t% I1 Y$ k5 @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. n  W& D2 D7 A2 C/ F

  }2 f# T1 \7 i' G* ?2 I
5 j' T( f# L/ l: p5 D3 O3 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-23 09:50 , Processed in 0.043007 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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