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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) j' I- ?# k) Q$ x$ ^
  1. [code]EDMA sample test application
    9 r! n9 {, b& d) a, h
  2. /*7 |# J; D2 a; {0 z; l
  3. * edma_test.c
    & p! C9 @+ Y6 A- ^4 V1 c
  4. *7 D' v; S  Q' u$ W% j: C! J
  5. * brief  EDMA3 Test Application* e! _: I$ a3 J2 H1 d) }7 ]% w
  6. *
    , Z) |+ c" m' R: R# ^* L3 D+ o
  7. *   This file contains EDMA3 Test code.
    7 K" F) {2 f6 P7 E
  8. *
    9 `. g8 l% e0 N2 M$ j" \0 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 R. ?& a/ V5 r5 n' D+ E7 X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 @) r# @1 H- F; T$ Y3 G) _
  11. *         TO CHANGE.
    % ]9 A  D+ }9 @& {
  12. *7 W3 n! h3 r1 X" H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ Z* p* F* y0 m$ t2 @
  14. *- B; t; n3 R8 L# t% ^
  15. * This program is free software; you can redistribute it and/or8 g0 M3 j: O" F4 k: _) [
  16. * modify it under the terms of the GNU General Public License as7 X2 B9 o$ q  c
  17. * published by the Free Software Foundation version 2.
    $ M5 v" n( _' m& G
  18. *
    , ]- x, V; e; e9 R" Z& z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 r2 e  X: E% g9 x9 A+ B  n
  20. * kind, whether express or implied; without even the implied warranty
    2 {' m  |6 [# P' l% `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ y/ c7 `5 r  q$ Z
  22. * GNU General Public License for more details.
      I/ J2 W8 i* p" b: `9 [4 m" x
  23. */7 W& ]" K; V# ^' c

  24. # S# B! e/ k  w1 u
  25. #include <linux/module.h>
    ; _0 q. i' E) ~# I! S2 x: o  [
  26. #include <linux/init.h>
    8 U9 B5 R9 {. g  j" S* a
  27. #include <linux/errno.h>" k8 z* M% [8 B9 u& d/ F
  28. #include <linux/types.h>
    # D, W1 j$ v3 |: `9 Z. C
  29. #include <linux/interrupt.h>6 v4 Q: W& @7 [2 z; N: S
  30. #include <asm/io.h>0 u+ w2 s1 F/ k1 M0 p
  31. #include <linux/moduleparam.h>
    0 [5 s* B0 Q. i) i+ t
  32. #include <linux/sysctl.h>
    * a8 y6 M" ^( _# T" d4 v
  33. #include <linux/mm.h>; m4 u: H. [8 z$ \5 M0 }
  34. #include <linux/dma-mapping.h>
    0 H% j2 Q8 _9 |/ u( q- [

  35. ' s0 ]0 e  G7 |) A8 ?9 Q6 @9 X* ^& }5 P
  36. #include <mach/memory.h>$ D8 ^3 [" i- F; U( \0 l
  37. #include <mach/hardware.h>! A) ], |& S& X6 K# f1 y
  38. #include <mach/irqs.h># I$ C( y7 w5 ]* f. J  d6 o
  39. #include <asm/hardware/edma.h>
    6 H4 J# @5 I. u1 t3 W
  40. + ~+ p  {. P( l( a% b% O% x' t) B) S( L
  41. #undef EDMA3_DEBUG
    & E8 \% X1 u& s$ H1 ^
  42. /*#define EDMA3_DEBUG*/
    1 o7 T' g% H4 c6 V( _& R
  43. + D; d$ \- o& l5 p
  44. #ifdef EDMA3_DEBUG
    9 S0 U% n" [/ A3 B8 g. K# k7 B$ Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 a. w! j6 A+ S' _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# t6 ~- B: n' g1 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 u& `$ [! D0 x/ x& W$ j5 Z8 o
  48. #else8 n6 q; g4 _$ {5 v* h8 C0 l/ Q
  49. #define DMA_PRINTK( x... )
    ) N, Z! Y( D. H$ T  `$ h% b
  50. #define DMA_FN_IN
    $ D" T, b& t3 m  r
  51. #define DMA_FN_OUT
    1 c" N4 f& N+ c
  52. #endif
    . P0 `1 Y$ Q4 x. c7 U
  53.   c+ x+ d1 j6 b7 o( G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 [8 U" w0 c$ ]1 m% B: H5 N
  55. #define STATIC_SHIFT                33 f& s. z9 G, t% r
  56. #define TCINTEN_SHIFT               20
    * a& d. p. U7 H; o4 p  l) I% s7 {
  57. #define ITCINTEN_SHIFT              21! l% O$ _* X& @7 f# q
  58. #define TCCHEN_SHIFT                22
    , c$ f8 v7 M/ d5 N: P
  59. #define ITCCHEN_SHIFT               23* x' i* q% t* k2 K6 r* o! n. ~
  60. 5 V! x0 w( k" f
  61. static volatile int irqraised1 = 0;
    ( r6 w: Q9 k6 b2 L2 ^$ A4 h; j1 ?
  62. static volatile int irqraised2 = 0;
    : i& r9 @0 D8 o, M$ b) F
  63. % ?7 D8 |0 v& l  L4 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: `' ~6 b" ~6 }! A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ p& o4 j2 Z8 y2 J! @# \1 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) c; l8 D  `) u+ H0 {+ R& G, s
  67. " i- \$ m& c+ _. `
  68. dma_addr_t dmaphyssrc1 = 0;
    ) x/ M) x6 X, n
  69. dma_addr_t dmaphyssrc2 = 0;; [! d& o/ t; L( ~" X! r
  70. dma_addr_t dmaphysdest1 = 0;
    5 d3 ]* t+ `. P7 X
  71. dma_addr_t dmaphysdest2 = 0;  p8 Z: X  J  Q9 o$ L( K0 S* I' v

  72. 5 C3 ^4 }( \$ h8 q/ t( r
  73. char *dmabufsrc1 = NULL;
    5 z* g6 [: [3 K! Q% O
  74. char *dmabufsrc2 = NULL;- B) D3 ~0 E/ b6 O' N; ]  f% D
  75. char *dmabufdest1 = NULL;
    # {! z7 }; C* B/ Z) [7 x3 O% u; I
  76. char *dmabufdest2 = NULL;/ t  r! H+ z6 P6 ~

  77. 6 y$ f5 Q) e% v" v; w
  78. static int acnt = 512;
    / T& i( A& x2 J, A4 @2 C: q
  79. static int bcnt = 8;
    ) I" a* g4 ?, P' H/ c$ S
  80. static int ccnt = 8;$ c. a3 H3 h4 g/ q" N4 _

  81. & f+ |. ^- B: J# T2 Q
  82. module_param(acnt, int, S_IRUGO);- L5 X) |/ G, w6 G- s
  83. module_param(bcnt, int, S_IRUGO);" _0 u- j! T" o/ O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 m1 Z2 \$ v. @/ Q  ~. m( l& o
1 }1 ], Y  T2 N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& [' l7 |9 V; M2 i+ ~. P( Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: U- {5 M# Q/ X; c, Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 R" p! v3 V2 c! `7 k* K

/ ]  x$ }0 {7 O6 t0 F" O2 h: a. A& L& I4 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 19:29 , Processed in 0.036997 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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