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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : q" n+ k- @0 e! S
  1. [code]EDMA sample test application
    ' O" }6 P3 x! S4 z& L" c
  2. /*
    % I6 L* O1 W/ @5 H  t6 G) C* c
  3. * edma_test.c# s  S( s4 A1 M8 s; c& y1 D
  4. *; [, `/ x- j2 D) B! ~
  5. * brief  EDMA3 Test Application
    % f& c2 D/ B( {$ v1 R4 y# S, D$ s
  6. *
    ; I( I3 b8 T0 M
  7. *   This file contains EDMA3 Test code.
    % \1 u/ R3 U: @- O- m
  8. *9 P  Y$ ^6 X+ t9 n- q9 c7 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. H* E& C5 Y0 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( u8 J& G8 G4 a; I" Q: z/ o
  11. *         TO CHANGE.8 p0 c5 D4 _0 a" I: z
  12. *
    8 {9 J% t5 P8 X+ m  \/ l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  d% ~% e  ]: C* G3 o+ U  j
  14. *
    7 ^0 R: f$ ~, I5 r. P, c
  15. * This program is free software; you can redistribute it and/or
    : `: k/ i' M" `: H) ?/ a
  16. * modify it under the terms of the GNU General Public License as
    + f- s! O6 K, O# b6 b* l, ~
  17. * published by the Free Software Foundation version 2.
    " s/ R% r6 K8 f
  18. *+ v' q( T) Z# O6 W7 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / [( H( R3 t1 z7 Z# _* Y" {
  20. * kind, whether express or implied; without even the implied warranty
    " ~  a0 v$ a# R6 y2 Q( w4 N' X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / o2 m$ W4 z- R/ h4 ~4 R
  22. * GNU General Public License for more details.
    0 p/ F' g& Z5 Y  Y/ r- B
  23. */3 l2 }" e6 @4 j; f! b4 ^; y" R7 E
  24. 1 r) a0 v' `: E, G8 P
  25. #include <linux/module.h>
    ( G* N0 m" ~( r  \+ B
  26. #include <linux/init.h>
    ! t! ^% N( E: C1 t% R1 J
  27. #include <linux/errno.h>+ R# h8 i* W% K) U0 V, i
  28. #include <linux/types.h>
    3 u0 D8 Q0 U) e6 |, Q
  29. #include <linux/interrupt.h>" [' ~7 r" {0 B* n0 M
  30. #include <asm/io.h># y  H  ^% W, ~! I5 Z. E
  31. #include <linux/moduleparam.h>
    6 \8 \8 a( [# k4 J# i
  32. #include <linux/sysctl.h>
    ) h  E/ b5 P5 P- t0 H( H
  33. #include <linux/mm.h>
    7 X# b2 D, F5 t) u6 h2 t, N/ F- D
  34. #include <linux/dma-mapping.h>  h% r9 ]9 S. W
  35. ' K" u' o8 w7 |  m% U% d, Z
  36. #include <mach/memory.h>
    0 N6 ?3 T; m! h" H  e9 e
  37. #include <mach/hardware.h>
      X$ p  G( Q/ C' M$ ?
  38. #include <mach/irqs.h>
    % h6 ~' @( K( P: A+ w
  39. #include <asm/hardware/edma.h>
    5 O5 u! z, K) r" Y  y2 _  a" c. l
  40. : V. ~! k8 a( _; N; t! B$ F2 s' s1 s" c
  41. #undef EDMA3_DEBUG
    4 u+ I2 \) d  D' [/ L1 }
  42. /*#define EDMA3_DEBUG*/' f+ ^$ G) {  L  s
  43. 1 I; K+ c6 B' Y
  44. #ifdef EDMA3_DEBUG3 J; w; D. |5 }5 o# b# c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). P1 m6 [: o' P+ r8 h: m' i$ T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      p: P: R  c( N4 }% g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 j- m  ]+ D9 q9 V( ?  p$ b3 n  i* i- `
  48. #else* j% u# A6 L% n5 o
  49. #define DMA_PRINTK( x... )
    " g9 n3 Q% u# R8 \
  50. #define DMA_FN_IN
    9 m+ [" H! H" W) C5 [
  51. #define DMA_FN_OUT) t5 I# c* ^, T3 ~( e; `
  52. #endif
    & k- O# J9 N  e$ m

  53. & i( T7 g6 F3 b8 T, ]$ R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' e) b' m) V3 f) u
  55. #define STATIC_SHIFT                3
    - s9 r1 Y$ D) G6 X7 p
  56. #define TCINTEN_SHIFT               20
    3 r! z3 f5 }4 k8 `
  57. #define ITCINTEN_SHIFT              21
    / Q' q8 H2 z( {3 N) s0 u7 x) e
  58. #define TCCHEN_SHIFT                228 @) Y9 ]6 {$ a* @
  59. #define ITCCHEN_SHIFT               23
    # Z2 ~9 {5 d# p' b) T$ m3 X2 |

  60. 1 l- Y) K" t. U/ B- @9 z+ A
  61. static volatile int irqraised1 = 0;; n! J9 b. v  c6 m
  62. static volatile int irqraised2 = 0;
    7 G# t# @1 l6 P4 ?0 n' v7 o/ i7 O
  63. - a5 ~$ V' D) u& A5 e# l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 `( T3 w( k' M. [3 q% |& p' g/ u# T$ V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ o4 i1 f/ O" X5 F- s* E; N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, T8 {# E, ?1 L% c

  67. ; o9 r9 S/ G2 Y) G( L3 |
  68. dma_addr_t dmaphyssrc1 = 0;0 r' u: P5 S$ S9 m6 w: y
  69. dma_addr_t dmaphyssrc2 = 0;0 ^& ]* n' A8 [; m' H* K
  70. dma_addr_t dmaphysdest1 = 0;$ E7 p. p3 q9 P% o
  71. dma_addr_t dmaphysdest2 = 0;
    . j+ o& u0 F$ o) t

  72. ' u2 a- b& A7 A$ l/ s' m
  73. char *dmabufsrc1 = NULL;, U$ }, w: j! o0 K8 X5 f# N+ e! m
  74. char *dmabufsrc2 = NULL;
    ( b" H; w! Y# V  U3 Z
  75. char *dmabufdest1 = NULL;9 h! x$ E" m( X( e$ q) S
  76. char *dmabufdest2 = NULL;  Z& ]  z4 q5 |9 X1 ]# \4 l
  77. $ b7 L+ A( ^, G, P8 H0 z1 @* {8 X
  78. static int acnt = 512;
    6 h) F. Q: m, h8 S( I
  79. static int bcnt = 8;" e+ I( `- V& K& Y( o5 {
  80. static int ccnt = 8;
    ; Q7 g% o$ p3 E
  81. 4 x3 I8 x3 h# r! m2 O  r/ s9 }& W# z
  82. module_param(acnt, int, S_IRUGO);3 Q. l( \0 ^: z
  83. module_param(bcnt, int, S_IRUGO);4 ]& D& U4 M$ x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 j6 C2 w8 l- q' V/ [4 I
2 U( F! j! B; _: H  g5 l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; i, o( e" W1 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ }( a: {  U$ e3 A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& a9 e1 a3 \; b

% X6 ?2 i5 o2 j6 [, K% i" b# C4 I& V. j7 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 09:04 , Processed in 0.039644 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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