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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 B: h8 d5 I$ M. L
  1. [code]EDMA sample test application
    5 w9 c7 _4 h2 B, Z# t/ i4 @
  2. /** z4 s, p- l0 x* @
  3. * edma_test.c
    $ {8 y+ C; C- w# i% l& b4 u
  4. *
    3 Z) [5 Z! e9 R* T0 {2 ~( \. K+ n
  5. * brief  EDMA3 Test Application
    ) ]5 p: q& k# e+ D' f
  6. *# u, |/ P" e1 h
  7. *   This file contains EDMA3 Test code.
    / |& O0 M* S4 u, T6 [. U$ g
  8. *! ?0 q1 f6 o+ z5 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' U# z; f' E. K4 r4 m& Z! B3 \+ F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # u# Q3 U' {6 A3 n; M
  11. *         TO CHANGE.0 [- A; j3 s- n! y+ _
  12. *2 I6 ~* U9 h  J# m& w* f+ r- g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : r, `/ [4 M: |* q% t1 l, v5 V
  14. *
    2 G& X" j; n7 I8 a- w
  15. * This program is free software; you can redistribute it and/or
    $ T7 F6 C) W2 d8 h; b
  16. * modify it under the terms of the GNU General Public License as; R% z0 Q. N" u/ q2 S& n# L: n
  17. * published by the Free Software Foundation version 2.1 L% I0 |9 I) w; J6 b2 B% E
  18. *
    # I& S9 t; b( }8 T; l/ N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% ~8 Q; L. N) L/ h* H: [/ t9 u
  20. * kind, whether express or implied; without even the implied warranty
    6 j; Q6 w' ?: u7 ?! ^8 e" u8 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ Q1 l1 L( I8 p, p! I
  22. * GNU General Public License for more details.
    . \7 x7 m9 q8 G# |8 y  b9 `
  23. */
    $ V9 J. v) b) }& \

  24. ) B$ |# q; E. S$ a8 i
  25. #include <linux/module.h>
    . W' K+ q7 V  C) K1 h$ {# p! y
  26. #include <linux/init.h>0 t  e; h; t; q. `3 @3 }8 N4 Q
  27. #include <linux/errno.h>
    , S0 O" D  \( s- k$ F
  28. #include <linux/types.h>( `3 G) \1 F- x, L' w% F( a5 k+ X
  29. #include <linux/interrupt.h>* Z% V4 t) I9 S6 r% Z' ?) U6 |3 B
  30. #include <asm/io.h>
    9 G$ c5 y3 `, F$ w8 u5 c  l
  31. #include <linux/moduleparam.h>
    * @8 B/ j+ W, k" ?5 T
  32. #include <linux/sysctl.h>$ X$ }9 ?, `/ d0 t5 F8 L. F
  33. #include <linux/mm.h>
    # j8 j6 R1 f+ a4 ^, g
  34. #include <linux/dma-mapping.h>" a8 ~8 o- j. @. z- E4 a
  35. % g. m) N4 J/ g, i, S
  36. #include <mach/memory.h>; k; ^/ h" O8 N5 D- ]1 ~
  37. #include <mach/hardware.h>
    , ^. {" I5 H# |- v& m5 U0 `
  38. #include <mach/irqs.h>6 ~  k0 `; L- O+ F* a& a0 H9 ?9 o+ G
  39. #include <asm/hardware/edma.h>
    % I6 ~/ M" S+ d& i9 p; N
  40. # s0 L$ T8 _3 x! g- s' h7 |
  41. #undef EDMA3_DEBUG2 _- g' r' e+ ?: S5 x6 r9 I
  42. /*#define EDMA3_DEBUG*/0 q) A& r1 m) d2 H! e3 n
  43. ) f6 w5 |  y- O" R
  44. #ifdef EDMA3_DEBUG5 d5 n3 b; D* V( A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& i- N& k4 G7 h  H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# I8 [8 Z3 h4 E9 J% `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % U3 Y0 D) e' w
  48. #else
    8 X  x8 X5 [9 V2 Z3 A& z/ w  |* ]
  49. #define DMA_PRINTK( x... )
    3 r5 q2 g* `6 [5 t) d
  50. #define DMA_FN_IN
    ! F* b7 r; c- M
  51. #define DMA_FN_OUT8 u) c5 b/ S- x8 n& a
  52. #endif
    + c, B: }: `, o

  53. $ T3 u! C5 c1 H9 ]; E: H& Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; H. P! Z+ z8 n  @
  55. #define STATIC_SHIFT                35 F, ^# z# `% ]# v6 i- p) C9 c
  56. #define TCINTEN_SHIFT               20/ ^: s) T. T/ p$ _
  57. #define ITCINTEN_SHIFT              21  u( S8 I* f0 r4 m2 V8 I
  58. #define TCCHEN_SHIFT                22- C9 G7 q% ?4 V) C
  59. #define ITCCHEN_SHIFT               23+ Y* e4 s& s6 W- `! c
  60. & H1 N& L3 b# Q  A
  61. static volatile int irqraised1 = 0;* F2 z# T/ K" q% {
  62. static volatile int irqraised2 = 0;
    : C2 _! z* w3 n" K

  63. * V8 F' H" V; f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 y9 P3 @6 `7 n* I, C) x, \2 q( L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ w. s, O; }6 T! g  E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, y) y. |/ Y3 R$ T' u
  67. ; P# P5 }) B# j! D5 q7 X! r
  68. dma_addr_t dmaphyssrc1 = 0;$ u& u( Y/ W. d/ P. ~
  69. dma_addr_t dmaphyssrc2 = 0;
    , @: j' B, ]% W
  70. dma_addr_t dmaphysdest1 = 0;( `( `, h7 @2 F% f. m- m" D& [
  71. dma_addr_t dmaphysdest2 = 0;3 _& H% J' T# X7 n# u+ [) M4 M+ v/ x

  72. $ Q. W. m6 b; F, m& c6 S, P
  73. char *dmabufsrc1 = NULL;
    ! R7 \3 w; c' t9 B
  74. char *dmabufsrc2 = NULL;$ V8 u) d9 ^$ X
  75. char *dmabufdest1 = NULL;: a4 }; a1 q  T8 @* Q
  76. char *dmabufdest2 = NULL;
    9 j, C, d: D0 D" i

  77. ; {7 d1 z1 w5 c. @3 @0 O9 h7 i
  78. static int acnt = 512;
    : c" Q# j) x$ t; ^; T5 I! Y
  79. static int bcnt = 8;
    1 Q. \" Q6 k6 n1 f: `3 G$ {" g! z
  80. static int ccnt = 8;
    + B' Z/ [: y  z- U& }# G1 e
  81. - \/ ^. P! V1 b1 ~" x
  82. module_param(acnt, int, S_IRUGO);- M9 T) O8 E+ m  E, h5 V1 o$ |  X0 h
  83. module_param(bcnt, int, S_IRUGO);
    8 D& b' S8 e7 P* a. @1 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ V1 O0 Q3 p7 u; |3 `3 E3 X

9 t& K/ u$ }* @3 }+ q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* U, o9 s9 f5 J" I$ \4 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; a' v9 |# d6 M. B1 p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 F. @) d/ {' b) F( j+ b, p' u. Y: [1 l
( o* _9 j( B5 R1 N2 J9 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 19:30 , Processed in 0.037788 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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