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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , w+ n6 R5 e+ M9 m' {
  1. [code]EDMA sample test application+ N- I7 Q$ @9 ~0 A+ ^1 C
  2. /*
    / ^& M0 O7 u$ f- \! Y
  3. * edma_test.c1 u- f6 {0 |4 [' m
  4. *
    ! K9 e6 u7 [0 x' j4 ~
  5. * brief  EDMA3 Test Application1 M. z" [/ Y, B" {! ^% V
  6. *3 y$ i+ E" c* Q* Q# Y
  7. *   This file contains EDMA3 Test code.
    7 P( c/ D( e$ Q3 P6 d
  8. *
    , I/ F2 i8 M1 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , l1 j: T1 e% X% Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 g9 B( y3 a; {! \  R: z
  11. *         TO CHANGE.
    9 b! ~% G; {, q
  12. ** l9 E1 A3 r1 u( F1 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" ?+ C+ O/ Z1 P/ M
  14. *) S; X; }$ z. Y( e* ]7 j/ g' A
  15. * This program is free software; you can redistribute it and/or
    : m0 {; m( l: J1 [, t
  16. * modify it under the terms of the GNU General Public License as5 j( J6 Z8 G% q
  17. * published by the Free Software Foundation version 2.$ I' T* g) u" ^. `
  18. *
    * r' t% q5 D/ l! c( w" n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" }4 w8 T' P/ s( N4 k
  20. * kind, whether express or implied; without even the implied warranty
    9 D/ C; R7 h8 a. p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" Y1 W+ v& ]0 H3 Z# e
  22. * GNU General Public License for more details.  T6 J$ m' H+ P! x
  23. */0 W* w& M$ E; b( m
  24. ( C  \+ q# ?" H. R. ~; f& {3 ~
  25. #include <linux/module.h>& |+ {- d2 n6 t" ~6 d; b1 a
  26. #include <linux/init.h>0 ~) o7 q5 ^7 s- p7 i% }3 D
  27. #include <linux/errno.h>
    " F: ^( i. b5 H6 ^2 U1 S1 [' O
  28. #include <linux/types.h>4 M- F% j6 b) K1 }
  29. #include <linux/interrupt.h>
    ' B: W; X  w7 p+ ^5 ?4 f
  30. #include <asm/io.h># f% [- R  Q7 T9 M
  31. #include <linux/moduleparam.h>4 }( E1 `' i( |8 f0 b
  32. #include <linux/sysctl.h>
    + c2 v; G* C4 t+ e2 o* q
  33. #include <linux/mm.h>3 [" i$ u& o$ p; H3 R7 R- m
  34. #include <linux/dma-mapping.h>
    ! f% d- D" V. X2 N! Q' C/ _
  35. 9 ~# w3 q; v* s# t, k, F2 k# a
  36. #include <mach/memory.h>
    ) y  p, C# v7 X% s0 Y
  37. #include <mach/hardware.h>
    $ B7 W) |/ c, q$ P2 I! n
  38. #include <mach/irqs.h>
    7 O7 B( m4 X2 W5 H9 X# ?, c
  39. #include <asm/hardware/edma.h>
    ; ]+ c* |8 R5 p3 y  f# p
  40. - }! k  v2 ]& }! V
  41. #undef EDMA3_DEBUG$ n+ H9 k) Q4 [1 S
  42. /*#define EDMA3_DEBUG*/
    6 t' A3 n4 T, p, F
  43. ! y7 _$ D' U& i. o3 W
  44. #ifdef EDMA3_DEBUG
    ! n% _3 I  i: q; g9 d6 S" K. a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 R- A' b0 j" X/ F5 ?7 \& k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" B, {1 T/ y+ F  I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 [, J7 v) l  T3 Q* d, `) Z5 v
  48. #else" ?4 P( O  G% @/ b+ @9 ?
  49. #define DMA_PRINTK( x... )
    ) F% S8 b9 u" d0 K
  50. #define DMA_FN_IN! a9 W# u+ V5 w' s! K
  51. #define DMA_FN_OUT
    : X/ w& A4 ~+ O; w9 j5 M  j
  52. #endif& @* ]2 a0 I8 m. m

  53. ) J0 b. Z) g) x0 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& x1 Q6 Q, V7 N- A) J
  55. #define STATIC_SHIFT                39 d* G" C2 b* ?. ?; n
  56. #define TCINTEN_SHIFT               20! P$ x; w  f% ~6 T
  57. #define ITCINTEN_SHIFT              21, s3 t1 a& Q- W6 h& p7 H
  58. #define TCCHEN_SHIFT                22
    " Q: s) K  h7 Y. `2 ~$ p, F
  59. #define ITCCHEN_SHIFT               23
    $ d' u" m; y8 q" P) E/ B

  60. : N7 Z0 C% ^# C( h" b; R
  61. static volatile int irqraised1 = 0;
    / U4 |- U5 J0 A' M3 e4 c, i. i
  62. static volatile int irqraised2 = 0;) D' ?5 w2 N3 h( V2 R6 Y4 T

  63. & C0 M$ S( t* E, T: [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 z* D5 G, J. @/ {$ y9 L- [9 j" I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 J" u$ J1 o5 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + _! a7 k6 D  E
  67. ) j9 e, J% i+ \1 w
  68. dma_addr_t dmaphyssrc1 = 0;; ]% T+ Z* T3 t- p" l
  69. dma_addr_t dmaphyssrc2 = 0;
    7 e6 w8 N" E+ ~3 G% a; y) i% p: D
  70. dma_addr_t dmaphysdest1 = 0;) C# J3 P5 l9 {0 f! I/ M+ k; |; }
  71. dma_addr_t dmaphysdest2 = 0;) T" T3 d1 W% Q. d' A1 |; X

  72. 8 ]6 Z3 x/ _" J$ M! `. ^) a3 o3 Y
  73. char *dmabufsrc1 = NULL;
    $ L1 e9 W4 [; Q
  74. char *dmabufsrc2 = NULL;
    " k4 _9 ]0 Y' Q/ @8 J
  75. char *dmabufdest1 = NULL;% M% `( p2 K; S2 g8 F
  76. char *dmabufdest2 = NULL;$ J$ i: y8 h1 N

  77. & m/ T! e7 [1 z, O
  78. static int acnt = 512;2 c; {6 W- ?( s0 S( X
  79. static int bcnt = 8;
    + B" G. i! j4 V. {& \. j' I
  80. static int ccnt = 8;
    + H: u  d, Y. h( h+ v
  81. 2 o% L8 f+ D/ R8 W' _
  82. module_param(acnt, int, S_IRUGO);
    + ?* d! z2 Q* `5 L2 h& [
  83. module_param(bcnt, int, S_IRUGO);: ~/ `+ c* k) a) n9 F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 L) r8 r) G' ^: S7 v+ O: L. R8 r0 X3 o9 {, k7 A2 n' d( P- F/ {% G7 h5 d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# w) ]- T# c, V7 w6 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' C0 m3 r* o3 K! |, R4 z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; `) H- ?$ K" S- ]

; B$ |- z, `; F; w) g& R& i, n5 p1 W# R$ C6 Z$ n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-13 20:54 , Processed in 0.037759 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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