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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   U0 T" A/ O) a4 D! K, ?
  1. [code]EDMA sample test application& B9 K% O9 X" i  D+ G% N
  2. /*
    ( u3 B$ T- |0 q& U) Z
  3. * edma_test.c
    ' N1 \/ [0 m/ l0 k+ I
  4. *, u6 K- ~1 h" {0 W
  5. * brief  EDMA3 Test Application
    ) [- [: N, Y# t- d, f
  6. *
    : \+ S) }* Q" b* v6 v7 ]% G
  7. *   This file contains EDMA3 Test code.
    : b+ D, T% }7 b/ T! ~& L
  8. *) B% |! D  B' K# B2 ]8 l( i" E+ Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' P9 _# [) @& {5 Q4 v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" [/ x2 k& B- X" d0 h" k( I
  11. *         TO CHANGE.
    . G9 O5 [6 M) K! ?  v& q, I; S
  12. *9 F/ G$ b3 ^1 Y/ f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 T* A1 c$ Y2 U% z& A
  14. *
    : K9 [% d) `2 U
  15. * This program is free software; you can redistribute it and/or
    8 H' `! f0 k1 b/ e9 [& a
  16. * modify it under the terms of the GNU General Public License as0 l" W1 u4 t5 D7 M# P7 k
  17. * published by the Free Software Foundation version 2.
    6 l/ ^: i& [( V* h3 F# l* ~
  18. *
    ( x* v* U, N. B' \5 ^4 e& P5 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 U( _0 U8 ^- h2 N: z
  20. * kind, whether express or implied; without even the implied warranty  ^) l3 @6 c: P( w% J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; O$ x2 A% _9 ?! o
  22. * GNU General Public License for more details.0 Z! |+ m7 ^2 n; o( r3 g8 d
  23. */4 z5 o$ w3 J% Q5 d) W% b
  24. & M, Q( R4 p* g$ ~( Q
  25. #include <linux/module.h>
    ! g2 v  R7 j2 z% U3 r- L0 {
  26. #include <linux/init.h>5 ]5 ^; x$ h0 \9 x. U$ N& N
  27. #include <linux/errno.h>
    3 N/ l+ k; b* J2 e
  28. #include <linux/types.h>
    - G& y0 }0 @1 B2 s* c/ r  ^# x' ^- V
  29. #include <linux/interrupt.h>
    6 l3 Y" K0 X- b, U
  30. #include <asm/io.h>
    ! n) i  t' W6 _7 D/ X- W# h
  31. #include <linux/moduleparam.h>
    ' s" b% t$ K1 Q* {# u& M8 ?
  32. #include <linux/sysctl.h>
    5 N, J& a9 @6 n' D7 x1 E
  33. #include <linux/mm.h>+ S- t$ y1 H3 q. Y* L
  34. #include <linux/dma-mapping.h>5 ?; g+ w+ }) L& s* }4 w" ?
  35. * L+ W  e3 l0 j; }% p
  36. #include <mach/memory.h>4 A" {; ^  u3 t" q" [+ S+ T! T
  37. #include <mach/hardware.h>
    * d3 j/ |* D. G" {
  38. #include <mach/irqs.h>
    1 D7 x9 z3 g  A
  39. #include <asm/hardware/edma.h>" S$ ]. X# }6 r' [: K0 @
  40. * K" O6 F" u7 K+ n% X
  41. #undef EDMA3_DEBUG
    & i- T- X  y' s  i+ q& p, c
  42. /*#define EDMA3_DEBUG*/: m- T  ?' t! C5 ?

  43. 3 Z# _5 k: N2 S0 }
  44. #ifdef EDMA3_DEBUG
    6 }. X1 E, o2 g; H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ p5 a9 @$ h# t9 C2 X$ o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% n! B9 @) O0 T+ v- \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      u9 c+ {4 T  [/ y- L4 z
  48. #else5 z. n( a; ?" H. f0 `+ o
  49. #define DMA_PRINTK( x... )
    : I/ B. w  ]; v! E0 B+ n" q
  50. #define DMA_FN_IN) m2 X/ i% S- i/ L
  51. #define DMA_FN_OUT9 ?) @* z2 b! f( H0 M3 K" T- P- n& u
  52. #endif
    / Y2 x0 F- X1 G5 Q7 u& b- |
  53. 1 T; D3 b3 C# G) W* l' B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). g3 [6 X3 v1 e7 |4 I* _: ]8 S
  55. #define STATIC_SHIFT                3
    . p0 [9 x) k) E! o6 ~9 m5 @
  56. #define TCINTEN_SHIFT               20
    # X, H0 u5 W: {0 B
  57. #define ITCINTEN_SHIFT              21; |4 x1 M8 N6 n& G
  58. #define TCCHEN_SHIFT                22
    9 d- W2 S+ J1 i4 _2 j
  59. #define ITCCHEN_SHIFT               23& p/ X0 g* G+ L/ d9 R, r, w4 Y

  60. : ]: Z6 @5 g5 K% R- _8 s
  61. static volatile int irqraised1 = 0;
    $ A. H3 b- s0 u  }* q' v, ?* B
  62. static volatile int irqraised2 = 0;5 p9 I- Y3 e2 K( P/ p8 @, }

  63. ! q* X$ M* Z  h; Y7 {3 E8 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 F+ u; _$ I/ Q4 V4 u. G# P7 p$ l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: R' b4 Q5 {; }( L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . N* x/ }& }" \: I8 y
  67. 4 a2 t2 g$ O8 f+ O5 i* l5 Y
  68. dma_addr_t dmaphyssrc1 = 0;
    $ [: X, N+ Q" d( H9 K+ L6 s
  69. dma_addr_t dmaphyssrc2 = 0;" F- u. \6 H1 c& k+ u
  70. dma_addr_t dmaphysdest1 = 0;
    9 R& ]) \* r1 V1 `5 P1 W& @
  71. dma_addr_t dmaphysdest2 = 0;& x) K+ s% `8 {4 c+ Y

  72. ) N6 p/ j' B! E2 T4 X% m
  73. char *dmabufsrc1 = NULL;
    % b/ n2 G9 ?: |/ _" `' u4 A$ H
  74. char *dmabufsrc2 = NULL;4 {+ w# w4 ^' }
  75. char *dmabufdest1 = NULL;
    1 A; t7 s' C: a: v% E
  76. char *dmabufdest2 = NULL;5 Y& Q0 L" c3 p8 k' a& A
  77. - l" e) r' a. P" c+ x- n
  78. static int acnt = 512;- _* _$ N1 |1 E* d( u* w
  79. static int bcnt = 8;
    3 _% S2 Y! {6 b; H+ w* U; H3 ~& h
  80. static int ccnt = 8;
    3 q4 ?  ?; b  K+ y- \$ U

  81. & M1 j  f$ p; t" k- D) V
  82. module_param(acnt, int, S_IRUGO);
    + f2 C/ Q, m/ i, d2 j
  83. module_param(bcnt, int, S_IRUGO);" x" J# n9 e) u! k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  b, w# f7 Y( m! \1 u- L0 v' e$ [+ @1 S* A) M! c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; ], `8 q5 {4 O; P' i% i5 g' E! C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 K0 E+ p2 v& {4 X+ P1 p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 }1 X+ k9 F' r+ L# S: E
. b. o' h1 D2 I# H; p

9 _5 Y2 S# x9 ~5 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-24 04:42 , Processed in 0.037347 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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