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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% m1 b* N' F' k" Y- x
  1. [code]EDMA sample test application
    1 v6 J: }0 k% k
  2. /*7 P+ M/ J0 e) @8 y) A. x
  3. * edma_test.c& H5 M, K$ S9 X  O8 `5 q4 s
  4. *
    4 m2 @7 o1 Y3 W
  5. * brief  EDMA3 Test Application
    . o/ \' j2 x9 c' h; p! F+ e
  6. *
      a$ A' T4 Z7 l/ A+ ~+ g
  7. *   This file contains EDMA3 Test code.
    5 y+ E9 b1 C! h4 d
  8. *0 j9 W5 V5 G* P2 P4 M% Q2 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# U1 K: a& V& Y, _! U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + X0 _4 F# p$ y
  11. *         TO CHANGE.) {& c3 Z2 S$ J( D6 `
  12. *7 i+ B, J# O( L- c& H% f4 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 m: n& u6 p# _* z/ ~0 U
  14. *5 K  q4 M  m4 p% x
  15. * This program is free software; you can redistribute it and/or
    $ l* O0 Q% W' s
  16. * modify it under the terms of the GNU General Public License as" C2 a% W5 W1 M' B5 Q
  17. * published by the Free Software Foundation version 2.
    : `/ S* ]! g$ A3 {8 \
  18. *
    - A6 d! ~# \3 ]. }' z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' D2 n2 x! R% V: T. {+ O0 h6 h* K4 P
  20. * kind, whether express or implied; without even the implied warranty
    ) i' H8 O: T8 H( v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; }: d* S7 X! c4 ^; }: A6 c( d
  22. * GNU General Public License for more details.
    : }- j6 g% \! ]# W& R$ Y7 O) A0 \
  23. */; ^( I5 P. \/ s7 l, O

  24. 0 b* A- n) p9 `3 n$ {' K5 M' U$ }
  25. #include <linux/module.h>$ U( z! y3 f2 D
  26. #include <linux/init.h>
    3 r# R. E$ w" |5 h' ^* p6 c
  27. #include <linux/errno.h>& s6 l. Y& N* e% j. N+ d- |
  28. #include <linux/types.h>
    ' c1 c, a& i. h& n" ~+ i6 @
  29. #include <linux/interrupt.h>  c6 |: w4 L7 x/ i. Z
  30. #include <asm/io.h>4 x* I3 B. n) ]3 [! ~- s& [
  31. #include <linux/moduleparam.h>
    * }) f6 w, m/ R" m3 t/ h
  32. #include <linux/sysctl.h>9 r* h! D% d. m* w
  33. #include <linux/mm.h>
    0 q) \  b9 x! D: M" f* e
  34. #include <linux/dma-mapping.h>% A; V' [. G+ p6 R7 c0 g3 `8 |
  35. ! m1 b( R. O% ?% H9 B: h9 R
  36. #include <mach/memory.h>: J% v1 H" S5 M; E2 D$ D6 E. ?
  37. #include <mach/hardware.h>
    2 |# H# U4 j1 M" P* [  I, M1 g
  38. #include <mach/irqs.h>
    6 j; y$ Z8 l: @. t' b% I& \" E' w, T
  39. #include <asm/hardware/edma.h>8 r* G. Z- l# ~$ c& L7 w
  40. % P$ m" Z" r% q7 B1 F
  41. #undef EDMA3_DEBUG
    ( P% ?! z( x  ~# I3 R2 G2 }* \8 T
  42. /*#define EDMA3_DEBUG*/# |9 h! p1 J; K, w  ~  R
  43. / X# E9 g5 g+ T3 H7 a
  44. #ifdef EDMA3_DEBUG
    ) q1 A6 O4 W4 s$ z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), S9 i* W2 J7 h7 z2 S! p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% q8 W! ^' B3 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" p& n* d; K6 _. A! ~" ]
  48. #else
      x+ ?) p6 E1 E6 I3 {+ o
  49. #define DMA_PRINTK( x... )
    1 N1 D! o6 k0 U/ A" C% n
  50. #define DMA_FN_IN
    ' u" F  h) q" Z7 ]4 g1 q/ V
  51. #define DMA_FN_OUT
    6 m' ~; n6 j$ ]
  52. #endif
    , }* g1 e" K0 U3 v  U. a

  53. 2 a& R4 ~3 ]$ L# X8 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 Z, D7 m; V$ ]3 E
  55. #define STATIC_SHIFT                3* U4 l" B. I9 ~8 \# d
  56. #define TCINTEN_SHIFT               20: [1 [. G, C" f; U$ F4 Q
  57. #define ITCINTEN_SHIFT              21
    " N4 o/ I" r$ {( I
  58. #define TCCHEN_SHIFT                22: j6 {4 `3 d8 ~7 Y7 M& d
  59. #define ITCCHEN_SHIFT               23
    . d4 U6 |8 ]) A
  60. 2 I2 Y: {- r) y  c' u9 \4 |
  61. static volatile int irqraised1 = 0;
    . @' A( M8 @4 T6 @. g
  62. static volatile int irqraised2 = 0;2 Q4 H7 A  @+ w5 R  p% T+ |- K5 @/ l

  63. : I! a* |# M0 d* g* y, p, P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ G5 D, c8 h9 z& W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # ~# ]* n. ~. _+ p& ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! E0 y/ @2 I  ]; }. W
  67. 6 {8 D' z7 Z; c# L- G0 R
  68. dma_addr_t dmaphyssrc1 = 0;
    " i9 Y2 J1 [$ X$ Q* z
  69. dma_addr_t dmaphyssrc2 = 0;- S/ N: l, }: v* f" Z
  70. dma_addr_t dmaphysdest1 = 0;
    ; G1 R: v# u" z! C3 ~2 U
  71. dma_addr_t dmaphysdest2 = 0;1 \2 T  b) S9 r- p2 l
  72. 3 m5 g4 |; t+ l0 ]. Z
  73. char *dmabufsrc1 = NULL;7 \: A" i1 F: d. Z
  74. char *dmabufsrc2 = NULL;
    * P! N' P  M! ~) c% e( L: T9 x
  75. char *dmabufdest1 = NULL;
    : B. q- ]) {" |6 f- r$ w
  76. char *dmabufdest2 = NULL;% h1 \0 w8 j8 ~, m+ {* j
  77. 1 P& Q, O+ t" F0 A' V) i6 S) `
  78. static int acnt = 512;. r( ]- y/ i7 o0 I+ E6 F
  79. static int bcnt = 8;
    # T2 m) f6 a( o
  80. static int ccnt = 8;! g& [% l' s- z

  81. ( D$ m( _; C9 e$ L% Q7 q) T
  82. module_param(acnt, int, S_IRUGO);
    6 N1 [7 e  d7 u8 e2 k
  83. module_param(bcnt, int, S_IRUGO);
    ! R2 i& |: g. ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 \7 d2 U$ @4 v* a; X4 D  z1 z" o. Y3 K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 N, m$ N1 i4 u- ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& `: x. [0 I& @1 K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& M' y- d4 X0 x" e7 |- [+ g
) t% d: b$ S/ d9 z
& U8 w, A/ H  _! N2 j3 Y, c; o4 Y+ H, u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 11:49 , Processed in 0.038657 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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