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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 ]( `8 `3 [' n. r7 \# O1 G( A
  1. [code]EDMA sample test application# I6 {6 l2 l" p/ H3 P- |
  2. /*
    , K# \$ ?4 g5 U4 Z& J. z
  3. * edma_test.c
    ! E$ t; V. P- }
  4. *
    2 F, h. w+ |. F/ S# D2 C( p
  5. * brief  EDMA3 Test Application4 F; z% ~% @- y
  6. *# f3 Z+ d8 V) L8 O1 {
  7. *   This file contains EDMA3 Test code.; H* h# J/ G% p% t
  8. *
      G5 p" l# b3 r) m5 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 i& ]& d, G! ]  y- V  A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 ]7 K4 f/ _4 p
  11. *         TO CHANGE.3 o! X" k: v" _1 y6 _* b  N- q
  12. ** C& {3 d4 f# g2 A5 P  _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " h& b$ T% o4 `) q
  14. *& i( k9 Z( J4 g" {+ D( Q" B
  15. * This program is free software; you can redistribute it and/or
    ' n/ ^2 E- ~: j0 V+ {
  16. * modify it under the terms of the GNU General Public License as" L* T5 a0 V; k( S: F& z
  17. * published by the Free Software Foundation version 2.
    # ^5 P5 W0 W; T) W( s! R
  18. *, @8 _, I$ t% z" x. x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ ]8 e/ [1 N& H7 p  c4 ]
  20. * kind, whether express or implied; without even the implied warranty
    " u/ [- B  ~5 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" a6 J, ?% P" K. g
  22. * GNU General Public License for more details.* p( J9 z+ K4 S3 n
  23. */: s/ }3 A- v# n; Q( G  ^# q

  24. - I9 f) t7 t, J0 l
  25. #include <linux/module.h>3 B' `  P( S% j2 d/ d
  26. #include <linux/init.h>
    ; Q$ |+ p- Q5 B6 r' U( d
  27. #include <linux/errno.h>
    1 M. H9 R, D6 c- K. O* }! F
  28. #include <linux/types.h>1 M' t1 S8 U9 X
  29. #include <linux/interrupt.h>6 l0 {; h. l6 A; m
  30. #include <asm/io.h>5 e/ g# T' R. [( U1 S
  31. #include <linux/moduleparam.h>& c. v- \6 i) f8 a
  32. #include <linux/sysctl.h>+ B8 z8 V: a, \+ e% H
  33. #include <linux/mm.h>( \& t% m! W4 ]. K
  34. #include <linux/dma-mapping.h>+ \; ~/ B7 E' i7 a* a. e5 q' G

  35. ; a- P- W: S8 Q
  36. #include <mach/memory.h>: a6 Z* I- P$ G7 }$ U, t
  37. #include <mach/hardware.h>
    5 [- @0 d% g4 b% e0 T% k' X% {
  38. #include <mach/irqs.h>
    ' b: i$ G! W" A" G
  39. #include <asm/hardware/edma.h>! q; U: ^; c5 x' T8 |' _
  40. ' X) I/ s+ ?$ z6 H
  41. #undef EDMA3_DEBUG; Y+ ^' I7 O+ a6 e4 V
  42. /*#define EDMA3_DEBUG*/
    % s3 _: N  A) B* R6 o0 u

  43. . t: b! f  W  l9 |- t( v
  44. #ifdef EDMA3_DEBUG# r' ^. a3 j) ^' H% a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 W( Y/ a$ o. k! D6 c3 n9 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 p4 k( ]0 h& r8 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 }7 z- a# Q: S7 d2 q7 V5 F
  48. #else7 C& b3 H( G- [
  49. #define DMA_PRINTK( x... )
    ' f2 B: C4 A5 Q) l
  50. #define DMA_FN_IN7 V; n5 }. n0 o" T+ _8 V' [  |" P
  51. #define DMA_FN_OUT4 f. _9 S0 ^* g, ?* c
  52. #endif
    ' U* h6 g. H" O0 ]! C& {  V+ i) I

  53. 9 h! T8 H3 {& P9 X' n$ A; M: R+ S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " Z4 P9 z# r8 _7 z! y1 C+ a, o
  55. #define STATIC_SHIFT                3
    / U3 ]5 C0 K. |" O) B" B' x" R
  56. #define TCINTEN_SHIFT               20
    & `: A; M! I& l4 c! z9 g
  57. #define ITCINTEN_SHIFT              21
    + T- f# D* m4 E3 @
  58. #define TCCHEN_SHIFT                22
    ( [* L! p, A: T
  59. #define ITCCHEN_SHIFT               23
    2 ?, v7 n. N2 ?2 I' ~' g

  60. ; R2 o! P( P5 ~0 C& u* }# Q* W
  61. static volatile int irqraised1 = 0;+ Y* n# f6 p$ T: c, a: i3 i
  62. static volatile int irqraised2 = 0;
    4 A9 j: s3 v5 p7 t; g# u7 T

  63. 1 m" U. I( H5 \  S8 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % O0 r0 J. N3 c2 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 `' Y+ d- U' u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; V: M- Z. @$ A7 G6 ]9 v

  67. / A- }% Z: d& B) `/ y+ v2 ]. A
  68. dma_addr_t dmaphyssrc1 = 0;
    , s( y; n$ E/ s0 Z$ V6 Z
  69. dma_addr_t dmaphyssrc2 = 0;
    ; {* _) f' F* U* f
  70. dma_addr_t dmaphysdest1 = 0;& ^, U% C1 B8 W7 b1 _
  71. dma_addr_t dmaphysdest2 = 0;
    $ c+ a, I* d. |  \# \! m

  72. + x: m; m! V3 J1 h, r4 v4 }( T
  73. char *dmabufsrc1 = NULL;
    ' ~' e- ^# W1 B( C
  74. char *dmabufsrc2 = NULL;
    & N$ k0 `& J9 V' u7 P
  75. char *dmabufdest1 = NULL;6 m, R- Y% U" B7 b
  76. char *dmabufdest2 = NULL;8 _. q2 d# K- Y/ R
  77. 2 [- d) G* [" u# v/ M$ D
  78. static int acnt = 512;
    7 \( T( Z( {2 {0 n4 }/ ]6 p
  79. static int bcnt = 8;
    ; f0 H6 O1 }6 R& m) U% f( p
  80. static int ccnt = 8;, g$ j  @9 N# j# |' ]& z$ C8 A

  81. - q1 f$ F8 F. J9 r6 f4 l0 B% o
  82. module_param(acnt, int, S_IRUGO);
    ! p1 C8 K2 D! i) W1 C- e$ a. m! V
  83. module_param(bcnt, int, S_IRUGO);
    1 ]' a+ i! N& s; g) L7 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 d1 W4 s. R6 N* g) q" E  H& S/ T+ C- P+ ]4 W0 m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 n% o0 G: j. o+ \+ w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; }. |" C6 }& i# F( E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 K/ F, Q# _* Y! r& @0 X+ K! y9 N! b, S# T% p3 _& A
, F, @- _9 P1 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 23:39 , Processed in 0.038097 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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