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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % V" p/ F) W& u& B) B: m7 E/ B
  1. [code]EDMA sample test application
    ' m& y# C$ e, C2 i. h' m0 v/ ]
  2. /*7 F+ s! k, f9 X5 h$ ~
  3. * edma_test.c8 Y1 U2 F- x" M1 S& y9 Z# Y3 T
  4. *
    % h" }$ v: o  N' \9 {' F& d
  5. * brief  EDMA3 Test Application
    ' h. K: h! z0 f9 T! L. q
  6. *
    $ i0 b+ X( Q- b9 {
  7. *   This file contains EDMA3 Test code.; d7 c: i. J0 p0 `0 w' |0 n
  8. *+ U& s( A( J8 I1 m  p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 P% q% D& i' U  s$ r0 E0 o* l: D2 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ H; ~3 e; a4 t& s/ Y
  11. *         TO CHANGE.
    5 q2 ^5 O' }5 b+ J
  12. *" `4 _  ~0 O) e% f8 o3 e. F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * J3 g( m! E: @  r8 Z$ W
  14. *
    7 @# J$ ?7 Y7 s$ D- H5 |9 y
  15. * This program is free software; you can redistribute it and/or
    7 T% G3 s2 @8 L7 Q9 L5 d/ V
  16. * modify it under the terms of the GNU General Public License as' [; M  e) P: L& g! O  J& ]
  17. * published by the Free Software Foundation version 2.
    ) h& r8 I' ?- E. S8 e$ j2 U3 ]
  18. *  f: W9 `4 z9 p; z* w/ l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* x1 `* K" c9 e  a+ f
  20. * kind, whether express or implied; without even the implied warranty
    ! z5 X; j; m$ Y2 Q: b0 m% Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 ~/ g& h* W) P" Z* U* @
  22. * GNU General Public License for more details.
    * T5 q1 c4 ^1 m3 O
  23. */+ J! r* R# F; I1 S/ @0 {" y6 m3 m

  24. " h" [" S' i; ~9 P( o5 E% V: `
  25. #include <linux/module.h>& b0 N+ t( S% X& Q- O/ ~9 s; B
  26. #include <linux/init.h>6 G+ ?+ b5 f6 E/ P/ N
  27. #include <linux/errno.h>( [* h. n+ P2 ^0 l) N9 J
  28. #include <linux/types.h>; N: L3 ~$ m. e# T- f6 `
  29. #include <linux/interrupt.h>
    * h  u) H: r0 J" W/ h2 c
  30. #include <asm/io.h>
    0 k. }  A0 c7 P) n  i
  31. #include <linux/moduleparam.h>" s, J  p% `/ ^0 }; P9 |4 K- H$ Y
  32. #include <linux/sysctl.h>* O% q- z3 D$ _% L$ W& I9 p- Z7 K
  33. #include <linux/mm.h>
    3 x8 t! z( s% }( |
  34. #include <linux/dma-mapping.h>4 G$ D- D1 H, b# b$ W& l

  35. ; H0 Z, G& _! t5 q& O- |, c$ n
  36. #include <mach/memory.h>9 F$ l: l3 ^/ ~# {/ J& @2 X2 V( H" f
  37. #include <mach/hardware.h>" v5 D) u) Q% i
  38. #include <mach/irqs.h>7 h1 L- c  k: k  E$ h
  39. #include <asm/hardware/edma.h>
    - q# \8 b$ T- x3 t0 O! G
  40. ' g2 w- Q6 m; y, T. s6 O  E- @
  41. #undef EDMA3_DEBUG
    . z4 M5 e0 u  U" [4 b! f
  42. /*#define EDMA3_DEBUG*/
    , M0 {( j0 ?$ S1 e7 W

  43. 8 s1 X( z( g# L% f" Q/ W0 i
  44. #ifdef EDMA3_DEBUG- M& c/ M3 J! Y% S" F: W9 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , _! ^6 x( c3 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 l$ ^& L% L3 P! i0 G' o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) g1 o* U3 e) K7 M: e3 W) Q7 w
  48. #else9 m8 G% b$ P1 y
  49. #define DMA_PRINTK( x... )+ B1 z2 T8 c' W
  50. #define DMA_FN_IN
    & ~: v" k) Y6 j( S* a' d; X
  51. #define DMA_FN_OUT+ }' ]0 N0 X1 l) e& r8 P" s
  52. #endif0 K, x+ y7 O# @+ b  A
  53. % ]! z) J8 @5 \8 Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 j0 P3 }4 E' W+ O; D; r
  55. #define STATIC_SHIFT                3
      Y1 Z& s4 ]# E  ~$ D: ]7 D5 Y
  56. #define TCINTEN_SHIFT               20# f) R. s' n. Z5 j
  57. #define ITCINTEN_SHIFT              21
    - h4 h7 ]1 n+ k& d) z7 r' a
  58. #define TCCHEN_SHIFT                22/ ^" Q' w" z+ y1 }
  59. #define ITCCHEN_SHIFT               23; T0 w: F- b& d

  60. ) y* X. \9 R% W
  61. static volatile int irqraised1 = 0;
    ! m5 C! c# a# j; T8 ?! [& M
  62. static volatile int irqraised2 = 0;. v+ C4 ]/ \7 z8 F* m( i7 J$ w
  63. $ r* D+ m7 e* \* K; x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ^0 A5 H& x- J/ h4 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z! X$ X# D: y8 e( n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Z& S8 h, p9 H5 P

  67. + m4 J: F- a- J! U% s
  68. dma_addr_t dmaphyssrc1 = 0;
    / z5 h* T$ }7 v
  69. dma_addr_t dmaphyssrc2 = 0;
    3 a$ C6 _! ?7 p( F) d
  70. dma_addr_t dmaphysdest1 = 0;% f0 x. @" P  f
  71. dma_addr_t dmaphysdest2 = 0;7 y( U. ~. }( B" H
  72. ! W0 j8 X. {: Y$ F  f( R  \7 i5 v" n  l" d
  73. char *dmabufsrc1 = NULL;
    9 w% P8 O. @* G! a$ e# k" B
  74. char *dmabufsrc2 = NULL;' Z2 W2 k/ V6 z- v
  75. char *dmabufdest1 = NULL;2 [% N  v% U! X3 W* x' }% v" x
  76. char *dmabufdest2 = NULL;3 d' f+ N$ y" K5 M
  77. % n8 {+ t5 v" Y5 P' o
  78. static int acnt = 512;) Z7 B) N/ b/ G6 i
  79. static int bcnt = 8;! R6 E' g/ \  T; z9 y0 N; R  r+ s
  80. static int ccnt = 8;: O8 Z' {% u; V- N
  81. ; d' i$ M3 f. d- J1 c) V
  82. module_param(acnt, int, S_IRUGO);
    / Q8 v5 _6 N- B8 f9 U
  83. module_param(bcnt, int, S_IRUGO);- c( e; S; }  L5 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 ~) J; l$ P+ |0 @+ B. g$ n; L2 o& ^; P: d, H" }, ^: R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 ^2 i# U4 s* ~; r- V4 w% Q' k3 {! k
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 y4 p; C9 x1 E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* a1 c( C8 r- \! r4 S0 t
. ^. S& [# o. p: l
- C  ~) V! X% x! h, C! P3 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 21:16 , Processed in 0.037970 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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