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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ w/ Z7 I2 S. J, f
  1. [code]EDMA sample test application1 ^% u5 u' u2 m1 t
  2. /*
    : l/ a, d( V/ R2 T% A2 i( z( t
  3. * edma_test.c7 r# U! S# |. o# q5 W- W! ~  J
  4. *
    ) m/ l( v  o: J, {
  5. * brief  EDMA3 Test Application  W* r. |7 ~3 D. e) N
  6. *; V! ^9 A4 _0 x1 z7 k" l9 p7 P- u# S
  7. *   This file contains EDMA3 Test code.
    : g; T' u6 s1 `& f
  8. *4 x" E, ^& X2 t' o! {" l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  d9 L( i, Q* g* q* n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " _# r; r- U. r
  11. *         TO CHANGE.
    / P8 u' n* D2 S' w3 \8 E
  12. *
    + n$ K7 S  P5 Q" f& J& ~* l7 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : A- j3 N! o' i5 O
  14. *
    6 l6 M: U- _& _# t* {# Q# V
  15. * This program is free software; you can redistribute it and/or2 K3 p, \6 W$ G! f
  16. * modify it under the terms of the GNU General Public License as  q/ B" u5 o  d
  17. * published by the Free Software Foundation version 2.
    8 R- D7 I4 q$ z2 j8 f. W
  18. *
    4 Z3 k; j4 W# R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 q& w. M$ e; E9 Y' ~" Z1 t5 i5 B
  20. * kind, whether express or implied; without even the implied warranty' J6 B' _9 n8 P" t4 `& Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* }+ W) m$ L/ U( Y8 ?1 W
  22. * GNU General Public License for more details.1 J! e* w' y% Y  e4 y) {( `+ ]
  23. */
    % ^8 y! v* U& V! v. p
  24. " \9 c5 p0 n7 X) s' h, s( M0 g) L0 a
  25. #include <linux/module.h>
    " }6 D; F9 A% `6 k! S2 J
  26. #include <linux/init.h>
    ' d4 R# T9 X3 e. V/ |4 N. ?
  27. #include <linux/errno.h>
    % L, B  E% w+ b$ t, V1 t- z6 H2 i
  28. #include <linux/types.h>
    % l1 D- U) U  \  m) g3 s8 P1 o. T+ O9 }
  29. #include <linux/interrupt.h>
    + x+ x3 K2 C# u) b- K
  30. #include <asm/io.h>
    ' y9 `6 S$ h1 H1 _
  31. #include <linux/moduleparam.h>
    9 |4 k+ S' K% Y" q/ F
  32. #include <linux/sysctl.h>
    4 Y" ?4 S+ A4 R6 Q2 C9 s1 ?% M: B
  33. #include <linux/mm.h>
    $ ^/ t& I5 s+ g  b
  34. #include <linux/dma-mapping.h>
    $ L( N* p- q" J9 j/ o5 p

  35. ! p( C+ c$ e7 A8 y; R; n# F
  36. #include <mach/memory.h>
    4 ?/ a6 O$ Q& {& A1 p
  37. #include <mach/hardware.h>
    0 W2 V5 p' p8 S+ b6 k: I, {
  38. #include <mach/irqs.h>
    $ C0 ^) O0 ~& s* e3 b
  39. #include <asm/hardware/edma.h>  B% {' K: w, C
  40. % l% O3 N' E; |6 Z; s
  41. #undef EDMA3_DEBUG
    ! P) G9 X0 K5 `( S0 X9 {
  42. /*#define EDMA3_DEBUG*/. j( |1 d, U% N: Y
  43. % {: |' V0 i' u4 f3 I0 ~5 @
  44. #ifdef EDMA3_DEBUG
    9 x3 e, h+ Q3 j+ p% E& n; o0 m* l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 F  Z) }6 }: l# v! U& q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " F! \8 F; ]/ Q) C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # B9 A5 W' m) H' Z  t9 ?7 D1 H" b
  48. #else* ?6 u" d! N3 K1 f
  49. #define DMA_PRINTK( x... )6 k/ _1 n. K' K$ K/ }
  50. #define DMA_FN_IN$ {! K" E+ F1 I! X
  51. #define DMA_FN_OUT
    5 p# I) ]8 e4 D5 K# X
  52. #endif
    ) i& M# E5 h  w

  53. ; V; v* Z2 _; Z+ Z8 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 E& k$ ?8 A2 x* y% R% i
  55. #define STATIC_SHIFT                3* A/ P4 l7 @, h  \+ J# S; C
  56. #define TCINTEN_SHIFT               205 C# w& p( s) o- C* l2 W$ M9 {3 E7 X. O% w
  57. #define ITCINTEN_SHIFT              21" a" C. c3 b. ]
  58. #define TCCHEN_SHIFT                22
    0 H7 ~' ~2 A" E4 R
  59. #define ITCCHEN_SHIFT               23
    : m5 h- |% U! A9 s1 c
  60. ) [; H3 ~* q% z" X9 [5 {0 C6 T+ M1 y0 H
  61. static volatile int irqraised1 = 0;8 G, E) B- _! B& z3 g6 b  C- [
  62. static volatile int irqraised2 = 0;) ~3 j7 F2 G# Y* q7 r; L

  63. $ ]8 P" F/ l- Y  A- H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . o* z6 x9 }2 I8 H. P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( C9 V6 U4 z; ?4 k' M. i# w, C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ~! g3 l1 _% j% O! \6 d& x& U" E9 z
  67. 2 Y/ O- O  }. z+ m0 {* W
  68. dma_addr_t dmaphyssrc1 = 0;$ o/ d4 S- L/ i2 @/ e+ ~
  69. dma_addr_t dmaphyssrc2 = 0;
    $ B* x1 B' Y2 X4 a/ p+ b
  70. dma_addr_t dmaphysdest1 = 0;( T4 Y" G* ?& `' S
  71. dma_addr_t dmaphysdest2 = 0;
    # e( b$ c9 V$ m& V7 _

  72. 7 b8 W# m! Q) o8 ~+ }( `
  73. char *dmabufsrc1 = NULL;! R# d1 e- E* _" K! O
  74. char *dmabufsrc2 = NULL;
    $ X+ H0 L1 F- ^6 y& L: {
  75. char *dmabufdest1 = NULL;2 P* X! m" A, ^+ v2 |) P
  76. char *dmabufdest2 = NULL;
    7 s$ u: E0 Z* P+ G1 C
  77. 1 k! e0 D. }5 y7 j2 b) Z
  78. static int acnt = 512;
    4 I! I' G0 ~2 v( X
  79. static int bcnt = 8;" S/ i- ]2 b: {2 D; }# p
  80. static int ccnt = 8;
    4 o: Y8 H3 h6 g2 k  i% O/ k* l

  81. & `0 d/ V7 v8 v
  82. module_param(acnt, int, S_IRUGO);
    " M  r- `1 g9 `" {
  83. module_param(bcnt, int, S_IRUGO);
    " y4 ?: p- P# [+ N/ @% p3 b! D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) ?5 v' G! v; t( c2 s- _2 K- @
& O3 `+ w- u$ j: o- R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 a5 ?" ]+ h0 `& x4 i1 V2 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ G, ^  X: r: [5 S: n$ C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- Z3 ]6 ?( E4 L& s$ q" d
. c* m" |1 {; z* V9 u& R  r( [  _
1 g# v5 A  W7 \; g# \7 `( o1 G$ h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 14:18 , Processed in 0.040143 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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