OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 N; ~$ _5 v1 X( w
  1. [code]EDMA sample test application
    3 |) L! ~8 X# d( q" \5 T4 ^0 m
  2. /*+ p) x9 [  t5 e0 p; w, [
  3. * edma_test.c5 N! u/ H/ T- W$ r
  4. *
    + f) J; {" x7 {4 U, _
  5. * brief  EDMA3 Test Application
    & Y2 |' E$ L  k) t/ Z$ x- c. }
  6. *
    ; X( e* L% D5 q2 e/ K
  7. *   This file contains EDMA3 Test code.
    $ q4 T. M6 L/ U! `
  8. */ Y9 j6 n# a+ o6 j! Z8 K; [2 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * C2 l( R7 h8 x6 }5 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! c7 k* I8 U, r5 m9 O8 \
  11. *         TO CHANGE.* @8 A  u* Z5 L5 t  B$ E8 r$ a
  12. *1 M9 W$ H8 W# A- w( r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 b+ O( P( }+ `5 J9 N# L4 n) `
  14. *
    ; X8 C; k# F; N0 w# \7 N
  15. * This program is free software; you can redistribute it and/or9 g6 R0 T5 S. m6 Z: l4 T, _  i
  16. * modify it under the terms of the GNU General Public License as
    % X& b1 X" x6 T* `: S6 _' ~8 f9 {
  17. * published by the Free Software Foundation version 2.3 S6 x2 j, l+ f1 ~* m/ _
  18. *& t5 i: q* N* l* Y4 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 {0 ]( v; O3 g5 e$ Y
  20. * kind, whether express or implied; without even the implied warranty
    & K) D  Z$ [3 p/ M, t9 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 w' t$ y6 I  i' g& [9 X6 I% ], o
  22. * GNU General Public License for more details.
    & K, b+ P8 G/ I7 t5 H* l5 p" H  w' M
  23. */* ~% O) p7 o1 ?+ }8 I
  24. 5 D2 O# K& Y8 |# e0 o# D
  25. #include <linux/module.h>0 N7 m7 u# C2 \
  26. #include <linux/init.h>: _0 f/ F& c/ e8 C
  27. #include <linux/errno.h>
    6 z2 [4 o6 ^& w( f1 E$ V
  28. #include <linux/types.h>
    ! o8 n+ {* Q9 m2 A: {5 j
  29. #include <linux/interrupt.h>
    5 Y4 y( W# S0 l6 h1 I) m4 s
  30. #include <asm/io.h>' l. E2 {3 @' @& z/ R0 z! V
  31. #include <linux/moduleparam.h>$ ]8 H2 A: H4 M6 [' }
  32. #include <linux/sysctl.h>( e& b; @4 ~4 K8 P% k  O
  33. #include <linux/mm.h>4 n4 ]6 _) }" J
  34. #include <linux/dma-mapping.h>
    1 P% c7 ^9 i7 b) I

  35. 2 e, G8 c: M2 r
  36. #include <mach/memory.h>
    / M8 V  l# Z9 P! P. a/ N+ W
  37. #include <mach/hardware.h>7 _# a9 e7 f. p0 j
  38. #include <mach/irqs.h>
    " y2 P/ f- X' E. A
  39. #include <asm/hardware/edma.h>" V, P7 `  U2 v9 L$ J& f
  40. + ?4 x3 t9 o$ i4 d% G
  41. #undef EDMA3_DEBUG% U  g) _2 |4 v4 i3 {8 c9 V; U
  42. /*#define EDMA3_DEBUG*/1 }" A, k, t" ^6 R+ N1 C5 }& w
  43. . n6 |) W& @( \" X- ?4 c  j* [6 W
  44. #ifdef EDMA3_DEBUG
    0 E5 V/ ?" f7 h( M, X. {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ I7 Y. L; m7 b. d+ C) ]* I! p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " s9 N  o# {" y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 h' v. u& n2 J9 u; R1 m( U3 x
  48. #else
    8 \# P  \, S: K% Y3 c% k; s
  49. #define DMA_PRINTK( x... )
    ) P/ |- D4 a. _
  50. #define DMA_FN_IN
    6 _% l# `2 S  t7 n! d
  51. #define DMA_FN_OUT
    7 o! J! X- F6 q8 r2 s: W5 K
  52. #endif
    ) D8 }' D7 W. D% |; P1 {' p2 w

  53. # O% ?$ H) M# Q5 x6 @2 o5 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  k. Q5 m% n! T3 s' G" y
  55. #define STATIC_SHIFT                3
    ( x! z) a8 p% B* _% {
  56. #define TCINTEN_SHIFT               20
    7 @  ~9 e3 j' g( A
  57. #define ITCINTEN_SHIFT              21
    2 ^* t5 `3 s  ?" b* U7 o. B
  58. #define TCCHEN_SHIFT                22
    4 w5 s6 l" s' z6 Z3 t1 C2 L! Y& s! l
  59. #define ITCCHEN_SHIFT               23" }, b5 Y! x! M7 s, |4 j
  60. 3 w7 _7 u- o; D' ^# W
  61. static volatile int irqraised1 = 0;
    * M% [6 i& `, X/ o
  62. static volatile int irqraised2 = 0;
    ) H, |, u+ w% e' G
  63. - z3 m( X. M0 a1 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 l# B  {0 i$ g: u( e0 V& n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , {9 I) X7 `+ {: ^# @% _& C1 i. m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      S6 p7 C" k! `0 x
  67. " ]* d+ a+ q% _( ]; {
  68. dma_addr_t dmaphyssrc1 = 0;
    3 m: p, `. `' J9 d0 Z
  69. dma_addr_t dmaphyssrc2 = 0;
      g6 B9 L- ]* q# U
  70. dma_addr_t dmaphysdest1 = 0;
    & s3 A7 }& k; w
  71. dma_addr_t dmaphysdest2 = 0;
    & x, M1 K8 r3 U2 n

  72. " |0 Q! e2 ?/ ~0 r1 U3 G7 _
  73. char *dmabufsrc1 = NULL;5 G4 c4 u: X6 C: U  m0 c
  74. char *dmabufsrc2 = NULL;& ^( h( G4 {6 f4 f5 e
  75. char *dmabufdest1 = NULL;3 M0 H# l2 M+ o. ?/ M4 K
  76. char *dmabufdest2 = NULL;
    ) W1 Z1 t3 U/ S  T4 A0 h0 b% @

  77. - H$ q( ?/ A: F  I- o0 p+ u
  78. static int acnt = 512;) [7 j6 g5 M1 T
  79. static int bcnt = 8;
    * X+ U- [8 j& @( C
  80. static int ccnt = 8;
    ) a9 q* a0 ]* t% u! Z
  81. : }5 l- u+ M* j7 k* C2 b* P
  82. module_param(acnt, int, S_IRUGO);
    7 ?1 o0 D8 q- ]0 E1 j
  83. module_param(bcnt, int, S_IRUGO);: F9 S3 s' M" U6 X! b* ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% `& [  p5 d+ c  o' o0 W- Y" F
/ n- M: \, h% R( y& A; S. w% f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ a; K! i' G9 @1 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& [3 r; j# d7 R  c0 g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 n  V; D( R% Y2 r. j8 `" b; ?( L+ M5 X% y9 y4 i. i) Y

) P1 _8 F" J. \4 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-3-20 14:56 , Processed in 0.060026 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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