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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " m6 A- j) o% N" P" K1 `
  1. [code]EDMA sample test application
    & H- n: R: B1 c: n! M6 ?" `
  2. /*1 U0 ]8 ]: D0 R9 Y" _
  3. * edma_test.c( O9 I( ?3 h% g+ H
  4. *
      d7 |; u" W1 J* j: E$ A, s
  5. * brief  EDMA3 Test Application
    & R( ~# u! |/ m! D: D4 w1 X
  6. *
    0 C/ D' ^- D7 Q! P0 B
  7. *   This file contains EDMA3 Test code.
    ! E& P& q1 I! [: {1 R; u
  8. *
    6 N8 \6 {! _) L$ x( ]* U1 h# Y" r) L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 e$ t0 m. T7 M& u( E, k& }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 h- z: d8 v$ B, |$ U/ U
  11. *         TO CHANGE.
    1 [6 |! @# Q7 l! P4 \  S: L
  12. *6 {* k( q% G! [: t; i; U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" p5 U' y, z; X/ [' X0 C
  14. *
    ) s# N" H: n- n5 v9 a, m* P4 }
  15. * This program is free software; you can redistribute it and/or. `, X, g, v1 @9 J) I1 A% l: S9 @% Q
  16. * modify it under the terms of the GNU General Public License as0 V" }  f  F( Z# r2 q& V
  17. * published by the Free Software Foundation version 2.; I& v1 C5 O- ?1 F+ E
  18. *% |6 d  r; j! m! Y% K" c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; F: x/ v' l4 H5 V; ^+ W5 `/ l/ R
  20. * kind, whether express or implied; without even the implied warranty, f+ w' i' L# s4 Q: q4 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / ~( ~7 u. x" T0 o5 f1 O
  22. * GNU General Public License for more details.
    7 n* @1 t* E; t, h9 z
  23. */, G2 \5 j: c* x2 y; }3 O

  24. # E9 V. `3 S! e4 Q# d' d6 t
  25. #include <linux/module.h>
    4 C+ @( P% ]4 U6 w
  26. #include <linux/init.h>
    8 F1 j0 }+ k! \) B
  27. #include <linux/errno.h>
      y; h$ n3 K& J
  28. #include <linux/types.h>
    " i, C8 p- D8 c4 u( _! t
  29. #include <linux/interrupt.h>
      ]/ }! @! \, P! M& N
  30. #include <asm/io.h>
    5 _! j5 U6 L8 E
  31. #include <linux/moduleparam.h>- O2 E. v5 d4 _$ C( p
  32. #include <linux/sysctl.h>
    ; i9 w1 q) u) |' x* N
  33. #include <linux/mm.h>: w: }4 y; n9 U/ r
  34. #include <linux/dma-mapping.h>5 I5 }* X( R0 S% l/ b
  35. $ Q% j/ ?- H8 H/ J& `( H( i- }
  36. #include <mach/memory.h>
    + m. R/ L$ b; K& `; x3 a& p
  37. #include <mach/hardware.h>
    : F+ E" z" i' t
  38. #include <mach/irqs.h>% f5 Q5 ~% r- M. x8 j0 N) w
  39. #include <asm/hardware/edma.h>
    , P- ~( P5 \6 _# A
  40. % p, E& U+ y6 a" T, R
  41. #undef EDMA3_DEBUG
    # D% L/ h8 p$ V7 M
  42. /*#define EDMA3_DEBUG*/% d+ b3 X0 `" c5 s" j  P

  43. 0 _7 f* _0 E% J0 R4 S( R# G
  44. #ifdef EDMA3_DEBUG
    4 _% c0 R$ J. G% P$ R/ X+ o# v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & |' A7 K9 ^3 Z$ j& t  d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , X6 y, G# h$ `+ d2 O. h* ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), a+ @# D$ _! e5 N! d5 J  a
  48. #else
    9 h# a6 G9 t, Y: n
  49. #define DMA_PRINTK( x... ). k% k' Q+ y  Q  D
  50. #define DMA_FN_IN# z/ h4 c1 T" E3 @) u8 J0 z
  51. #define DMA_FN_OUT
    & R- u: Q) c1 h) M" \
  52. #endif
    8 e8 O: d' B' ~; K  O) X
  53. + D  D$ M7 _5 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  z7 ~3 @& z) U3 L
  55. #define STATIC_SHIFT                3
    ' y* Y+ _" A9 x* I5 e4 ]
  56. #define TCINTEN_SHIFT               20
    0 K# Y3 u; I% S( ?" a0 l
  57. #define ITCINTEN_SHIFT              21' ]4 R! Y3 C6 z
  58. #define TCCHEN_SHIFT                22  b. s6 p3 ?# v0 {: H; f$ }
  59. #define ITCCHEN_SHIFT               23
    ! s) W6 y6 |- Z; v

  60. ; }# P; ?/ Z% V
  61. static volatile int irqraised1 = 0;/ m2 @* W* Q- r& L( t; ]6 i) P
  62. static volatile int irqraised2 = 0;9 b% O2 C- U* i
  63. 1 N% L' z9 w2 c$ i6 D4 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ w3 M2 ^: F, c/ b8 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : R' T" O. N- S5 C  A; T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 I( n/ v# o2 k0 n; t7 {6 \9 m- [

  67. " {* w1 e3 v1 j/ z
  68. dma_addr_t dmaphyssrc1 = 0;/ d0 k( `' G. P; F, O: ?
  69. dma_addr_t dmaphyssrc2 = 0;
      j5 a4 d: N+ A3 S
  70. dma_addr_t dmaphysdest1 = 0;
    : u# y. _8 S4 I3 q# \
  71. dma_addr_t dmaphysdest2 = 0;
    8 W6 N4 c1 L- n# h+ c7 E

  72. ! S3 i5 ^  u0 Z9 {) K. ^
  73. char *dmabufsrc1 = NULL;
    4 \- P, s) h  Z) V0 t
  74. char *dmabufsrc2 = NULL;
    7 [1 g# r1 [  Q) Y
  75. char *dmabufdest1 = NULL;
    / B3 w$ H3 t, n6 g* G0 S
  76. char *dmabufdest2 = NULL;  d7 M9 ]8 u7 s6 s/ y% e" _5 Y
  77. % O2 E1 B' W  Q
  78. static int acnt = 512;
    4 Y( y6 C6 a& N! g. v
  79. static int bcnt = 8;
    $ S5 |" C- ?: t( w! r
  80. static int ccnt = 8;
    2 o: E) a+ n6 V4 i4 m& H

  81. * @. y% z! T1 U
  82. module_param(acnt, int, S_IRUGO);2 N. c) `/ N4 X* ]0 }. H
  83. module_param(bcnt, int, S_IRUGO);
    . {5 w- W* H* m: p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 H& Y$ _( Y7 Y/ C9 K' X2 P) ]7 y; Q! \9 P0 c  g( V* q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, `+ k3 U% U- k' darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& t8 c/ j( u5 p" p5 w2 T, Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ A; n  k' r- F: X5 z3 P  s3 x; ~/ @: ^3 V& v9 c, E/ f' P
; e. B1 q: K7 T+ h4 G, ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 00:57 , Processed in 0.040635 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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