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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / o& w" ~- g9 Z( e: J
  1. [code]EDMA sample test application1 V" `0 I2 Q( F! r3 x7 q
  2. /*
    + H" S* |. A  c/ F! ?: o  }
  3. * edma_test.c
    ( S4 ?) i' K8 _' a' s" J
  4. *8 D! [2 c6 L9 G8 S* P2 `/ Q2 I! M
  5. * brief  EDMA3 Test Application
    9 T. C/ p0 n8 [9 |: j: m
  6. *- M6 K  ^8 t1 r( W5 k. c( a
  7. *   This file contains EDMA3 Test code.
    # F* R$ ~3 r1 V
  8. *, K2 I, g6 V. N( ]7 y- n! Q, L% O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 w/ N% @7 \. i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ J- ^; T; M, n* @; I
  11. *         TO CHANGE.4 X. q9 {5 E: h/ x; z0 {& O# w: t
  12. *
    4 A2 m3 i$ r) Q' E8 y6 c5 n- V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 ~8 t+ a1 J( n; I6 @
  14. *
    , v  z4 ?2 T. U5 V
  15. * This program is free software; you can redistribute it and/or
    : }* g- D7 t% Y0 ?# x
  16. * modify it under the terms of the GNU General Public License as, L" [# O; ^1 b6 A7 ~( J8 T
  17. * published by the Free Software Foundation version 2.
    ! F+ ?( f5 A7 U" J6 P5 ]; c4 P
  18. *' s( o- h, r( }& t' e: f5 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & m1 B4 t* K, A) {" W- J
  20. * kind, whether express or implied; without even the implied warranty
    ; L) q# m$ ?- b) U: c& G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* d. [! J! ?6 E" W/ w* B. X  @
  22. * GNU General Public License for more details.1 m! J; \, s3 V$ {5 X& L
  23. */7 \% S' @0 g0 t7 x" I6 w. S7 c7 \

  24. # s( E3 d) U9 R" _
  25. #include <linux/module.h>7 X# ?* ~8 x! h( j  r
  26. #include <linux/init.h>' B9 B! G# r- p
  27. #include <linux/errno.h>
    ) X% ^2 D+ }8 Q: }
  28. #include <linux/types.h>4 X3 B' Z2 {9 u6 [0 }4 B7 R
  29. #include <linux/interrupt.h>
    7 R0 l( ^' _6 s/ G0 U- y9 y! g8 I
  30. #include <asm/io.h># F  J, S1 X4 o
  31. #include <linux/moduleparam.h>
    3 I  ]" Y1 ?8 Z; j  \8 A' `
  32. #include <linux/sysctl.h>
    & j+ l9 @- a4 @( Q, _
  33. #include <linux/mm.h>
    , K9 Z4 S9 G! V' N
  34. #include <linux/dma-mapping.h>
    & e3 L* {# e7 Z5 C, h% z
  35. ; R) W4 ]$ }4 ~+ \
  36. #include <mach/memory.h>7 e8 I: @5 }3 K& ?: |1 U& ?. z
  37. #include <mach/hardware.h>: s$ ~0 N- C+ K
  38. #include <mach/irqs.h>. _' m" s3 c1 q
  39. #include <asm/hardware/edma.h>- e6 ]( u8 I+ B3 o
  40. * m5 u. V; ?) B0 Y
  41. #undef EDMA3_DEBUG
    & d) J# o9 D3 a8 i+ N- ~6 C
  42. /*#define EDMA3_DEBUG*/8 ]- Q) [- E# I& k2 ]
  43. 1 a& V! S; z  i* n( Z) e5 ~  H; I
  44. #ifdef EDMA3_DEBUG9 S9 a" G6 e& _( B6 |( c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! J9 d* e# @+ P  L6 \3 C3 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ y0 W& X9 W. W& E3 I1 V7 I4 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + n' I! h4 u2 g2 r  Z3 ]
  48. #else
    % j& ^" J% Z# i; [2 g. V2 Z. G4 V
  49. #define DMA_PRINTK( x... )" v4 t# Q' j" g  i1 t% U9 K5 Z
  50. #define DMA_FN_IN
    5 h: K/ R- l, Q  o( x* {( O
  51. #define DMA_FN_OUT& D& b( ?& `8 q
  52. #endif
    $ \4 J, J9 h- k: ]6 p" @. r' o
  53. ; j! |) M2 T( w. E) O' Y. z7 a  v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! N2 T: F# T) h4 x  t- x
  55. #define STATIC_SHIFT                3
      Y* S1 W2 f& {1 F" Z. H
  56. #define TCINTEN_SHIFT               201 E9 y( p4 j0 ?- y
  57. #define ITCINTEN_SHIFT              21
      {. Z! s: A  e
  58. #define TCCHEN_SHIFT                22
    5 Y! I1 Z. I+ [* I9 Q9 t
  59. #define ITCCHEN_SHIFT               23
    : M. U( ^' ?4 h; u! O1 a0 Y+ k5 J4 _

  60. 2 A+ @( ^* w  {2 \6 r1 B# |
  61. static volatile int irqraised1 = 0;
    + _0 u+ @; {: w9 v8 M- s) N1 O8 _
  62. static volatile int irqraised2 = 0;
    # p1 l0 u7 c% Y" p5 L4 C1 }+ n: u
  63. ) ]% y4 Q; A/ @8 V7 [1 [; _7 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , l1 ^3 D: \7 {  U* z8 z7 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 b" e9 X) H* Q7 y$ E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( L  O2 o4 O4 b8 a' `

  67. 3 {# F% A1 S5 f; Y1 }3 f" j
  68. dma_addr_t dmaphyssrc1 = 0;1 B1 M9 p0 O, L4 D- b/ Y
  69. dma_addr_t dmaphyssrc2 = 0;
    ( x7 }; ?+ q- O3 W3 [9 ^
  70. dma_addr_t dmaphysdest1 = 0;0 f( l4 K/ E, g; b$ W: l+ E6 [% b2 y
  71. dma_addr_t dmaphysdest2 = 0;; l3 k) K. C  l! P% t5 z, b
  72. 2 K# N. v2 L: r) n6 ~% a
  73. char *dmabufsrc1 = NULL;6 F* Y( `9 p( @# t8 W
  74. char *dmabufsrc2 = NULL;
    % t1 _* M& L& l
  75. char *dmabufdest1 = NULL;
    , _  \- v8 t6 T, c6 [8 P: l9 A2 e
  76. char *dmabufdest2 = NULL;. V' W! l: N. Y4 i

  77. & [! o) z) o3 ]  ]7 T
  78. static int acnt = 512;
    : e& E* Q2 b& f
  79. static int bcnt = 8;; f5 U2 b) b9 v% i
  80. static int ccnt = 8;8 \( ~" N/ f0 x! T! K. O
  81. : ]& ?# y  e8 t% a( _, V8 @
  82. module_param(acnt, int, S_IRUGO);! h( W! H7 w% T) t8 R( ?' @
  83. module_param(bcnt, int, S_IRUGO);/ d7 W# ?% K, I; ]& x6 k( j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 `8 h/ x; y1 A
- ^& N' k8 B! c0 r- i& N& M& l& e6 r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 ^: ]7 @( w; A$ V1 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ q; p6 l# k3 y) C- V6 m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: u: d+ w6 ^4 b" L' s$ n+ a

3 n0 g* Z+ O" ]- E2 \8 O% y$ w8 ^, ^: ^1 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 22:05 , Processed in 0.043157 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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