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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* e- j6 L2 a. t* T* K
  1. [code]EDMA sample test application5 ?8 K% T/ N- h6 L8 ]
  2. /*
    4 T& `, \; j/ Z! P: j& {. Y
  3. * edma_test.c% H1 D: T) u* i7 P/ j
  4. *
    / ~8 S; a$ g1 @8 u" O* I
  5. * brief  EDMA3 Test Application5 l: k: r8 p) x0 F" u
  6. *! h5 h, J- ^. p# Y
  7. *   This file contains EDMA3 Test code.- {8 r6 T8 g7 G7 o: i0 O$ j
  8. *3 w5 L5 r4 s! F. E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 E& y8 u, V9 e/ w2 z% M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 K2 ]' T7 I, I( O4 p
  11. *         TO CHANGE.( u6 I- J8 A/ s7 R' U
  12. *7 n, {& B* O9 |2 T/ e6 P* o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ E' z  m# F' m, s9 u. d5 E/ W
  14. *
    $ N$ e/ t4 D! p: }) \
  15. * This program is free software; you can redistribute it and/or" V7 d% `4 ^' y; f$ N5 k- {
  16. * modify it under the terms of the GNU General Public License as# s$ u& G# D( x& }7 w) i
  17. * published by the Free Software Foundation version 2.- t, K2 Z5 R4 J0 o
  18. *+ B$ S2 {# x8 w* J& D5 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + j: E$ f8 p% }$ z4 Q& X/ P$ H- q
  20. * kind, whether express or implied; without even the implied warranty9 A( D" [( x9 Z- ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 O7 n$ f- N( }- z
  22. * GNU General Public License for more details.
    0 F6 A0 |& W% x$ X  N$ |
  23. */! X% s( T1 S+ V9 \$ e" ^
  24. ( v2 h4 C0 G" P; g3 G1 B' Y0 V
  25. #include <linux/module.h>5 J% S! J& N1 _
  26. #include <linux/init.h>
    3 O  R) ^  E/ @1 `
  27. #include <linux/errno.h>% O2 F( L: [- \+ X$ u, X* c' |5 R& f
  28. #include <linux/types.h>
    9 p' N2 S/ x5 [2 T* r! b9 y
  29. #include <linux/interrupt.h>+ g- y, t# O  y+ x0 d$ g
  30. #include <asm/io.h>
    " E, ?# S! J0 I6 i  ~7 A4 g
  31. #include <linux/moduleparam.h>
    ! r1 k6 }, _( f8 E; }
  32. #include <linux/sysctl.h>
    ) f* Y* I; u# K/ D% M
  33. #include <linux/mm.h># C' x7 _0 b& c  j
  34. #include <linux/dma-mapping.h>; Z" q" P& O, d. a" z8 `
  35. ! c9 N0 N4 K+ W6 ^& b
  36. #include <mach/memory.h>
    5 [) X3 R, C7 c4 H5 u8 q8 M
  37. #include <mach/hardware.h>( z0 ]8 E' \+ z; k) y
  38. #include <mach/irqs.h>
    " @& w# ?5 ]# \
  39. #include <asm/hardware/edma.h>. E' |+ e: R1 Z( `$ T

  40. 1 ^/ [7 I. L2 I" V$ G+ m5 h+ M
  41. #undef EDMA3_DEBUG7 J, q  D- m. F
  42. /*#define EDMA3_DEBUG*/0 A0 ^9 \2 ?0 n% n' P) L5 m( Y8 ?

  43. ( p& C: y; ]0 }
  44. #ifdef EDMA3_DEBUG0 P* R  m, x% r# h  T3 @: u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), I* ~5 W* Q( F1 \: q6 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) c5 p! T# \( g6 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % Q* K6 Y8 P+ l1 L/ I* C
  48. #else" N1 [  N7 Q; e; J- `' z% _
  49. #define DMA_PRINTK( x... )4 U* F6 B7 v# ?- `1 J  c4 i
  50. #define DMA_FN_IN
      j' s/ C0 R) R) i' E
  51. #define DMA_FN_OUT
    % K# L( M( N; P: c$ w
  52. #endif: X" V* \; p% l# q( D; {0 V' l
  53. & [! H( H0 `) U" H) ^7 |5 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( I, M# X3 e7 A$ ~' b
  55. #define STATIC_SHIFT                3
    1 S4 m  M  u6 d" B; G% O; F
  56. #define TCINTEN_SHIFT               20. @8 F/ G( P/ _) O
  57. #define ITCINTEN_SHIFT              21
    % P& a/ C- a# t2 Y2 M
  58. #define TCCHEN_SHIFT                22& N  n8 [% Z' o! n2 U2 G+ T! B
  59. #define ITCCHEN_SHIFT               23
    ) E* @" X; X( v3 b- \0 K1 O% `" T

  60. - T8 K" g2 e8 V$ Y' X
  61. static volatile int irqraised1 = 0;* S! J; n5 p3 s  `; w7 N, u/ R
  62. static volatile int irqraised2 = 0;
    : i) _$ A# u- a1 s
  63. # T, F0 Q  h- w1 x- \: F1 F8 j' L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 v* @8 @5 L8 g  _, O0 X2 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Q' |/ n! m1 E/ f& X+ J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 k0 |* \1 [" z4 F9 R- {; l7 `

  67. 2 |% }& W0 T+ U% X! X
  68. dma_addr_t dmaphyssrc1 = 0;; W# G# e% Z7 b5 J( g3 @
  69. dma_addr_t dmaphyssrc2 = 0;
    ! Y- U" y4 z6 L& u
  70. dma_addr_t dmaphysdest1 = 0;8 R5 j" t" z+ H+ x/ B0 J% \
  71. dma_addr_t dmaphysdest2 = 0;! K: i% h; {2 L* _. w& T' g' ]
  72. ! g! p6 A1 x4 V) U- K: ^: G4 W
  73. char *dmabufsrc1 = NULL;
    0 g0 G4 f* ^5 x  i
  74. char *dmabufsrc2 = NULL;
    % x/ G& X; \; J# ?) w% Q) y
  75. char *dmabufdest1 = NULL;9 l& U& W8 d& {: D9 }
  76. char *dmabufdest2 = NULL;
    . H) p6 f& U% V6 ~& y$ X# ?

  77. 1 f/ b- j+ k; f0 d5 h
  78. static int acnt = 512;
    + A) c& {3 o) G# s- B1 p
  79. static int bcnt = 8;8 ~0 R, p7 J4 ^' q; s
  80. static int ccnt = 8;& R, ~# e9 \6 D7 F+ s3 Q# G

  81. 2 }) [6 u* Z& h" y% `4 T
  82. module_param(acnt, int, S_IRUGO);* w2 u, H) B5 {2 b0 D- m; T
  83. module_param(bcnt, int, S_IRUGO);( }3 V8 E; C2 \$ }3 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 C; @7 e! F* C& i/ B
$ A* Z: F. t' l7 ]4 n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' S" j+ i! E6 V8 v, l; b: F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  X( W0 h1 P1 e: q  k- n- p$ N/ F3 [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 y& a* C9 ~, A3 \8 O0 g% x5 v' b8 \. B) V, ]! ]
$ b) u7 @- c  U: N- K% a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 17:38 , Processed in 0.038073 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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