OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " m8 H: }; ?; l0 A# B. P
  1. [code]EDMA sample test application0 W, Z" {/ b- c3 D
  2. /*
    & ~- U# P" v( _0 {& y# [
  3. * edma_test.c2 X+ k1 e' A% S
  4. *
    5 b" K# z4 @; v
  5. * brief  EDMA3 Test Application4 q7 m# P" g1 Q. ^7 y5 h
  6. *
    , ]  z. C* _8 W1 U+ c& d! F; I8 B
  7. *   This file contains EDMA3 Test code.0 |8 Z: o, A1 v
  8. *
    1 I. @. d( s$ \% w5 ?+ g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 z% d( |$ Z& p5 a/ n1 e& w) c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( d& ?) C1 y& j" p$ _6 `1 J& z! j
  11. *         TO CHANGE.  }. k9 v7 a. Z5 X, J4 n
  12. *
    0 v, m7 S; C7 ~! ?+ g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 S2 f9 y) s3 A6 @( G# I. K
  14. *& y- ]3 i/ u/ m. Z3 ]4 h  r6 W9 A
  15. * This program is free software; you can redistribute it and/or
    % Q% u2 [- k" N& |  p9 ~
  16. * modify it under the terms of the GNU General Public License as
    % B0 g0 l- l, q8 Z
  17. * published by the Free Software Foundation version 2.
    1 `5 w) ^+ k( i# t
  18. ** g; k5 V9 f  u! g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 t8 t$ A3 b8 j1 v6 s, H, [
  20. * kind, whether express or implied; without even the implied warranty
    . ?' t# H; i$ N& [+ H: S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* l; s; `; d. A# o# {
  22. * GNU General Public License for more details., i8 \+ q2 f% H; w- y( q& w
  23. */
    6 u; B& i6 u/ R5 f& z; ^+ t2 J

  24. : p6 m# w. v9 J; p# f& p4 E
  25. #include <linux/module.h>
    . j6 |5 q) J! I9 Q1 x9 j
  26. #include <linux/init.h>
    $ X2 k5 G: M% O% ]
  27. #include <linux/errno.h>  v; j. l) q+ @$ e% K
  28. #include <linux/types.h>
      I9 b5 o4 G. L, i+ T1 D7 v  m, [
  29. #include <linux/interrupt.h>
    & o: A  ~* v& F* M6 v% t
  30. #include <asm/io.h>5 M4 ^: T+ K' w1 O
  31. #include <linux/moduleparam.h># H# l$ A+ N$ t$ o* M+ b
  32. #include <linux/sysctl.h>0 F, ^( t! P! D, k
  33. #include <linux/mm.h>
    + m6 q1 U* w7 o1 b" `, t
  34. #include <linux/dma-mapping.h>
    3 C# I* @- g% _/ v3 U% ]
  35. ; G4 u2 T- f7 M4 M7 e' K
  36. #include <mach/memory.h>
    , Y. h. d4 d& Y: Z
  37. #include <mach/hardware.h>
      E, J5 X; p; Y" k& D
  38. #include <mach/irqs.h>
    7 _0 I2 V# o% N2 o* u
  39. #include <asm/hardware/edma.h>/ D5 e: o$ D/ _' Y2 i! L  t

  40. ( j( F1 r: `9 l) I
  41. #undef EDMA3_DEBUG& }$ h6 q, G. I: ^+ t
  42. /*#define EDMA3_DEBUG*/
    + N2 C7 \( e; N8 a2 h0 w5 }
  43. 1 r/ h- \) I6 m- D; {
  44. #ifdef EDMA3_DEBUG
    9 u' T1 A+ K0 I0 A( H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ q* C) X3 T; e; w4 i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # `( J' Y& h0 \2 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 M; B2 Y0 g2 h% j
  48. #else0 S6 \' E9 m. v# Q1 M7 J4 B/ D7 t
  49. #define DMA_PRINTK( x... )9 c+ ~( I& ?5 c6 n
  50. #define DMA_FN_IN* D9 ]+ F6 }, O8 l
  51. #define DMA_FN_OUT) N7 b  y$ C! \  j1 \$ p7 r
  52. #endif
    . y' z0 t# G; r4 |  V; ~" n
  53. $ X0 d/ F4 q. Y) a* H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); c8 S1 ]4 T1 l$ _3 A. d
  55. #define STATIC_SHIFT                3
    ! g: \8 l! h5 f* N3 h
  56. #define TCINTEN_SHIFT               208 H) K% v" I# y
  57. #define ITCINTEN_SHIFT              212 a; R2 ~+ H+ X3 o( [6 o
  58. #define TCCHEN_SHIFT                22
    6 X* A* Y7 n1 R/ b! p' Y  y
  59. #define ITCCHEN_SHIFT               23- h9 d* S" {" K6 e/ ^

  60. ) A* l9 t. b3 @3 k. p3 ?. r3 Z
  61. static volatile int irqraised1 = 0;& M7 V( @6 \3 t9 C
  62. static volatile int irqraised2 = 0;! t- O6 N( c4 z. r

  63. 6 Q# d% P. r$ T$ n+ h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . }+ V: S' R& L3 v# |( b, b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 r  h2 v; z" i4 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# l& e  v  B# T3 C
  67. 8 X* a& M) J4 C5 G2 N
  68. dma_addr_t dmaphyssrc1 = 0;
    3 ]& p8 x/ F8 S" y
  69. dma_addr_t dmaphyssrc2 = 0;
    5 D2 q+ y6 Y5 K
  70. dma_addr_t dmaphysdest1 = 0;
    " f$ d  o' r. o4 u
  71. dma_addr_t dmaphysdest2 = 0;, I& F) p+ u1 J* m" Z" {
  72. 2 ^3 l" A/ U6 R2 Z& W) r
  73. char *dmabufsrc1 = NULL;
    # y4 P8 H, x7 c# O: l; F, y3 K
  74. char *dmabufsrc2 = NULL;
    5 w: g* ?( _0 J- K# `. N' u5 i# \  f
  75. char *dmabufdest1 = NULL;' g/ A. k+ k, A( i7 T  T3 q, n+ _
  76. char *dmabufdest2 = NULL;
    2 x! B5 V) N1 ~" L6 M* K+ ?$ E+ V) n

  77. ' r( `. e% a$ r
  78. static int acnt = 512;
    , C% F+ z- N) I" Y) {: I3 Q2 [
  79. static int bcnt = 8;
    , E9 [  b1 u% d% v& ~
  80. static int ccnt = 8;0 d9 W  \6 |' D2 R4 w+ D: @
  81. 3 R  j0 O/ o2 {. t
  82. module_param(acnt, int, S_IRUGO);
    , G# S/ Z- Q& m  T+ L
  83. module_param(bcnt, int, S_IRUGO);
    + K% B9 l. O1 U) s) M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ B% D+ S2 q6 A: {

4 q/ Q$ O' O. j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ^  u: ?+ i+ v" S+ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' J! U% b1 ^: q' u2 l4 T% B" D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. p/ e* B  R7 N/ h6 l3 Q
0 Y0 F1 Q, p. o: t3 v& v3 G5 {5 r# {# _( W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-3-9 21:46 , Processed in 0.041694 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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