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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" P% Y7 ^  b0 E3 H, ~3 D
  1. [code]EDMA sample test application/ B# Y; ~# d3 K7 u. u3 {
  2. /*
    - g. u& ?& X; j9 D. Z7 P' I
  3. * edma_test.c
    ; W3 C6 s2 @- D7 A8 v
  4. *4 W4 \  M$ Q' V+ o
  5. * brief  EDMA3 Test Application
    - ~1 \0 |2 v4 H; i+ J4 v7 a
  6. *
    " i# M+ Z5 A! O5 z! R2 o1 ?
  7. *   This file contains EDMA3 Test code.
    # H1 E: C" O* X0 }' O2 c
  8. *! Q- }! V' d- y3 X5 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 E5 r$ y0 u8 E) ^+ M, s5 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 ?- ?1 t: l" p# A) n: i
  11. *         TO CHANGE.
    . m% c8 l$ s. n$ }
  12. *
    ; x2 E- o0 b5 Y; d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 h; N9 G6 ~: N6 G# v
  14. *) k; s; W4 B7 m( f
  15. * This program is free software; you can redistribute it and/or# i! Y$ k3 C+ ~
  16. * modify it under the terms of the GNU General Public License as
    8 g9 Q, Y4 G7 M; i
  17. * published by the Free Software Foundation version 2.
    % M  p0 t1 d: q! T
  18. *
    $ f, M6 b& o1 ?7 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! V9 C$ K9 J2 o' P$ Q. i" F
  20. * kind, whether express or implied; without even the implied warranty/ l. S  J3 q' F% P$ U( G7 X/ F/ `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 M; o2 f  j/ m! `4 i$ x
  22. * GNU General Public License for more details.) n5 h/ z. S# W' \! f
  23. */7 @  v! ?& L) K& W6 e# r6 w5 d
  24. 5 Y( d$ D( t& J$ d
  25. #include <linux/module.h>
    4 r. U+ t4 S. B- z; x
  26. #include <linux/init.h>
    . o" G* e5 V# O9 h
  27. #include <linux/errno.h>* o% V, E7 p6 l' a$ |
  28. #include <linux/types.h>: g" P! J0 `& p: n' X  }( Z
  29. #include <linux/interrupt.h>( J. o1 W: ]% L" J+ j
  30. #include <asm/io.h>! U8 Y7 A' ?, T
  31. #include <linux/moduleparam.h>
    3 x# W; h0 V/ c% G: z9 g9 j3 I+ U- w
  32. #include <linux/sysctl.h>
    ( l; I; y  b  x* p7 D% R
  33. #include <linux/mm.h>
    " t8 F/ M( z4 V" E/ v
  34. #include <linux/dma-mapping.h>& _4 R- z" ~1 l: D! V  x  [2 D

  35. ( t( \& k3 g1 u& f
  36. #include <mach/memory.h>
    ) K" }: V$ d& ~9 W  @
  37. #include <mach/hardware.h>
    & R3 A$ l9 H& `2 w
  38. #include <mach/irqs.h>7 r& a: ^$ m) o. B
  39. #include <asm/hardware/edma.h>
    1 P5 b- N; W' G0 l) @( d5 a8 P

  40. % r  u% T$ ?# {# r  ]5 u3 S
  41. #undef EDMA3_DEBUG+ F2 R0 v, O/ V3 x$ n
  42. /*#define EDMA3_DEBUG*/
    " R( @( ]7 s- K  L; Q

  43. 5 Y" e" f- b4 }+ }/ k
  44. #ifdef EDMA3_DEBUG
    ! E" x  m" l; P) X9 x. \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' Y# a: k* n2 |! v4 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( o& T, Y: A' N! U+ N4 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 O) E$ f, y) ^/ G4 F9 Z+ Z
  48. #else
    + W( e. A8 K% _1 s+ d
  49. #define DMA_PRINTK( x... )4 E. C) D7 \/ d9 L
  50. #define DMA_FN_IN
    # j4 c3 L' ~# P6 _! i. N, r
  51. #define DMA_FN_OUT+ b3 C/ J% m, v
  52. #endif& A3 Y6 B6 s1 ~( Z, W; v  b
  53. / j/ w/ _! U3 E! Y  i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / t+ O6 K7 v: Q2 v2 l* o
  55. #define STATIC_SHIFT                3
      c& R7 d6 _; ?1 w$ q
  56. #define TCINTEN_SHIFT               20
    / p; j+ y9 g$ C, T8 x& [
  57. #define ITCINTEN_SHIFT              21
    2 n- s% Y! N+ [4 u
  58. #define TCCHEN_SHIFT                22$ y0 ~  z' k% W$ Q
  59. #define ITCCHEN_SHIFT               23
    , v; U+ D' }- \1 T7 e6 l# W
  60. ! b$ b+ r6 K5 E1 j# O& C3 _
  61. static volatile int irqraised1 = 0;
    ) Q! d! c3 C6 z
  62. static volatile int irqraised2 = 0;
    4 M7 i# t; V. D6 D

  63. * o" t# r. Y% t8 C1 Y; J7 ~% S% g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, x* o9 W" ~/ S9 _5 B2 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) a6 e. W+ M% D. [! C" B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 |, \+ \1 B% s3 _8 y
  67. - e) O! U4 ?& P( R8 @' F% F
  68. dma_addr_t dmaphyssrc1 = 0;. J( ~( _2 G6 _; E
  69. dma_addr_t dmaphyssrc2 = 0;
    0 l$ i2 i8 f4 @
  70. dma_addr_t dmaphysdest1 = 0;3 h2 D) [3 p7 k, w2 [" [
  71. dma_addr_t dmaphysdest2 = 0;% G) a- M, W: B0 F2 m: o
  72. : D7 ?/ j6 e9 b  o$ i# P  [- f( X
  73. char *dmabufsrc1 = NULL;8 J4 b: T( U9 v1 I
  74. char *dmabufsrc2 = NULL;( i. n& f, u* [5 L
  75. char *dmabufdest1 = NULL;: T3 V) r  T6 Z
  76. char *dmabufdest2 = NULL;
    1 U/ p$ ^+ O  h; Q+ ^
  77.   n/ @& S; x5 ^. o; m, O7 ^
  78. static int acnt = 512;3 I2 I/ g) j  ^* d) n2 S
  79. static int bcnt = 8;
    & s" n. }& e6 L+ R8 L1 i7 b
  80. static int ccnt = 8;& g6 J; P: D. `7 O7 b# w- B

  81. 7 K! M' O7 Q9 M* k7 ^# w, N
  82. module_param(acnt, int, S_IRUGO);
    3 n+ P& v% p+ E5 p* n
  83. module_param(bcnt, int, S_IRUGO);. K: i" u& p% c$ R3 O/ D8 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; E+ `" U; r& e
& }0 O4 p' o' [# z: [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' S$ Z; T, B# }+ b% g3 k/ F3 q! z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 [& _+ g" K7 W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" B# ~' L3 v9 b. J5 R4 j
( z. L* u. h, n
% W4 S: M- l) [0 b( t* F& u* u$ L$ }# S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 17:54 , Processed in 0.035364 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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