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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. N2 z" h* Q0 u) w- @$ U
  1. [code]EDMA sample test application
    ! n  b1 C) l9 X
  2. /*
    * \4 d5 _2 b+ ], f7 J
  3. * edma_test.c
    0 r$ X/ w, o5 h  [2 `5 o
  4. *6 _- }/ L$ X: }2 J5 H4 ~; N9 J
  5. * brief  EDMA3 Test Application
    3 n3 x0 U" f1 ?5 S
  6. *5 E  [2 P2 X9 n% ~3 I; V
  7. *   This file contains EDMA3 Test code.
    3 }9 @' G# o5 Q5 E2 b
  8. *
    5 X2 o: n- q  C) L# J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( I8 o* _; h7 ~$ y; n) j4 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% j0 j% r, \( d# H; V9 C' M2 P
  11. *         TO CHANGE.
    6 _) v- q% Z$ ?+ \6 H$ \) q
  12. *! m2 n. E2 C& [1 n. H$ b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % R; T8 [3 G+ ~% b: u
  14. *$ o& e7 H" q# M; j  ~/ x' G5 \
  15. * This program is free software; you can redistribute it and/or
    ' w, ^' `- U: l# |$ w$ k
  16. * modify it under the terms of the GNU General Public License as, {% R1 I+ G' @' Z1 p
  17. * published by the Free Software Foundation version 2.
    0 c4 A7 o" _; ^+ @# p8 q& r
  18. *7 F: ]! N2 S. S* f( ?( ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! s1 T7 [" _0 f0 N
  20. * kind, whether express or implied; without even the implied warranty
    6 A5 d4 F! y2 Z' Y6 G* n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( H5 [0 J* g2 f) z# T7 T
  22. * GNU General Public License for more details.. S" g/ m; g; I* h0 J
  23. */
    ) T* Y) A3 Q" O2 h! M

  24. ) V% e, {  B. v4 R# c* @7 S
  25. #include <linux/module.h>: R0 t: h1 \2 c; f
  26. #include <linux/init.h>' G# h* ~9 K; K$ y* Q" k: |8 M
  27. #include <linux/errno.h># Y, T4 _: P! R0 D8 j
  28. #include <linux/types.h>1 ]' J2 j+ H; X% c
  29. #include <linux/interrupt.h>
    % c# j7 J. \% ^
  30. #include <asm/io.h>
    7 b3 }( J+ I4 F2 H: e$ S0 P: F
  31. #include <linux/moduleparam.h>' K1 m6 H/ Q* V2 A6 ?5 G! S- }
  32. #include <linux/sysctl.h># r. t0 V1 H- K0 e5 }% H
  33. #include <linux/mm.h>! u( q5 _2 p: Q$ ?
  34. #include <linux/dma-mapping.h>* B" ?" ?9 D3 |9 Z

  35. 7 s8 B4 k' Q9 Q( }, [* w# Q/ k% ?
  36. #include <mach/memory.h>
    . U2 M4 V6 a3 B- b9 g
  37. #include <mach/hardware.h>
      X: Y4 r& l! L
  38. #include <mach/irqs.h>
    7 q" j& H7 L- j0 ]6 W5 b, j
  39. #include <asm/hardware/edma.h>
      r% \: \/ a6 L7 l  G

  40. ; q* ~# `% K5 x# T9 e7 |) k# R! l$ q
  41. #undef EDMA3_DEBUG/ K' c. u# x1 T) q: O
  42. /*#define EDMA3_DEBUG*/0 o; |% {0 N! S0 ]5 ~, m: z
  43. 1 v* K# l2 n* D5 K
  44. #ifdef EDMA3_DEBUG; _; E6 O! F4 l# ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- V; F+ M, H7 S# @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). i; f+ k0 b( m. c9 F9 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & k- ?  X5 i& V7 s5 P3 Q5 ^
  48. #else
    $ A! Q" s" Y0 ^0 F
  49. #define DMA_PRINTK( x... ): z1 A$ i2 c! D
  50. #define DMA_FN_IN0 F( X7 I5 |5 o: N2 n% j
  51. #define DMA_FN_OUT
      p; R2 y6 q8 k: b) p, h  m$ I
  52. #endif" Q; j/ X" O+ L8 X5 o; ?9 j+ C: y) b

  53. * L' I- B$ V& n% R8 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . p, ^6 V% M/ E! n
  55. #define STATIC_SHIFT                3
    ( w- X# z: F, B0 l
  56. #define TCINTEN_SHIFT               20
    # f) I" E) M" Z+ R* Z
  57. #define ITCINTEN_SHIFT              21" p1 e& K2 u7 _
  58. #define TCCHEN_SHIFT                222 i. m7 {4 m" t; d" ]& x
  59. #define ITCCHEN_SHIFT               23( W/ ?0 u3 X" ~; J6 l3 J0 y$ X, [" L
  60. 3 H# Y: Y, V* T) h) C  w
  61. static volatile int irqraised1 = 0;
    3 [. a" U9 O, w: P
  62. static volatile int irqraised2 = 0;
    5 y6 c# w. E) o8 n7 R% _7 c, y' |
  63. % ~2 L0 E, u$ o% |2 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 h( N6 [( z' x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 B8 O! s1 T6 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 b( Z; j7 `3 s: K( V' b

  67. 6 E7 z8 l0 `7 l2 W
  68. dma_addr_t dmaphyssrc1 = 0;: [" `' d- T/ _, y
  69. dma_addr_t dmaphyssrc2 = 0;, t' x& ]* V& j
  70. dma_addr_t dmaphysdest1 = 0;& y- V6 s! X  G7 b  U
  71. dma_addr_t dmaphysdest2 = 0;; a! `) y4 P, k  V5 S( h! e' d* n  D
  72. ) M3 w+ G' R7 w& Q- C( x
  73. char *dmabufsrc1 = NULL;' P" u9 M4 N- @+ C- t5 K
  74. char *dmabufsrc2 = NULL;
    5 d8 M2 N; D, Y- R
  75. char *dmabufdest1 = NULL;
    ) h9 k. G9 x- P3 e. Y0 l
  76. char *dmabufdest2 = NULL;2 A9 p5 B) D" W7 [
  77. + |% P/ D/ L& Q: o3 V+ ^
  78. static int acnt = 512;" A# S. u5 d% ]8 v; N
  79. static int bcnt = 8;
    % Y4 ~6 ]% x6 `8 [( S$ Z
  80. static int ccnt = 8;  }' P6 T0 }: M' ~2 w& G# U; ~

  81. 6 j( ?; S# z" k2 B" {4 [% r; d
  82. module_param(acnt, int, S_IRUGO);
    . H+ K& O$ m6 t7 I6 l3 e' C
  83. module_param(bcnt, int, S_IRUGO);) }0 K" V6 s5 y1 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 B8 o$ R0 `$ e3 b2 i$ k3 Z' P
$ u2 I$ f* x7 T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* ^: W& ~# }$ r9 I+ e7 S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. W: }5 N# ^, k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 R" A# t$ P! p
0 G; S& ?+ K1 h& i3 G, g' }9 Q
3 W! ]- F- U  P! y0 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 22:19 , Processed in 0.039951 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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