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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 |) W7 I1 _6 K; P3 v, t* R
  1. [code]EDMA sample test application# Z$ O/ u2 W9 |, Z. P+ R
  2. /*
    0 G4 ~2 G% p" z9 G8 o! \% n5 Q
  3. * edma_test.c
    * u9 p. W3 Y% d( g
  4. ** l1 \+ Z6 k2 p3 K. {) Z
  5. * brief  EDMA3 Test Application
    : l; |  R/ W+ U: S8 Q8 b1 t
  6. *, Z" g; m3 D9 r+ g+ R8 H( j
  7. *   This file contains EDMA3 Test code.- X" U8 B# A3 Z, O: W
  8. *
    2 q) m) [* M2 y  S& o7 J) R4 K+ {( A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ^" C* S; Q; V) [, w) C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- f3 @( S, P  |3 Z9 t* x
  11. *         TO CHANGE.
    - Y& s8 }5 o; S7 C
  12. *$ t  }+ u9 Q" u. R; i* G# p7 D3 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " t2 a  `3 @- g& l9 ~/ T% O6 A
  14. *! F4 d6 n8 B( y' I5 {( y4 X% Z, f1 S0 y& e
  15. * This program is free software; you can redistribute it and/or
    2 n; U/ J8 Y  e
  16. * modify it under the terms of the GNU General Public License as3 G; [1 G' f1 J8 K
  17. * published by the Free Software Foundation version 2.
    " w- a/ a: r$ S4 l/ w8 [
  18. *2 D$ B; P& u, F1 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * V9 A4 x: l  j0 D/ v
  20. * kind, whether express or implied; without even the implied warranty4 u4 V! I6 c' a; b2 d. c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! J$ j8 d2 _$ T. y% y) C1 [
  22. * GNU General Public License for more details.
    7 a5 j# w7 O  j3 R$ f
  23. */
    ! V3 [- F+ D' C% g
  24. 9 }' A$ [; u" f" w4 d# S
  25. #include <linux/module.h>' P& V0 ^  J) @* H
  26. #include <linux/init.h>7 `1 |/ A% p+ X% c, l7 r
  27. #include <linux/errno.h>
    / u  P9 R8 l) \9 e" v) n7 U1 v: a. a
  28. #include <linux/types.h>- e- i! X& t8 `( H0 x
  29. #include <linux/interrupt.h>+ j  y' c! E: U! o$ d/ n
  30. #include <asm/io.h>
    3 A7 w6 _8 Q( u. d3 j
  31. #include <linux/moduleparam.h>
    ( V, {7 Q1 X  C2 @
  32. #include <linux/sysctl.h>8 N: Q! C3 ~# D
  33. #include <linux/mm.h>
    ) P; T; U& p# b8 q/ H
  34. #include <linux/dma-mapping.h>2 M& g- C" E+ Y/ `4 C
  35. 0 v8 d( h" }3 Z
  36. #include <mach/memory.h>3 z4 J0 C# S+ u: }$ O
  37. #include <mach/hardware.h>
    + H' j- o5 \# m- k
  38. #include <mach/irqs.h>
    4 R( f+ g+ l8 S* O
  39. #include <asm/hardware/edma.h>
    9 F9 G6 I" O) F' K0 ?

  40. # h: T8 I- y* r7 @
  41. #undef EDMA3_DEBUG
    ) N2 E1 X+ M8 U4 w( m# }6 S9 ~
  42. /*#define EDMA3_DEBUG*/
    5 [3 g% J' g& a% J1 `/ b' x

  43. * K- a, {/ n* F( V* d: u6 w* U! o; X
  44. #ifdef EDMA3_DEBUG9 m# ~7 C. H- B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , g- {$ c0 G4 r4 y9 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / Y8 h. X7 Q0 |% Z7 v2 q- B7 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& F( H1 t6 Y1 u- U! p. d4 J& m9 \
  48. #else" W7 G& z, J8 j8 l5 F, i  q
  49. #define DMA_PRINTK( x... )
    1 o# n! H. j3 R  r
  50. #define DMA_FN_IN
    5 m1 [& M/ [% V- X3 V9 R
  51. #define DMA_FN_OUT
      M- A1 O) C& ]2 B# V6 A
  52. #endif
    ; u' y* ?7 I6 O3 R! }# e4 d
  53. " J* d6 i+ a/ k. j. J7 a4 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# c$ y- a3 p4 a
  55. #define STATIC_SHIFT                3
    * R8 I# I% \0 J/ m
  56. #define TCINTEN_SHIFT               20* d! N6 V' \% z5 @: {! ?
  57. #define ITCINTEN_SHIFT              21- q3 q/ ~% h1 |+ Q6 P! j
  58. #define TCCHEN_SHIFT                22
      v! _# {# m. Z
  59. #define ITCCHEN_SHIFT               23
    % C5 \  k$ t: n! d* O( }
  60. : R9 c& q7 G+ ]. F' t( G' o
  61. static volatile int irqraised1 = 0;0 e; i, }% m+ G, A7 x
  62. static volatile int irqraised2 = 0;/ ~6 ?3 \* F8 I' X( `# N
  63. 8 i' T: n  ~6 ~# x' g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; o0 V; ?8 r, U& E- _* u' u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 [9 P$ [- B' i- c4 ^' O* ^. N1 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ {3 e$ ~3 n& r, T8 g! s
  67. & q: q" c4 ]% t8 [, [9 ~% B
  68. dma_addr_t dmaphyssrc1 = 0;
    / T5 d9 o2 k' D. O7 [, `/ n1 y
  69. dma_addr_t dmaphyssrc2 = 0;
    " ?1 T  Y4 z7 C" m# H$ S- V
  70. dma_addr_t dmaphysdest1 = 0;  C- J# W; l" ~7 S+ ~% d
  71. dma_addr_t dmaphysdest2 = 0;6 T% m6 r0 B$ x3 K+ j& Z
  72. 6 ?9 `' n7 _5 n, f1 _; f9 j
  73. char *dmabufsrc1 = NULL;
    " m/ t, g4 N' h" t+ g( M
  74. char *dmabufsrc2 = NULL;
    % C* _4 t1 L9 e3 S7 e
  75. char *dmabufdest1 = NULL;, p, m8 Z- I) X3 u# U3 M
  76. char *dmabufdest2 = NULL;
    1 L+ I& \7 B1 }- J$ s) V
  77. 3 b/ i& L8 k  t- P# I. L
  78. static int acnt = 512;/ h- t. d8 T( p
  79. static int bcnt = 8;
    1 a) H+ G/ c$ j4 P
  80. static int ccnt = 8;
    3 I* g3 X& r) P( Y- u

  81. 3 ~: E% R! l2 [" \! C
  82. module_param(acnt, int, S_IRUGO);! U( l% c! Q. P1 `2 q: r" @
  83. module_param(bcnt, int, S_IRUGO);
    6 \% L0 B4 B; n, `7 J7 E% A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& D7 f% `  B4 T( \( }

9 i( u9 S1 H4 V. k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 _8 R8 x& i- H! [1 e- q5 e1 `7 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ r" D: _7 k. ]9 c. U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 M( ^1 F# Q# m  T3 L, h
: O, n& t- ~0 g6 F  Z' I* c; C

1 n9 Q+ K; j! J" h" p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-24 16:52 , Processed in 0.038992 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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