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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % F$ V8 H9 ^  w3 ~
  1. [code]EDMA sample test application
    % V: ^6 u; O- x# ~9 f  F2 s
  2. /*
    0 Z  T# j  z$ J, c* J& m9 K2 J
  3. * edma_test.c0 Q; z( t' K1 I7 s# n* s% r
  4. *8 A; j* e2 F; o) O& C
  5. * brief  EDMA3 Test Application
    2 @6 _4 ?# r) l- t/ S9 F; z) @. E1 h6 H
  6. *2 Y/ k2 S& }0 t& C8 ^5 j3 W  Q8 a  D
  7. *   This file contains EDMA3 Test code.
    1 n( {, C: Y2 u$ |- d) T1 r3 Z% e
  8. *  J  P5 J3 y& Z& G' `# t5 C2 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ ]* G; Z. B: o! Z8 }  E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( D1 ~+ N5 B9 q2 `! C( a
  11. *         TO CHANGE.5 C: \; E- q* e( F  E( l
  12. *5 w' t9 k! A5 `6 N; G$ A6 }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* q9 ^$ Q1 c. p  G3 ]. w! x
  14. *, r( r7 Z" Q5 S: \
  15. * This program is free software; you can redistribute it and/or
    % u( Y2 K7 P( Q( }* X6 T$ Q
  16. * modify it under the terms of the GNU General Public License as' [1 L: x( {9 ]& X6 V6 X
  17. * published by the Free Software Foundation version 2.
    0 M3 V3 T; t# F. L- C2 _$ Y& G
  18. *1 e: r; ~" z: w  v. ]9 I, s& R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) N/ O) y, o# k' y3 {% L8 H* y
  20. * kind, whether express or implied; without even the implied warranty
    , |2 A( y! l! y; M2 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- `; T$ |6 R. e
  22. * GNU General Public License for more details.
      |/ F. w( M& C7 ~! f4 Z: ?
  23. */
    / a9 ~2 C8 `! n1 }( I+ Z+ ^

  24. 7 `. Q4 b7 J, P# J7 a4 q1 l
  25. #include <linux/module.h>
    7 B6 d. t3 L7 v( M. @
  26. #include <linux/init.h>5 ~2 s/ C# {" b/ p
  27. #include <linux/errno.h>
      z8 r2 n$ }1 l3 G; J
  28. #include <linux/types.h>  [  a+ O9 Q7 @2 {7 ~- B6 r
  29. #include <linux/interrupt.h>7 f9 }% G: ~5 r3 S' J
  30. #include <asm/io.h>" }0 D% P  \: c% j4 C% t) o. o
  31. #include <linux/moduleparam.h>5 h' |( T- l6 [- l
  32. #include <linux/sysctl.h>
    ' b. o( d8 ?5 }' N, h9 u
  33. #include <linux/mm.h>
    # v0 U# ^6 `6 M( z1 r0 `# E+ Q- E
  34. #include <linux/dma-mapping.h>% {# E* s1 b' R) D* m+ i/ a$ G/ \
  35. 7 X& g$ k. n7 W0 Z4 n7 l2 h9 q
  36. #include <mach/memory.h>) s1 m; b' G- T
  37. #include <mach/hardware.h>5 k6 H6 q$ G: B9 V5 ~
  38. #include <mach/irqs.h>
    ) Z5 e0 v% F2 M
  39. #include <asm/hardware/edma.h>) T$ k  E3 A$ x% j
  40. 0 }2 z( Z; u; y3 Q
  41. #undef EDMA3_DEBUG
    ; s1 G6 p3 j* c, b0 h
  42. /*#define EDMA3_DEBUG*/
    ; b) `, p! o" j! T+ S  _
  43. ( r1 L6 ~  [# n( m8 t
  44. #ifdef EDMA3_DEBUG. P( m" C9 y" T: e# w2 a0 g( s1 t' p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 A3 u# g0 h+ ]% M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 }+ ]4 W2 s% m: A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# K6 Y% p& S' S; [* x
  48. #else8 A9 V6 ?$ N* y0 N9 M
  49. #define DMA_PRINTK( x... )
    & g: _: U" _: Q* f* x$ z
  50. #define DMA_FN_IN: B+ d' u2 K5 k5 l2 V) m$ @) A
  51. #define DMA_FN_OUT
    : [7 x5 u1 I( s& p) b
  52. #endif4 c+ k' S: w7 k* f& g9 a
  53. ! E7 K9 |0 k; D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), X3 v; s: V& p, p( f, g
  55. #define STATIC_SHIFT                3
    7 s* l2 ?) M# v8 j& K, p0 l3 J
  56. #define TCINTEN_SHIFT               20
    7 d4 ]* ~% ^' |% u
  57. #define ITCINTEN_SHIFT              21
    2 ~5 ~" a( l! C- }( s: E* p
  58. #define TCCHEN_SHIFT                229 J  l+ J$ K+ w9 E8 H4 [+ ^+ `3 g- E
  59. #define ITCCHEN_SHIFT               231 t3 H+ k! d& c# E
  60. " |" S; m& j/ \3 C# ^" C9 L
  61. static volatile int irqraised1 = 0;! S& K/ y7 Q- v  i
  62. static volatile int irqraised2 = 0;
    & D$ P" j, q  e. M7 t+ t3 F

  63. 2 o7 T( [% y6 i6 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      x* s' U" ~* C7 D! `& ^6 \" V7 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 b1 c! i$ R/ _, l; L  w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 S; I1 q( c+ m7 M$ c

  67. ( {; v6 P. J/ Z
  68. dma_addr_t dmaphyssrc1 = 0;
    ) H, f" [; T# c! \; r7 c. j
  69. dma_addr_t dmaphyssrc2 = 0;% Y  q3 R. c3 B* x
  70. dma_addr_t dmaphysdest1 = 0;
      J/ W; G6 f% u; U# B1 [) Q$ E
  71. dma_addr_t dmaphysdest2 = 0;
    + Z/ r3 B1 T7 }' {

  72.   Q6 _, @+ U) G, [- J
  73. char *dmabufsrc1 = NULL;
    % y3 u3 B' B1 y. F
  74. char *dmabufsrc2 = NULL;* X$ N1 ?9 M( N9 ?
  75. char *dmabufdest1 = NULL;) p7 l# z. e. N) n2 C3 E
  76. char *dmabufdest2 = NULL;
    1 Q3 L, ^4 @' }& k7 s" u
  77. ( T& Y6 q3 @" O$ _- H' e, t( M
  78. static int acnt = 512;& N8 g, D1 D/ t  e. F9 Q8 c
  79. static int bcnt = 8;! o6 o& m. W2 M+ x
  80. static int ccnt = 8;
    ' a9 c( D8 x1 W1 L: S. B& e! \  k

  81. 4 M5 B3 Z  k, w/ I* K
  82. module_param(acnt, int, S_IRUGO);
    6 X& Y. W  ]+ e0 F  U) ~* c
  83. module_param(bcnt, int, S_IRUGO);
    ) H2 `% S7 c% c. P1 W& a; t  `, v6 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 C" v; g  J$ O6 Q, w9 D
1 n; b9 N: p4 q! B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ j) A6 ~( J: c9 n0 \# L( Y$ `; Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 f. [  W, G, Q: m6 d; S& i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 q6 U, D. T6 g' d% t
  x% b  |7 B) @

/ R' ]* C) {( {2 O6 b0 {6 a9 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-4-30 05:02 , Processed in 0.036812 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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