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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" k' m; L# ~: f: J$ k# C0 q0 f4 R
  1. [code]EDMA sample test application
    ' A9 N2 i( m) T& `$ R+ Z+ s! W
  2. /*
    # B, o$ W' F4 `  m% Y. Z$ C" f
  3. * edma_test.c
    9 a* F; x7 z$ G' ?* ^. t
  4. *
    + @4 R; W' `. c, c# y' w4 _  d
  5. * brief  EDMA3 Test Application
    8 k& g: n1 @' F. R" W, ?. G
  6. *
    % F  R  C# h, P6 K6 X6 t
  7. *   This file contains EDMA3 Test code.
    ! p( ]+ k6 `3 n! o3 D& M/ @
  8. *
    ( J5 e2 a5 r. d- f3 B; f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% l, e. n+ h" ~; {. l/ S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( \! B' @- d' [
  11. *         TO CHANGE.( `0 P: }. e: W/ _
  12. *
    ; i3 m$ b5 o9 g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  w8 E8 c- r1 m
  14. *
    9 Z7 i; ^! ~$ |! J* r
  15. * This program is free software; you can redistribute it and/or
    $ E3 `" {& J% e& F" A' n  N
  16. * modify it under the terms of the GNU General Public License as$ c" E* f5 k: j- P% G1 p- _
  17. * published by the Free Software Foundation version 2.
    & ~/ S" c  L# d4 a9 G$ Q
  18. *) t% Q7 ~7 r0 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " y9 m" b+ k( }* B  K
  20. * kind, whether express or implied; without even the implied warranty
    ; B4 v. ^3 F, I; P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% b# @$ @0 l( g" s1 q8 q5 X
  22. * GNU General Public License for more details./ \/ h7 k5 G$ R7 u1 w1 {0 ^/ Q
  23. */) f* O+ @3 M- x% P* c
  24. ) k/ V$ N- _0 s! o# E. B
  25. #include <linux/module.h>, K  z4 V* N  J6 j% K# ?
  26. #include <linux/init.h>, e9 @3 _2 j5 g* b: d/ I
  27. #include <linux/errno.h>
    ! h# |! u2 ^2 P+ `* o
  28. #include <linux/types.h>
    9 q( p) K, w' g& ^% _
  29. #include <linux/interrupt.h>8 e+ }/ a8 K; f+ P5 {
  30. #include <asm/io.h>
      ~  ]2 A" _' V. M6 ?. n. @
  31. #include <linux/moduleparam.h>
    7 c' S( }8 N. ^3 ?' `+ N
  32. #include <linux/sysctl.h>) Z5 i. q/ }5 ?" h
  33. #include <linux/mm.h># d. D4 U0 P1 V* c$ _2 N
  34. #include <linux/dma-mapping.h>
      r; n' ?5 X0 f

  35. / f  P* B* \6 A; M' J6 I+ N! F
  36. #include <mach/memory.h>0 b' K2 Y% q. `- U! x( W# _" t5 c
  37. #include <mach/hardware.h># J4 P1 ^$ B2 E# p
  38. #include <mach/irqs.h>
    . p# T/ w" W8 K( X) B" B# l
  39. #include <asm/hardware/edma.h>9 I- Y" g# {: x# r' _0 [) s* {- b

  40. ! D4 a& b0 g# P
  41. #undef EDMA3_DEBUG; P6 N5 E6 i/ |8 r) |
  42. /*#define EDMA3_DEBUG*/
    % ^. `+ `  Q9 C' v) H3 A2 J
  43. " @6 V5 I; G) P. Q0 l
  44. #ifdef EDMA3_DEBUG
    # x/ w5 q+ e6 L' _& [! K3 X! a7 d0 U# u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , C, O/ j: p3 h( h0 S( L! _6 U4 W$ ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 B0 |; s; n/ b, C. m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * z3 e% q* y$ B5 t/ ]# b* U* n& D
  48. #else1 H: U% K- {& t4 g$ x' w& D
  49. #define DMA_PRINTK( x... )% H, g# s) k8 _1 c" m3 a- n4 p
  50. #define DMA_FN_IN
    7 S% z* I9 W/ j) i
  51. #define DMA_FN_OUT, d& I5 L) W  }8 O: n" P
  52. #endif
    $ `) l2 M$ @  p3 V
  53. 6 y& \& k) x* ^" K" [  ], C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) Z4 V9 O$ ^. ~6 c2 |0 v  t, _
  55. #define STATIC_SHIFT                3
      q& U! Y& z- D
  56. #define TCINTEN_SHIFT               20- ?/ ?3 a3 q& }
  57. #define ITCINTEN_SHIFT              21( e' g& y! X4 x* o0 c8 W
  58. #define TCCHEN_SHIFT                22* c( {* z4 a! Y1 ?- O9 b# w
  59. #define ITCCHEN_SHIFT               23
    % A8 k+ W7 r3 E& s
  60. : V" j/ D9 g/ N. S
  61. static volatile int irqraised1 = 0;* [1 e5 J& b4 D* q( }6 t
  62. static volatile int irqraised2 = 0;
    ' z% H) i6 u7 r0 b% e+ o- I4 ?

  63.   s6 W! X7 b2 i* p$ _  V2 S, _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 Z# X- I. H1 O; w! p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ?2 p6 G: P9 C/ |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 M) {+ r) P4 E1 }- R# ?- P% v$ `
  67. 4 \" I0 r* E8 V8 @7 [/ i3 W
  68. dma_addr_t dmaphyssrc1 = 0;3 ~; ], v- G( V0 i; }5 V- [6 L: f
  69. dma_addr_t dmaphyssrc2 = 0;
    ( _' q9 G# N6 j& p/ ^
  70. dma_addr_t dmaphysdest1 = 0;  }) w. W" ?7 G8 c+ w. [$ P; s
  71. dma_addr_t dmaphysdest2 = 0;8 O! F9 X. {5 D

  72. 4 |# n! v1 n% O; C/ V! ^% f
  73. char *dmabufsrc1 = NULL;
    ! U3 @1 B. S  E$ f3 _
  74. char *dmabufsrc2 = NULL;
    5 j5 S4 K8 Q; x
  75. char *dmabufdest1 = NULL;
    ( T0 t/ ]8 z( B1 a. D6 h1 K
  76. char *dmabufdest2 = NULL;4 Q3 N# j) J  p% Q( f& s& ?

  77. ! m% G, y) O# v: h! R
  78. static int acnt = 512;* J7 g3 q2 d. K# Z3 e$ D
  79. static int bcnt = 8;
    0 k' x9 _- B4 U+ @& a; L
  80. static int ccnt = 8;
    - r) z, s$ @4 c* Y$ n( h7 O
  81. ! x- x* N# O5 {  o" }4 j* U. P
  82. module_param(acnt, int, S_IRUGO);8 I% L' @  G  N
  83. module_param(bcnt, int, S_IRUGO);6 s1 E; A. H! T: @1 B  j: ]0 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 t5 \& k, `6 z5 y; g
8 w2 j7 G/ c6 n) B4 |( t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: j0 n$ D) u: L/ Y" l
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 d# P# c% |3 B0 o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 y7 w) t4 q- Q0 B( Z/ F
( I  P( _3 P7 p6 h/ |6 l* n( C
# d/ @7 r  f1 S9 z4 X3 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 15:33 , Processed in 0.038574 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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