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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & ?+ _5 A6 }/ ^5 ]& ~; e
  1. [code]EDMA sample test application
    # }1 d) j0 J- q* O$ v
  2. /*
    $ Y6 e% q% K1 Z; V
  3. * edma_test.c
    % p+ {, U1 O; y( E
  4. *
    5 J. [7 Q" W' y1 ~* v& F+ V
  5. * brief  EDMA3 Test Application' l% T" \7 T7 D- J6 A, e
  6. *2 m% g! h- u" j5 D" b' _9 W9 z
  7. *   This file contains EDMA3 Test code.
    " \. G4 z; d$ k( u* R( J
  8. *
    / Q+ L4 y  v- y/ N9 D+ u$ @! R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  g3 l' o3 B( r' u4 v" I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 ~  j" f& w# j( ]4 m
  11. *         TO CHANGE.6 w$ T1 M& r$ ^5 a
  12. *! R% S& F3 ?, U1 J" G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; Z$ ^2 c' }! m6 b' T
  14. *" [+ ?. z/ u& l. ?( W! r( t
  15. * This program is free software; you can redistribute it and/or
    * j% V5 x  `3 t5 M* N3 u
  16. * modify it under the terms of the GNU General Public License as- G7 I- R- ~4 l8 G8 J' I
  17. * published by the Free Software Foundation version 2.
    ! w' \& X  [% w. g
  18. *
    9 N0 J1 u4 G7 T, T- [) R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- l* t. x. \* O" \6 y# e6 ~+ ?) m
  20. * kind, whether express or implied; without even the implied warranty
    $ j, ?4 W; f+ }9 m  v' i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, V) S7 B% ?5 G
  22. * GNU General Public License for more details.1 x" v- E* A8 f5 x2 U; L
  23. */
    + z: C! x% p5 _5 t+ l

  24.   }8 X* S& Q  V1 C/ C; S7 X* B9 x
  25. #include <linux/module.h>
    6 V. s; ^! Y. i2 d& q2 w) g
  26. #include <linux/init.h>
    ) p" ?- l6 ]; |1 n3 B5 K
  27. #include <linux/errno.h>
    ' s( w) m- Y9 T, o
  28. #include <linux/types.h>/ B3 s- O1 f( O7 G
  29. #include <linux/interrupt.h>
    8 F  i2 ^$ ^$ R8 }/ R
  30. #include <asm/io.h>2 W8 M# c' [: w' U
  31. #include <linux/moduleparam.h>6 w& H* f4 ~' A% |* B! e
  32. #include <linux/sysctl.h>
    3 `7 i+ y: i6 c! w& A5 ]/ p; A
  33. #include <linux/mm.h>/ N, r4 M) l3 `- Q4 B, R! |' ~
  34. #include <linux/dma-mapping.h>
    4 Y, n% A6 [! X* P- h$ ^9 T
  35. 0 `$ {+ _7 w6 `0 |" a
  36. #include <mach/memory.h>
    % U% f& I! i. G# T
  37. #include <mach/hardware.h>0 X5 R- W; w1 Z
  38. #include <mach/irqs.h>9 D" N+ _( _$ J$ v5 V* e& b. y- W
  39. #include <asm/hardware/edma.h>  V4 X: [* f0 E8 D. t: s2 z
  40. / Y1 F, {4 E8 z
  41. #undef EDMA3_DEBUG
    + f2 o, B& K! r! v3 i
  42. /*#define EDMA3_DEBUG*/; s4 F/ r4 z1 J3 s

  43. # U8 P9 ?: L: f8 Y% O7 o4 w
  44. #ifdef EDMA3_DEBUG/ N2 S" r/ C' j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 I9 h/ S" o$ C( L1 S1 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 H! f' A2 C6 z+ r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ]6 q; j6 I# a% N
  48. #else$ L' C1 T& W- h) o5 A7 `
  49. #define DMA_PRINTK( x... )) z9 @7 u7 _( y3 F
  50. #define DMA_FN_IN" e: M8 \8 j. E
  51. #define DMA_FN_OUT% T8 R* h. V" ?& |- j+ {& b$ S* N
  52. #endif% e1 ]# ?* b: [0 T: V- r5 k
  53. 7 ~0 k, ~$ @+ e8 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 x5 N2 Y0 c- b- s6 s/ H
  55. #define STATIC_SHIFT                3
    , F' D0 l! ]' f# a# X! r
  56. #define TCINTEN_SHIFT               20
    ; D5 i) {( I9 b. c5 q
  57. #define ITCINTEN_SHIFT              21
    % R$ m1 d0 f4 @& t7 Q: p
  58. #define TCCHEN_SHIFT                224 Q+ K# `$ F5 w' [
  59. #define ITCCHEN_SHIFT               23% n- H% b1 b- l: q) H# U; \" I
  60. ! u+ x' y8 Q5 x/ R4 C0 J4 ?
  61. static volatile int irqraised1 = 0;
    9 S5 O5 q  ^, d8 X
  62. static volatile int irqraised2 = 0;- `4 r/ k5 e3 h- U4 k
  63. , v6 I) R9 R' Z$ `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 p, m% c: j6 l2 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; u' Y9 r7 y; O; ~, c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* G6 M" ]4 ]7 x( I
  67. # }% Q  D7 j. R7 z
  68. dma_addr_t dmaphyssrc1 = 0;
    0 T  G" R9 Y- S1 L' O
  69. dma_addr_t dmaphyssrc2 = 0;
    % ^0 y1 [( V  |& K
  70. dma_addr_t dmaphysdest1 = 0;
    ' q+ g8 x$ E) _' n+ U
  71. dma_addr_t dmaphysdest2 = 0;
    * W4 D% x5 }6 Q5 r
  72. . ?- v; }* t: \/ G, P
  73. char *dmabufsrc1 = NULL;
    + H% Q: C' @4 S  m" ?0 Q3 |
  74. char *dmabufsrc2 = NULL;: L# @/ h( x5 G( ?
  75. char *dmabufdest1 = NULL;4 ~+ E5 n% O8 T% E; F  P1 w
  76. char *dmabufdest2 = NULL;
    2 R- b: C1 O+ u2 i

  77. 0 m6 H1 [1 w$ Y4 C5 z! Y: K/ l
  78. static int acnt = 512;
    / k+ R* @/ i9 k, w
  79. static int bcnt = 8;( w+ ~% J0 S3 B( G$ H. b
  80. static int ccnt = 8;
    ) P% Y+ p7 a' R: B

  81. , b7 b' R+ f. P2 L) v1 U
  82. module_param(acnt, int, S_IRUGO);7 K4 Y; z; t( Y: x
  83. module_param(bcnt, int, S_IRUGO);' u" }3 J0 X9 ]3 P- \  s% w% F% C- ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 e! p+ r. k0 u6 J7 y, I9 P) a& ]) b" a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ B8 E/ g- t5 L4 d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" {+ I9 w! t8 k, Q2 J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" `" N1 W( G$ w( d4 O# t- p! ~, T0 H- h2 |

, F( a' U) E) p+ K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 02:20 , Processed in 0.038588 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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