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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& Z2 u+ v5 s% ?$ [; _( E/ @& V
  1. [code]EDMA sample test application* H6 ~0 _* Z2 b2 z1 g, q4 n  N
  2. /*
    0 j* r2 G2 @4 [$ z3 j
  3. * edma_test.c
    $ T& [6 ~5 e. h9 T3 Y, V
  4. *0 K: n5 y/ F% r6 y1 H5 l& k
  5. * brief  EDMA3 Test Application
    % x  r$ p2 a6 D. l- y# Z5 z
  6. *
    , ~3 u1 Z" h; U5 K1 T& ~
  7. *   This file contains EDMA3 Test code.' t# \0 i6 I  J  m# a+ a" f
  8. *
    7 m( C5 g2 B) r9 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # Z% M% @; H' E5 e5 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # P" O9 g0 j$ \* b1 Z2 q2 Q1 {& m
  11. *         TO CHANGE.7 I2 Y( B0 G& t" Z7 I
  12. *! B, x4 J% @& Q2 f& D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      V" t8 l) Y3 E7 P- k. c
  14. *
    , |. r+ f2 [( x6 T  f  J$ ?
  15. * This program is free software; you can redistribute it and/or& `6 W8 C% Q+ J
  16. * modify it under the terms of the GNU General Public License as+ f7 x" O3 E+ [! X. W0 J; z
  17. * published by the Free Software Foundation version 2.
    # l! u! p3 Q; n2 [  k2 C
  18. *
    ( `' r/ B1 e1 p4 v. _& [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! w8 Q: J1 x0 ^8 a4 C
  20. * kind, whether express or implied; without even the implied warranty
    5 H# m' @; r' l/ @' }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* h- L1 S' `. E; i. M: V
  22. * GNU General Public License for more details.9 F$ O6 g, w' X( H8 c  c& O
  23. */6 {; S1 t  g4 @4 J
  24. " s" Y& C- b+ N
  25. #include <linux/module.h>7 J+ z$ O9 T1 _8 |
  26. #include <linux/init.h>1 O9 v3 f! A# \2 z' g# N
  27. #include <linux/errno.h>! \9 H8 g3 @: S* M: m
  28. #include <linux/types.h>
    1 [9 [% T$ Z6 n) b
  29. #include <linux/interrupt.h>. x' C5 l- m1 _. g: H' n
  30. #include <asm/io.h>
    + t+ l4 ^( l. U9 P" D  G- E' k
  31. #include <linux/moduleparam.h>7 {) k: l( C* T4 n) t0 n
  32. #include <linux/sysctl.h>' o/ |% W3 H7 B4 y7 h
  33. #include <linux/mm.h>' b8 b) \2 w9 A. R
  34. #include <linux/dma-mapping.h>
    + N$ f5 F8 |# E

  35. 5 `, Y% V% f" c( h
  36. #include <mach/memory.h>5 o8 m. M4 B' v& _- u3 |6 ^
  37. #include <mach/hardware.h>, n' M* p, a7 k+ H
  38. #include <mach/irqs.h>
    : a2 b6 c! s4 Z
  39. #include <asm/hardware/edma.h>2 R. i# _: K5 Y% p( n
  40. ; Z$ ]" I7 Z; Q2 j/ h- [
  41. #undef EDMA3_DEBUG" w3 X. p) d4 Z6 Q  A3 b$ I/ D
  42. /*#define EDMA3_DEBUG*/
    & ~0 r: ]$ j, _+ |4 L+ E% ]

  43.   C) I9 n' c. Y4 J$ H
  44. #ifdef EDMA3_DEBUG
    9 w$ O0 r( K3 l* l/ {% v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / p) X8 T6 W' ~$ v5 C6 K) G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 h/ `7 P: o: ]2 `3 u& a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # e; T3 U# `8 z! ]; l
  48. #else3 I0 _  B  ?5 P1 S0 R
  49. #define DMA_PRINTK( x... )
    " I/ D" p$ L1 x
  50. #define DMA_FN_IN7 ]" O) V8 j! l0 I' t9 _
  51. #define DMA_FN_OUT8 ~& H5 c! o3 e: b8 c% M6 I
  52. #endif
    # V* I8 V/ L/ I1 p! {' P. k$ @

  53. " Y8 K* x% y9 I( O6 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 V" g4 H. u9 b8 ^; P
  55. #define STATIC_SHIFT                3
    ' b  K2 t7 C$ b' p
  56. #define TCINTEN_SHIFT               20. ?* A1 o* P/ ~- f$ X: d8 b4 h( E$ x
  57. #define ITCINTEN_SHIFT              211 k: I) c# [* @) J0 C
  58. #define TCCHEN_SHIFT                224 a  {( E  o6 ^7 e7 g
  59. #define ITCCHEN_SHIFT               23
    : ?; i& _8 W$ G. c# _

  60. # b% S6 w; W: J
  61. static volatile int irqraised1 = 0;
    8 W5 k' T% Q1 X- H- ]0 e
  62. static volatile int irqraised2 = 0;7 H5 [' \# g) [& e/ @# y

  63. , `! Z; g/ ?* b5 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- S4 W7 h& d) {" {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( T% z5 Z0 i. m' U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; C3 i) q+ {3 q# V8 w6 c

  67.   C0 A3 A# \, A' I& o* a+ B% K
  68. dma_addr_t dmaphyssrc1 = 0;! Z* L- g% J% B" [) R9 I) F; ]% Z
  69. dma_addr_t dmaphyssrc2 = 0;
    $ ~+ k# E* k0 t. b2 d
  70. dma_addr_t dmaphysdest1 = 0;
      ]' e8 ]5 l, i- R3 f
  71. dma_addr_t dmaphysdest2 = 0;
    8 A" M0 n) ~7 L% k" I2 E* o' D

  72. 8 h+ a* M. ~7 ^0 ?
  73. char *dmabufsrc1 = NULL;
    . f4 ~2 y) ?: L
  74. char *dmabufsrc2 = NULL;0 t% h$ m" C. `9 y4 U; d( E0 e
  75. char *dmabufdest1 = NULL;
    " _9 D& B1 N; B0 v5 X+ m
  76. char *dmabufdest2 = NULL;
    - R$ S) ~# s4 F7 G
  77. , S$ c: T4 q' \4 M, L# R
  78. static int acnt = 512;
    ) Z$ F6 j- @) \5 A$ d; R5 j; i
  79. static int bcnt = 8;
    + s( B4 `; E' {( y) f+ f& j
  80. static int ccnt = 8;/ ~5 e) s: X$ m7 u$ f# |

  81. % x  X( q# s" b! F+ x. j2 d( J
  82. module_param(acnt, int, S_IRUGO);7 a! c9 s% O" L8 F
  83. module_param(bcnt, int, S_IRUGO);
    0 F+ D! y* S/ B+ H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# G1 b: j$ m" Z- ~1 l
4 q$ B9 s* n: {' l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( u5 o2 s/ {5 t9 b: _6 ^: n# R" ^0 @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" t+ Q: y+ q9 F* L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: W: z* l6 I' \) J0 q: c
- N* k# x! O) @% R
9 b. g. g# y0 Y6 o+ i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-11 00:01 , Processed in 0.041998 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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