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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 P0 g1 R/ K, ?- M2 k
  1. [code]EDMA sample test application4 |$ N( g# [/ n: t$ h3 c- [8 [
  2. /*
    ' x: V: O& a/ ~* x
  3. * edma_test.c
    8 w  s& K9 w! R8 r
  4. *
    : b8 M( o/ |# }" o# p
  5. * brief  EDMA3 Test Application4 q; a6 j* D2 q
  6. *
    . [: y2 a& l5 ]0 a" `( [) q3 S
  7. *   This file contains EDMA3 Test code.* p+ ]; [/ \/ R: \6 a
  8. *
    % r- `' r  ^4 g3 A6 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! e+ _3 b) c6 U$ E' U( O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! F5 ]: ~, h9 n
  11. *         TO CHANGE.
      e0 C1 G6 j5 h$ V% m) ?: Y+ u* a- j
  12. *
    8 ~" k( j5 e# q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 |# [: O2 x  Y# A( i
  14. *5 V2 O" d7 C8 d6 a
  15. * This program is free software; you can redistribute it and/or7 |2 @/ k5 i; N
  16. * modify it under the terms of the GNU General Public License as& \! R$ I# \$ I4 S- T
  17. * published by the Free Software Foundation version 2.
    # P5 L; w: f/ i/ N
  18. *
    / k2 w; U8 H2 w% D( Y! Q1 b7 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " P. ?) B+ A; d& D- Z" y
  20. * kind, whether express or implied; without even the implied warranty, [4 [& I( Q$ M& j9 E1 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 J; r( K- T; P6 }( R3 Q5 f
  22. * GNU General Public License for more details.9 |( j9 N# v  ^& K9 d, _
  23. */) }5 U* y" s; t( S

  24.   C4 R1 s# Q! k% }+ z3 m# P( T
  25. #include <linux/module.h>/ V( ^. `& C( z% h4 n/ D) U9 p
  26. #include <linux/init.h>+ ^4 ]6 M# ?% R
  27. #include <linux/errno.h>' t( n" B8 k: ]% }# G5 K. O5 P
  28. #include <linux/types.h>' M  S; J" R; u9 g- K
  29. #include <linux/interrupt.h>4 p1 u3 `( C# E' H
  30. #include <asm/io.h>2 F* l: g0 n. ~. T" K- _- W7 b4 P
  31. #include <linux/moduleparam.h>
    0 v$ X! @5 r* M- i" q. G
  32. #include <linux/sysctl.h>; N$ A: c/ K5 A" g- |
  33. #include <linux/mm.h>
    ( G5 ^6 S+ `! O. M9 n  `
  34. #include <linux/dma-mapping.h>
    9 U+ N% j8 u! M+ q! `, V

  35. / ^5 s* t7 L5 V3 `: y
  36. #include <mach/memory.h>( Y8 H/ h" x0 }/ @
  37. #include <mach/hardware.h>$ g! }0 v" j8 j; `; L8 O
  38. #include <mach/irqs.h>; |3 r6 v" f$ H6 q
  39. #include <asm/hardware/edma.h>! z0 k# E  ^" k4 K6 ~/ I

  40. - d: i; N% v# T. P+ L2 @+ a% s6 S
  41. #undef EDMA3_DEBUG
    2 K+ B; h: m6 S( D5 D
  42. /*#define EDMA3_DEBUG*/0 K( J8 c% A7 C3 u' @

  43. 3 t/ \* f( a# G# T& Y% b
  44. #ifdef EDMA3_DEBUG! x& L! f; ]7 E, s2 Z$ Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 I0 Y) ~1 S- ~5 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& B3 `" `, f8 q+ I# G+ q# y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 a& d' Y; @1 ^# p6 U( \+ P0 i5 d
  48. #else. Y6 v& p+ z. F# h. k5 X! t
  49. #define DMA_PRINTK( x... )( y5 J( u1 ~" \% e3 p& e
  50. #define DMA_FN_IN2 h$ t+ t) Z8 ?" \% p% t9 D
  51. #define DMA_FN_OUT
    ' Q4 y+ ^6 W5 u; c
  52. #endif
    3 P( T% }# ]7 h1 L$ U8 C  p9 G' D
  53. ) c% }# g$ Q+ x% d0 r  U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * W* [! l% w' d* {( ^( F! r
  55. #define STATIC_SHIFT                3
    5 o' r8 ^2 h' b- E7 N8 |, k$ Y
  56. #define TCINTEN_SHIFT               207 @$ T+ W, u4 c3 F3 y% J& ?
  57. #define ITCINTEN_SHIFT              21$ t+ a5 h& B) z7 _
  58. #define TCCHEN_SHIFT                22* J) s$ E( L. z  x* G
  59. #define ITCCHEN_SHIFT               23
    - }9 [3 y- c6 y

  60. / f, Y7 F( I) T/ N' j
  61. static volatile int irqraised1 = 0;. ^. c2 N& `! u# b: o5 G% V) r
  62. static volatile int irqraised2 = 0;6 y; a2 u5 L- e' ^3 P( Z0 o

  63. 8 a: A1 c" g+ m' O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 _7 E1 u! m0 {+ Y6 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & U9 s2 U5 U1 t! Z% }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # _/ x; }% |3 J! d9 k& o
  67. " w0 C5 y' h  R3 b/ i
  68. dma_addr_t dmaphyssrc1 = 0;- Z9 s9 w& z1 k0 l3 _
  69. dma_addr_t dmaphyssrc2 = 0;. H+ T+ G& |2 G/ n
  70. dma_addr_t dmaphysdest1 = 0;% `( z) v0 v! t' a2 b0 V5 A8 j
  71. dma_addr_t dmaphysdest2 = 0;; h3 e$ F3 i% f) P0 i. ?

  72. 5 m  [  i/ h. L3 c! h: F* ^) _
  73. char *dmabufsrc1 = NULL;! f3 s% y# u# E, s5 [4 Q; F7 |
  74. char *dmabufsrc2 = NULL;
    2 ^" c4 u0 @5 v1 x: C1 ?
  75. char *dmabufdest1 = NULL;; h# S. P4 y+ F" u0 q* t
  76. char *dmabufdest2 = NULL;2 {: ~0 m" h3 d) b5 P+ ~* v* K9 e- D

  77. $ @0 i% {4 O4 Y2 g, X5 s) c
  78. static int acnt = 512;
    , V) {+ ~4 f8 w% V! m. \: \  [6 m
  79. static int bcnt = 8;/ E  X. n8 c. X2 ^
  80. static int ccnt = 8;1 E3 p. E* H: g5 p

  81. # {! h; k  ~8 ~/ j  A- I. x$ g* ]
  82. module_param(acnt, int, S_IRUGO);
    ) l3 |& t- r/ g& \/ o/ _7 m
  83. module_param(bcnt, int, S_IRUGO);
    3 j8 G. N! h) B# `* T8 F( e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 s6 N; g5 ]% J% c
' s) V1 v3 K( j9 E& f9 M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, Z& Q. g/ k- Q. F; G3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 g$ H! M, a' F8 ?- U( ~4 }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 `* `( _# T- D0 a& C
  F8 Z/ ^8 ^: A1 A1 r. ^8 A/ ?$ E
  I3 N6 g' p1 d# I: ]$ N; A6 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-31 19:20 , Processed in 0.037887 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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