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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% r/ R# G. i8 x" G* J8 `$ B! k% c# k
  1. [code]EDMA sample test application$ I9 \- V: \/ G. [+ Q! M3 r
  2. /*! B" p+ R& N# j  U# f* p
  3. * edma_test.c
    * n" _+ y) \1 I1 R8 g
  4. *; `5 X- ~: l: ]7 ]; K0 Z3 Z
  5. * brief  EDMA3 Test Application3 }! s- |! j* [% W2 R0 i' I0 F# b
  6. *
    + r: t; W! n' [* S
  7. *   This file contains EDMA3 Test code.9 x! O% i' Q. ^! I) i  t
  8. *0 B4 n6 g" p$ ]' y1 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) s- w" J) \5 e$ G7 l# }8 h) g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. C  ?, y6 s8 S' [. D
  11. *         TO CHANGE.! n% q+ z$ @6 t! q6 u: K( L: o
  12. *3 N1 v( e, N! S1 I' J: C1 b. q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; P- j" V* Y" v2 A
  14. *
    - E9 _7 n  z' a( k
  15. * This program is free software; you can redistribute it and/or
    % X: [7 o4 [5 A: {4 Y
  16. * modify it under the terms of the GNU General Public License as
      Z( f6 t7 E/ Z
  17. * published by the Free Software Foundation version 2.
    # r+ _$ {& t0 \
  18. *  \& L, \6 ?: O$ p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' _# P( o- z; p- h
  20. * kind, whether express or implied; without even the implied warranty
    : T9 |' w: ]# V# I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : Q% `, G  j; A4 b7 T; _5 Z
  22. * GNU General Public License for more details.; H7 W5 ]  l8 _" [9 f
  23. */8 h; t* u: X8 H) v! S( g

  24. - I8 A  T5 v/ e% H
  25. #include <linux/module.h>: s: d2 W" H) T( h
  26. #include <linux/init.h>( x* Y- t+ n2 m/ `- B
  27. #include <linux/errno.h>
    ; V" X" s* V% l! l. R
  28. #include <linux/types.h>
    5 d, W. O: d) Q7 ?4 x
  29. #include <linux/interrupt.h>
    , Q! |; G4 R/ M' Q$ W0 L& f
  30. #include <asm/io.h>
    ( b- O8 V2 c8 {, e: R0 B* A+ W
  31. #include <linux/moduleparam.h>
    9 `: N1 }& n, C
  32. #include <linux/sysctl.h>, X% w1 u# J2 n( Z+ G9 V3 X
  33. #include <linux/mm.h>
    5 X' D/ Q9 W( L; ]3 [2 W$ v& k9 ]
  34. #include <linux/dma-mapping.h>
    ; T! }! b+ J. T/ U, J4 W( N

  35. 8 n- x$ `; e  c; t" O) _/ i
  36. #include <mach/memory.h>
    7 S$ h. i, w9 y$ Y$ p2 f
  37. #include <mach/hardware.h>) ~4 J% a# y- L  C6 y
  38. #include <mach/irqs.h>2 o; s$ o% m* C3 _3 u  s
  39. #include <asm/hardware/edma.h>5 _5 q2 j: `6 Q# I1 a

  40. + @9 y/ L, A1 h+ T4 U3 P
  41. #undef EDMA3_DEBUG
    7 A! K0 u' ~- R' u! `7 x3 A
  42. /*#define EDMA3_DEBUG*/
    & i; V# U3 ~/ u8 i8 S& n
  43. " R, ~0 O/ V8 P% k+ F# x
  44. #ifdef EDMA3_DEBUG  E) O( N" h( B& D2 ^" f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 V' z2 g* l% E  L$ f. h( u  e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 l8 n4 _$ r; U( p$ a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * h7 [4 l0 q# C
  48. #else& R! g7 ]! k" [8 n
  49. #define DMA_PRINTK( x... )
    . B7 @, U) E7 e
  50. #define DMA_FN_IN2 W! }2 @3 z/ Y
  51. #define DMA_FN_OUT1 t9 U* R) b+ A& \
  52. #endif) X+ G; K# r9 e& `1 i9 O. H# x
  53. ! ~( {3 Z% a& a9 X' H, A; ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 N) c) \7 n! R9 j
  55. #define STATIC_SHIFT                3
    * V6 [: L* }% ]. v$ T" B3 W
  56. #define TCINTEN_SHIFT               20
    7 i8 B# v. E# Z1 V4 T9 F; H; `7 J
  57. #define ITCINTEN_SHIFT              21
    3 C; u8 `+ F/ ]0 E( Q2 a
  58. #define TCCHEN_SHIFT                22
    + L- J9 T" t; Z
  59. #define ITCCHEN_SHIFT               23
    # d; N* ~1 ^& V9 ?& m
  60. ' q& P" E- Y5 V& @' Y$ i4 {1 t2 X
  61. static volatile int irqraised1 = 0;# f8 W- r# [/ ], Z
  62. static volatile int irqraised2 = 0;
    2 E5 @  @2 z& v. y9 \+ C. X0 `

  63. - ?. O. @4 O1 N' L/ w3 g" m5 J8 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 i& x  y8 ?% ^/ b  @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 R# j: c( s- {6 T. _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, C+ m* {5 e2 F0 o* H; U/ h
  67. # Y* g/ W4 J7 Q9 P* i) o  F
  68. dma_addr_t dmaphyssrc1 = 0;- N" P5 T% f3 D% h  d
  69. dma_addr_t dmaphyssrc2 = 0;6 E- f5 n) I5 Q3 S& I& p+ d# Z
  70. dma_addr_t dmaphysdest1 = 0;* f. G1 R$ V, n) U6 c; P
  71. dma_addr_t dmaphysdest2 = 0;5 y8 y1 f5 v( Z2 W: B7 O$ W

  72. ' }/ z% y& V7 a5 M) Y& C
  73. char *dmabufsrc1 = NULL;
    2 ]/ E8 _0 j# x
  74. char *dmabufsrc2 = NULL;
    8 u" q1 I% O7 |: @8 s" n1 q) f
  75. char *dmabufdest1 = NULL;
    - Q" Q* d- ]1 f; ?, @0 H( u
  76. char *dmabufdest2 = NULL;
    8 M8 B/ U9 U& Z5 \. L& O, d
  77. ! K8 K" r" e! E7 `" A' s2 ~, q; r4 ^
  78. static int acnt = 512;  n5 v' K, h! U4 y, W7 V
  79. static int bcnt = 8;" E  \5 L0 H4 A3 Y5 L6 K
  80. static int ccnt = 8;
    & {) |' N) j) y  T0 b) `7 }6 j' v

  81. 5 H8 q$ D8 P' I( @+ Y) {, y
  82. module_param(acnt, int, S_IRUGO);/ W0 I1 K% p( s) l0 t/ q
  83. module_param(bcnt, int, S_IRUGO);2 q+ R! Q7 ^) A$ c! O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 q. u' W7 b; g. G
8 H0 c# h: R2 j# G" D( I  }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& T! {5 j: W- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- Y. `, N% G: i, j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 ^  p3 _1 }$ S4 ^2 C- y- C7 A3 X8 \% c0 ~" \; w/ B. t5 G& y

: t- n% p- \" \8 T8 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 17:18 , Processed in 0.041055 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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