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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / a, |$ L/ G$ p4 o5 Z
  1. [code]EDMA sample test application
    9 k* ]. C) D* |( m2 E. h4 j
  2. /*+ L5 \# y" z$ T3 M
  3. * edma_test.c
    + ~4 K& ?, Z+ C( C
  4. *) P; H. Y- M$ t$ q" p
  5. * brief  EDMA3 Test Application6 U' U$ Q- ?2 m. \  Q
  6. *
    : j4 f0 H) D; N+ C9 g
  7. *   This file contains EDMA3 Test code.1 J3 u9 M. Y$ g5 ?" {% [! D
  8. *
    + N1 j& `- ]9 e7 M/ Z$ F0 g; {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 P% K! B9 K. h5 |- y9 m( u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! V0 r( s9 M; d
  11. *         TO CHANGE.6 V( r  N5 g; |1 J* n5 e( s
  12. *" ]3 j8 H* J0 C6 J) ~5 n" |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 k, v; y  y! q5 F/ m
  14. *- S8 e. O) P) ^- A# p8 S
  15. * This program is free software; you can redistribute it and/or( k6 C8 x3 P1 l, W0 ~& K
  16. * modify it under the terms of the GNU General Public License as7 l, h4 U4 G6 T5 z7 ^" n' D  i
  17. * published by the Free Software Foundation version 2.% ^% g4 C" r) X9 ?  L' t/ W
  18. *$ ~% U8 r+ F! C, D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 E) p5 F, f8 _9 ^" w  ]
  20. * kind, whether express or implied; without even the implied warranty
    ; v0 c$ |) h" g' r! d/ @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & l4 q: A/ W6 K
  22. * GNU General Public License for more details.. F! y; k4 I5 P8 f7 _6 g9 f
  23. */
    & h7 ^: d( B7 w5 \5 ~! N( u
  24. . @# h& l. ~/ A5 p& O; ?
  25. #include <linux/module.h>
    0 e( f( x' J- \; u6 S
  26. #include <linux/init.h>2 j, ]* F; [) L# S
  27. #include <linux/errno.h>8 R" Z: _8 P! Y4 E3 s; F
  28. #include <linux/types.h>& ]+ B3 V7 q( b, R. A' {, r
  29. #include <linux/interrupt.h>! R6 D4 y3 Y% O; S
  30. #include <asm/io.h>
    $ \( |' h$ x" K  W5 d" Z3 s& `
  31. #include <linux/moduleparam.h>
    + W( o1 f4 ]. o$ R
  32. #include <linux/sysctl.h>2 o5 K3 a) B% ~
  33. #include <linux/mm.h>! ~! y+ {& G  _2 a5 [# D  E' r
  34. #include <linux/dma-mapping.h>
    * a5 ]' J& R% @: c) Y

  35. % j* x3 m( o. V% B
  36. #include <mach/memory.h>
    7 y* A" R5 S; [( [
  37. #include <mach/hardware.h>* b0 {% L% w7 a0 v# J, N2 F5 z; ]* w% ?
  38. #include <mach/irqs.h>* |0 v* f, S8 F9 m0 t
  39. #include <asm/hardware/edma.h>
    8 @' \1 g3 y7 F; t2 z
  40. 5 O3 T; E9 h% Z) n% v
  41. #undef EDMA3_DEBUG) N1 g8 ]4 j$ m, I
  42. /*#define EDMA3_DEBUG*/" q+ L3 c( M2 P4 t+ J9 q. e& C

  43. 9 _" a, Q7 U" [. j
  44. #ifdef EDMA3_DEBUG
    5 s( Q5 f, L- [8 O5 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- t- D9 M. F+ E. M% ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 U; [/ l2 W) b2 G% G/ l) V: l0 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / W" P, x* C0 x# y& v+ w
  48. #else+ t& u" M5 A. l- E: B/ E' K+ J9 f- Q
  49. #define DMA_PRINTK( x... )
    5 R" i  q2 H8 j& J# C6 ]
  50. #define DMA_FN_IN6 h3 j4 }! p; Q  _/ c  J$ @" C
  51. #define DMA_FN_OUT
    ' f1 L7 y4 I6 W9 f
  52. #endif
    9 `% a- Q- L4 h
  53. 2 q" K4 h. d8 M2 Y3 L$ x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : F+ i/ C5 Z; p# \
  55. #define STATIC_SHIFT                3+ W& c! f; J% S/ m
  56. #define TCINTEN_SHIFT               20
    $ ^5 {# s: P+ k9 C. T9 l: C
  57. #define ITCINTEN_SHIFT              21
    4 O1 J7 @2 y% |; C* Q( u: V
  58. #define TCCHEN_SHIFT                225 Z' A# H$ L" ?6 `; \' H* Y
  59. #define ITCCHEN_SHIFT               23# f, r9 r- i" Y; i- m. M$ S4 i
  60. * O$ r( ~/ G- {6 x% ^
  61. static volatile int irqraised1 = 0;  A7 M: M* U3 C( D4 H
  62. static volatile int irqraised2 = 0;" M0 ~% l- l6 e) V
  63. 6 Y( V  v( Q4 }, ], P3 T: ~+ ~" Q, N8 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! T4 D6 X& r+ ?7 T0 x$ u5 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" t/ [, w4 Z! P- P2 Q2 I6 W) Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 e5 i' y0 t6 y6 m6 l4 p* a( f
  67. - d6 h5 t9 u8 f
  68. dma_addr_t dmaphyssrc1 = 0;
    % ^4 C! D7 }3 M
  69. dma_addr_t dmaphyssrc2 = 0;, O7 X+ v2 b9 z; _: Q, Y# P
  70. dma_addr_t dmaphysdest1 = 0;
    : j& R) |9 z# H- h# q, C
  71. dma_addr_t dmaphysdest2 = 0;
    2 B+ b2 g- e2 R; Z" S" e

  72. 6 V; }0 n' N% c3 o, V
  73. char *dmabufsrc1 = NULL;9 m( k4 h1 ]( s' @7 _1 @; ^
  74. char *dmabufsrc2 = NULL;
    2 l2 i2 |$ T$ |9 v
  75. char *dmabufdest1 = NULL;
    * \/ e& ?" I6 W3 X
  76. char *dmabufdest2 = NULL;
    ; t2 n4 t& P& U+ }

  77. 1 T6 I0 @2 j8 E" X- y. ?1 y
  78. static int acnt = 512;4 X6 ]0 O( c3 q* E- @6 J
  79. static int bcnt = 8;
    7 }1 H1 p/ o* C* R3 d, S
  80. static int ccnt = 8;) o5 h4 y+ w6 ]; k4 r) r

  81. . l" s3 G+ q5 g5 J. [& @
  82. module_param(acnt, int, S_IRUGO);
    : U- z! N$ E) w
  83. module_param(bcnt, int, S_IRUGO);( z4 G% z7 \- T  _4 ^, g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" H0 Q; r9 @# K

* `% \9 o  q3 ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! P2 a6 i! V: F2 O! G" b$ W- ~; |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 N7 y& b0 i) Q# c! ?) m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 |2 H, B1 e. G( s
/ U) q) P+ K1 x! r9 S, W

7 I" x0 a& F- E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 09:58 , Processed in 0.059287 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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