OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- L1 C7 c! I, {8 z3 L$ @' j
  1. [code]EDMA sample test application
    , t# L; N2 i; n3 H% ^( S
  2. /*" `% D! f5 x# {7 j4 Z4 R# ]. g: q
  3. * edma_test.c- M' U- b) C! R- L$ c5 t: G1 G
  4. *
    3 G& n. W2 E- p
  5. * brief  EDMA3 Test Application
    5 @5 G" i; X. h" q9 _
  6. *: [% r! u+ D4 i2 Q  q
  7. *   This file contains EDMA3 Test code.
    6 a- {/ ~9 d5 U, M& C# H
  8. *) ]2 [- O2 M( q# s1 M; T1 A& ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( e6 S* N; D1 o5 d& @: r3 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 c. h2 O- e# m) {# e
  11. *         TO CHANGE." ~" ^. U. z; I" A0 i  J
  12. *
    . |. O4 r: H- ~9 r" Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// P: U' H' F2 s' _( l( \% \
  14. *, k+ f, s: }) f5 n3 O" w0 ^
  15. * This program is free software; you can redistribute it and/or
      C0 K, b- Z& K
  16. * modify it under the terms of the GNU General Public License as& c3 h. c6 D  h2 j. u
  17. * published by the Free Software Foundation version 2.
    5 j9 T9 n  X' S0 f
  18. *3 p) F. Z# x6 ?) Q) G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ U5 B( @; I" ]  {
  20. * kind, whether express or implied; without even the implied warranty+ g7 Q% V8 H/ l9 h/ g2 s+ T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & ?3 |; g; N6 r% s, |
  22. * GNU General Public License for more details.; o4 |1 a/ a0 c* I0 e  |$ |
  23. */$ K9 \; d+ s5 s$ ?7 i( v3 d& c

  24. 3 J8 a; I6 r& m& \* m$ D
  25. #include <linux/module.h>( w. }9 I* b( g: Q! E
  26. #include <linux/init.h>
    # K* f2 ~0 S- C! O! z+ z5 C
  27. #include <linux/errno.h>: L; C; P* U* k- [" M
  28. #include <linux/types.h>
    # C. L- K5 `, w0 h# z
  29. #include <linux/interrupt.h>
    ( |: r8 r! `! o8 @
  30. #include <asm/io.h>
    + R: Z! L5 V* f, J( u; O+ j. B
  31. #include <linux/moduleparam.h>
    % a+ I, ~9 h4 g. m
  32. #include <linux/sysctl.h>
    7 V: N; Z2 O, F- V' F) m1 X
  33. #include <linux/mm.h>9 j; t1 n- ?  z
  34. #include <linux/dma-mapping.h>" n3 H' r5 F& d! X  R

  35. 7 |$ Y: b6 E+ M) `
  36. #include <mach/memory.h>
    8 P: {: h! ~% w% P
  37. #include <mach/hardware.h>
    1 \3 p* |9 o; I& I4 B% h6 `
  38. #include <mach/irqs.h>
      l+ b, I' K/ K* G  v% n* i
  39. #include <asm/hardware/edma.h>( p3 C# C+ X9 }3 [7 q3 d! e
  40. * Q* V0 F" U. o0 g9 E6 o# A5 d* Y
  41. #undef EDMA3_DEBUG$ I  A. o$ d; B$ v% U: l9 L
  42. /*#define EDMA3_DEBUG*/6 P( Z7 z! p0 H4 t; m/ [/ j
  43. % y. y4 M; Q+ o$ J3 C2 c4 H
  44. #ifdef EDMA3_DEBUG4 b$ `: u0 r/ ^' S- q% p) Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 Z1 t4 L4 }6 _. M: G% ]1 v1 {) X& k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : I; j) S6 H  M, O+ F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! Z! i1 `% T  C$ P. ~6 C4 s4 w
  48. #else
    2 c+ Z9 T; F* W) N! p
  49. #define DMA_PRINTK( x... )
    ) ~( a. U( Y/ R$ G  v) z
  50. #define DMA_FN_IN
    : U5 ~- K& S) q  u' ]. R; \) U
  51. #define DMA_FN_OUT
    % S4 b$ b0 k# \! }! Z2 [; k3 }" F
  52. #endif
    ; o# p9 w* ~$ Z: {

  53. / J% f8 R2 t& T1 }2 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / M4 y  k2 O& j# v, v
  55. #define STATIC_SHIFT                3( L1 O: P6 q; d+ G- o% |! K) j
  56. #define TCINTEN_SHIFT               20: u: T# u$ t' Z# ]+ M9 o6 N
  57. #define ITCINTEN_SHIFT              21
    % `( ?3 I" k+ n* V2 u4 v
  58. #define TCCHEN_SHIFT                22
      ~  p2 V. o. `; {4 f- h! \
  59. #define ITCCHEN_SHIFT               235 t2 f* P9 M! a8 J3 p, X( s

  60. * m$ f( Y2 x! G9 D7 x$ x
  61. static volatile int irqraised1 = 0;
    # f8 J( R$ z* W# ~
  62. static volatile int irqraised2 = 0;
    6 A: _) E  Q0 W( G. h
  63. 5 c" X/ T* M3 F8 J" A: f0 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 t) J" F8 h6 W) P3 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 J% d# L; a& x$ X2 F/ X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 P* s: ?# \" X% P
  67. * R' F: ]0 Q; U
  68. dma_addr_t dmaphyssrc1 = 0;" [$ y" v! H) T- K. ~. c4 m
  69. dma_addr_t dmaphyssrc2 = 0;
    . P1 A  N3 ]% F( u; U
  70. dma_addr_t dmaphysdest1 = 0;
    ; z* M! ]# |; H. I7 D
  71. dma_addr_t dmaphysdest2 = 0;+ m3 n! U& z2 s+ d. c
  72. 3 M% w6 Y& A# W9 A' S- v4 ]# w
  73. char *dmabufsrc1 = NULL;
    4 i+ o7 r3 T; `: P
  74. char *dmabufsrc2 = NULL;9 J8 s0 r3 |1 X! Q
  75. char *dmabufdest1 = NULL;8 h2 c* j% d7 D( r  C
  76. char *dmabufdest2 = NULL;& v) @+ c" A) S6 l

  77. # ]& Y1 f) Y) p# o- t
  78. static int acnt = 512;+ e# U; Y* H) p# {
  79. static int bcnt = 8;
    / X2 i3 v. i, |- X9 A7 X% H
  80. static int ccnt = 8;- a& e" H1 T6 d; O% M( [
  81. / f! r$ R: f* F( L3 f6 F  d
  82. module_param(acnt, int, S_IRUGO);
    ( Y7 q7 i1 [6 d1 n+ p& a8 j
  83. module_param(bcnt, int, S_IRUGO);/ H5 c; H6 b% `. `. r* Y- D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* ~+ {/ v$ v5 y8 d4 G: a, K
0 n' v! P7 J/ H7 x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 \; z( A+ u. i1 r( s/ P+ f/ harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# p3 u0 e/ |$ G8 U- D1 L, ~2 j  j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 z" M% }3 Z5 N2 j0 M6 ]6 m$ b. H5 n: m( W. E; {2 h
1 _4 i$ x: Y/ c* x: a1 A1 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-13 06:15 , Processed in 0.037528 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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