OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 e6 ^: _. h/ d: K7 A+ ]2 v
  1. [code]EDMA sample test application
    ) v4 P; }$ @) b( y
  2. /*
    + q  X1 c3 t  n% p7 l6 c
  3. * edma_test.c5 f: Y& W) m: p. z1 G# j2 x' E9 i
  4. *
      d! J2 C$ W/ x3 K" \& f8 W& x
  5. * brief  EDMA3 Test Application
    8 \" ?4 `. I' p. f2 {* g9 q
  6. *- |; D$ [; H! w
  7. *   This file contains EDMA3 Test code.8 B; z' q4 H% d
  8. *
    & H% I2 d7 n" i! a  R* N% s  e/ {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : `* }: G/ b; v7 o- g3 a  O2 X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 U  Y9 ?5 {/ V/ c* G
  11. *         TO CHANGE.
    9 p$ J5 }/ L2 P! W
  12. *  o/ L  S$ u" H! v9 a( [7 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 a- w, C! n  K: u  b' S+ K
  14. *
    " t# `# ^5 A! q( h- P, G
  15. * This program is free software; you can redistribute it and/or! A2 P- p4 F! z8 r
  16. * modify it under the terms of the GNU General Public License as" e7 |' |% j) j7 e9 O1 _
  17. * published by the Free Software Foundation version 2.% w. `0 t9 e# j* S, ^
  18. *+ r) p: Z' V, f. x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 z1 J* _0 F+ E* [* \
  20. * kind, whether express or implied; without even the implied warranty2 K1 t2 U( C2 R& ~* D# d# a: _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 l4 ?& \5 i; e9 k% i8 F, v
  22. * GNU General Public License for more details.
    , P0 L& }% R. d5 a$ t% U
  23. */
    0 h* U4 J% g/ }) D: a, m

  24. + D# [0 d$ x2 n; C$ `! G4 Z. v: H( i
  25. #include <linux/module.h>
    4 T) Y% s2 _* C
  26. #include <linux/init.h>2 y% w, a6 E+ e; S
  27. #include <linux/errno.h># U8 {/ r# v$ V4 e/ a4 X5 P
  28. #include <linux/types.h>
    6 N: {; q' W/ R, w. p
  29. #include <linux/interrupt.h>
    . B& ~; \1 S2 k" _/ C
  30. #include <asm/io.h>
    6 E# b; c8 M8 d
  31. #include <linux/moduleparam.h>
    0 C1 V5 U' C, I  s9 U! O* `
  32. #include <linux/sysctl.h>$ N5 h* f8 o% D3 W7 T' M/ B
  33. #include <linux/mm.h>
    $ q8 [! }. P$ M$ i0 |7 ^' [# s# x6 D
  34. #include <linux/dma-mapping.h>& Q1 k6 F. H/ f$ n- x
  35. ' o! ]" F1 M, B9 r: s6 t
  36. #include <mach/memory.h>- r% Q& C. i8 p( G( Z/ u" L
  37. #include <mach/hardware.h>
    7 [; x$ j, q% g: X) G& Q
  38. #include <mach/irqs.h>9 H. z, w6 d/ O9 [8 V) \. b: N
  39. #include <asm/hardware/edma.h>! S& w! Q( f) f
  40. 0 v) n" x1 Z( W, j2 W8 I
  41. #undef EDMA3_DEBUG
    # D8 K2 B7 r8 b, O) X8 d
  42. /*#define EDMA3_DEBUG*/( O7 {; U, M/ n% @% C; V- [
  43. % l* G+ y' b' G% a9 r
  44. #ifdef EDMA3_DEBUG
    2 |" G- X% R6 p0 }6 k& v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' c, C1 X1 V2 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" r$ S- M. m" C9 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 D: @7 l/ g/ u3 x
  48. #else6 L5 A5 R' g( _+ i2 U  _
  49. #define DMA_PRINTK( x... )
    ( U- q7 g# _& X+ W" v  I: l& u# T
  50. #define DMA_FN_IN
    2 Q$ c8 F, o% m7 E( ]
  51. #define DMA_FN_OUT3 ^8 y' W# b+ Y. ]; g' C
  52. #endif
    % H" y8 M) }! m! G6 ]( w

  53. 8 B5 y) u  a# h+ m; P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 X' a( J5 q, R$ v8 R+ W
  55. #define STATIC_SHIFT                3. M$ {9 D( I& Y4 |% u
  56. #define TCINTEN_SHIFT               20
    & R$ Y3 Q2 j9 D2 D% q( h
  57. #define ITCINTEN_SHIFT              21
    / W0 B4 o2 S  i0 L; U# }* g9 T
  58. #define TCCHEN_SHIFT                22
    3 X3 O1 Z$ }8 J8 j
  59. #define ITCCHEN_SHIFT               23
    - J* a$ ~4 N% L) l. z

  60. + ^* B& I, q2 w3 e
  61. static volatile int irqraised1 = 0;
    " T# o9 Q: X+ V) z- j( h# p7 C# t3 x
  62. static volatile int irqraised2 = 0;+ E& s* }% ~# h& ?8 r7 V# ?9 }, P8 e
  63. & }+ V8 ^. a) T. r" X& x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 a& x6 N$ \" i2 B" c+ `1 e4 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 _  `( S3 J$ z0 U5 |/ T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) ~- J& |. `% [/ j3 N  F7 B
  67. 7 `3 e+ W* d  Z4 Q) |2 j0 v
  68. dma_addr_t dmaphyssrc1 = 0;! A& |7 C" N2 K" H0 ~5 Z. d
  69. dma_addr_t dmaphyssrc2 = 0;( k- ?: k4 d2 N/ A; ~
  70. dma_addr_t dmaphysdest1 = 0;
    - C: U: K* q0 Z% R
  71. dma_addr_t dmaphysdest2 = 0;
    4 S0 \# n0 X; g: A. G
  72. " ]3 m  D% \- E6 e' ]
  73. char *dmabufsrc1 = NULL;0 n; ], ], M7 ]% Q2 G- ?; \1 S- g& e
  74. char *dmabufsrc2 = NULL;
    / x; ?! |" b- H
  75. char *dmabufdest1 = NULL;
    + U- Y3 Q2 B, ]: e/ ^* D: N1 K1 ?0 `
  76. char *dmabufdest2 = NULL;3 I% A4 G! e% E4 G8 w

  77. 0 t* f" ?6 t& X: q' t) m& i# c
  78. static int acnt = 512;2 A6 |* W9 [9 H9 G2 h1 G
  79. static int bcnt = 8;
    8 g: M, ?' y% E
  80. static int ccnt = 8;
      X. D! [+ [# \
  81. / b* `% Q( h( s
  82. module_param(acnt, int, S_IRUGO);
    9 h0 h# ?$ |- ~. K
  83. module_param(bcnt, int, S_IRUGO);: f- b7 n  ]; @0 l+ D/ q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ A. r* p7 q8 y/ k! ]4 G7 @
! p; w. J* ^3 U, R3 ?9 A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  p3 s1 _8 h2 M9 q9 w7 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ K; X5 Y* I* g1 z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; L3 P$ c1 m8 C1 x1 ~' I  c

* G8 T' x: ^# i8 A3 B1 S7 N( y# O6 z/ z2 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-2-5 13:32 , Processed in 0.039199 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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