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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) x# J' O& }3 Y9 l9 i0 O  z
  1. [code]EDMA sample test application
    4 {( t* K) V! j
  2. /*; K: p# T1 v& e  w* h1 j
  3. * edma_test.c. Z" E5 s" j6 H" ]
  4. *( h  i$ y3 L3 l" i' c
  5. * brief  EDMA3 Test Application
    3 U7 O$ ]" v/ k1 l- I; t$ X, a  K
  6. *2 k: U9 h" L$ k. U6 {2 ]
  7. *   This file contains EDMA3 Test code.+ Y- Z5 f: Y$ y( G3 E
  8. *9 W9 ~! H+ y: H- H. L4 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! C( l$ x. o: X, {7 e$ [) h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  A1 [+ `" @( j# s- e* c
  11. *         TO CHANGE.0 u7 |6 y0 F# G: o4 f$ ?
  12. *! p* {8 x, {- Q6 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; c, C! q& L2 ?& U8 X" a
  14. *
    7 b9 I1 J' N2 ^5 d$ k
  15. * This program is free software; you can redistribute it and/or
    6 T: o% ^! y% M  X/ y; x
  16. * modify it under the terms of the GNU General Public License as# o' n! s0 T. z$ r8 q
  17. * published by the Free Software Foundation version 2.
    # J6 ]4 N* g0 D# t2 P
  18. *
    , ]% [! d, `" s1 _9 \  V. R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 R. Y. h( S7 p5 B$ J+ C0 ?
  20. * kind, whether express or implied; without even the implied warranty, e# s9 X+ \2 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * {& h8 Y6 P6 E+ I1 P% c
  22. * GNU General Public License for more details.
    : o+ D+ q! c( ^1 b2 q
  23. */. h+ @8 C5 ~0 ^& C, R. P5 R5 Z
  24. , W9 b( X9 n! e& H8 @
  25. #include <linux/module.h># l- p. i4 M; P! }9 u
  26. #include <linux/init.h>
    : [2 d: {& s- C% O( u
  27. #include <linux/errno.h>* M2 Y) Q: o/ u- B6 g' N
  28. #include <linux/types.h>
    0 S) g( E$ m0 |
  29. #include <linux/interrupt.h>
    1 x% Q4 {: G+ H5 T) g3 R' l8 d8 A+ V
  30. #include <asm/io.h>. V9 F  u# n; ?- _4 C2 M  D6 T; |# X
  31. #include <linux/moduleparam.h>7 \. D" J% u9 G. W! j4 f, J
  32. #include <linux/sysctl.h>
    1 t. p, w; y! d8 Z2 U
  33. #include <linux/mm.h>
    ( @& f7 `' n3 |) ^
  34. #include <linux/dma-mapping.h>
    ! s( {0 i3 p( C% }: ]
  35. ; z7 A5 Q4 }: r0 g$ Y0 P
  36. #include <mach/memory.h>
    1 O! W) O$ Y2 h/ o1 F+ ?; E4 m. s
  37. #include <mach/hardware.h>
    8 w( Z$ @* R2 e! e
  38. #include <mach/irqs.h>6 x3 `5 h6 k6 ], v! r5 X2 c1 m
  39. #include <asm/hardware/edma.h>6 E( f1 l4 ?8 b/ x; j9 z3 [
  40. $ ~0 a; }; T, ?& |
  41. #undef EDMA3_DEBUG
    3 W. w' m" s: N: o! w
  42. /*#define EDMA3_DEBUG*/9 n8 P9 }4 c- j' c0 S  ^$ \
  43. 8 g$ h$ H! {5 b& ~) v
  44. #ifdef EDMA3_DEBUG) z9 }, Y. D7 a$ o* D/ g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 b$ L2 M% N, k' n& E# B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ n  F' o6 `; W& d0 x5 O3 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* o8 s, w. \% z8 i0 o4 }; q
  48. #else
      Z9 I) {3 H- b, F- a/ w
  49. #define DMA_PRINTK( x... )
    ' E8 O0 F) S% a! J
  50. #define DMA_FN_IN  t- l7 U9 w/ I" ]' p6 \
  51. #define DMA_FN_OUT: p* q& L  ?( @/ m# W
  52. #endif
    ) x) I' m% b" V, W( l

  53. 1 K- ^7 ?+ t- `+ S8 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 {: h" f4 K0 `5 U9 H
  55. #define STATIC_SHIFT                3- _# p* U9 o# O) D1 u
  56. #define TCINTEN_SHIFT               202 }$ f  J8 k  J6 L9 h, p
  57. #define ITCINTEN_SHIFT              21
    ( d# M( `4 T+ q8 o5 g+ D3 h" j
  58. #define TCCHEN_SHIFT                22" Y4 o# C3 k- h( Q' S
  59. #define ITCCHEN_SHIFT               23' u3 q- c3 k& [5 `; w. u1 q- H

  60. ; @& k4 N, ~) A
  61. static volatile int irqraised1 = 0;2 p3 A3 {7 j; @
  62. static volatile int irqraised2 = 0;
    ; u0 x! J) }+ U* C
  63. : a/ u: i7 \( S7 K( {5 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, s/ S% `/ x# @! W. }7 O- h) w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 T* m3 T9 ^0 \, F' M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 s4 T% |7 E  @: e. \* C' a
  67. 7 }/ B2 S. x! t2 V- s( ~0 r
  68. dma_addr_t dmaphyssrc1 = 0;% ~! _7 Q3 ~) ^- h8 S4 A; |
  69. dma_addr_t dmaphyssrc2 = 0;' m' w" d; M) Z1 @8 ^5 H) [
  70. dma_addr_t dmaphysdest1 = 0;  |, f6 }* J# l; ~& k
  71. dma_addr_t dmaphysdest2 = 0;  Y% c, q3 e5 M/ ^
  72. ( M" m( P: z8 Z8 T4 d) f( t1 [
  73. char *dmabufsrc1 = NULL;
    ' b8 L. h8 b6 B4 N+ G% Y2 f
  74. char *dmabufsrc2 = NULL;6 l0 O- q/ L3 K. B% B2 O
  75. char *dmabufdest1 = NULL;
    0 C9 b* ~7 F$ `- |
  76. char *dmabufdest2 = NULL;
    $ R5 J$ j# p$ O* f4 T1 r/ e

  77. . n8 F4 Y. H& _) ?# w  ?: t  x
  78. static int acnt = 512;1 Z. ]2 d4 k7 i* [; U
  79. static int bcnt = 8;) {; w3 h1 U' R  o1 c. k) a
  80. static int ccnt = 8;
      o) L$ J4 y% c% ?

  81. 8 S4 F1 }, e' ~& ]0 O* s/ j
  82. module_param(acnt, int, S_IRUGO);( Y# ^" E" G5 f# A& c; C& O
  83. module_param(bcnt, int, S_IRUGO);8 F3 _- A/ {/ j8 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: ~6 \0 W! S: E0 L' k2 L  i* s* z* Q- E- q+ l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 z2 S! v7 K/ t. T# O( e. V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; P" {- r/ u% _  E: {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# d! W2 A" n2 Q" S% V. r) x, F  U6 w: l5 Z8 S" f) g' W
0 Q3 {9 ^. O' S/ ~! t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-9 11:13 , Processed in 0.042826 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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