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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. l( Z6 {. a8 o- |7 F
  1. [code]EDMA sample test application" }! W) c0 j  @. ^# _
  2. /*
    ! k8 D! s5 i7 W' A
  3. * edma_test.c
    5 x! h/ P( m3 r
  4. *: }7 h1 X$ i/ [+ m& R
  5. * brief  EDMA3 Test Application
    ) L) ^" W& g8 U
  6. *
    9 R2 L9 O) l* f+ n4 b- r) i3 v
  7. *   This file contains EDMA3 Test code.0 U- M& p8 ]& j8 B
  8. *: i2 s! u+ _$ x3 f+ Y0 x$ U! f& i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 k5 C- f; @  R% p! c# _9 b2 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 b2 y! u8 o& s: `- \' ]# d$ M5 W4 G
  11. *         TO CHANGE.
    8 y/ M. f5 S, [' Q$ c" M* c
  12. *- j; ]( F+ _* t) M6 y- T: Y1 q+ z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% Y" e% x* `; j" ]/ }
  14. *& t& ]) U: \( K; _
  15. * This program is free software; you can redistribute it and/or
    * E- k3 o5 z2 x# ?9 G
  16. * modify it under the terms of the GNU General Public License as
    : g+ ?; g6 }, a! A# L
  17. * published by the Free Software Foundation version 2.
    9 R) I9 f" Z) r- w3 i
  18. *
    9 z/ o# g! u8 ~1 C% o8 D5 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 E6 C6 e" p, O( q
  20. * kind, whether express or implied; without even the implied warranty
    + ?' Z5 M! {, M4 o, t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . ]3 F( H+ Y  v" J) U
  22. * GNU General Public License for more details.
    % p' C# C) R6 R. w$ ]' `
  23. */
    1 T  a- O/ O& u( D9 s* [6 G
  24. 9 D! L( b; ~& U, K: H4 F" G
  25. #include <linux/module.h>
    # @0 ?* I; l: m  d
  26. #include <linux/init.h>; R" `  ~7 Q9 @( j  @( p
  27. #include <linux/errno.h>+ I3 x1 `: q: }3 W
  28. #include <linux/types.h>' Y+ Z# G+ n1 J" @; ~. L
  29. #include <linux/interrupt.h>
    , u6 ~! T$ q/ w6 s1 K/ f# O1 p) f
  30. #include <asm/io.h>1 X5 Z0 k8 Y$ L: T. b2 }5 O
  31. #include <linux/moduleparam.h>
    6 S9 A2 g$ d. K
  32. #include <linux/sysctl.h>0 N7 C5 `- D/ f% z- R2 x! ]
  33. #include <linux/mm.h>& D8 T# b: Q9 F# i* E3 \
  34. #include <linux/dma-mapping.h>/ ~* l' S/ a& p& r9 n9 `
  35. : H9 k. m7 b/ x
  36. #include <mach/memory.h>
    - h7 `7 S% C9 |. e! U. z
  37. #include <mach/hardware.h># w( I' H7 x$ R: E4 y7 C! d
  38. #include <mach/irqs.h>1 J' h: a& Q4 d& b: b! V3 k
  39. #include <asm/hardware/edma.h>
    * l5 g/ C) Q, ^
  40. : |5 s' o/ I- f$ k- b2 A
  41. #undef EDMA3_DEBUG
    + \5 ?; N/ H+ M9 @% ^6 T6 ?
  42. /*#define EDMA3_DEBUG*/1 h5 c  {" ~* t4 v7 E0 Y

  43. 5 Q: ]5 m! _& n/ b
  44. #ifdef EDMA3_DEBUG, C4 ~% {+ ]- ?" R& ?; o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& q6 h& n  d9 `8 V2 i3 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ q: G9 {+ t6 A' Z2 n9 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : z! J) e1 A; U+ [) z2 U
  48. #else4 U* k5 x) d' A4 ]5 O6 b% t
  49. #define DMA_PRINTK( x... )
    ! w6 A3 L% M- S2 _+ t  P
  50. #define DMA_FN_IN
    + x; B+ N: T  Q, U1 I
  51. #define DMA_FN_OUT8 P8 k& L" Y" T. Q$ f+ K7 O& a- {, G
  52. #endif
    3 U, ~& R2 S. @7 B* u) U

  53. / n" g& f& ~$ p$ z, a5 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): i1 R- K9 r) Q8 Y) B9 u# ^
  55. #define STATIC_SHIFT                34 t9 ]8 _; o+ c( H( T5 j
  56. #define TCINTEN_SHIFT               20
    ! @' [6 @. ~/ V' @# f5 l. @- l" t
  57. #define ITCINTEN_SHIFT              21
    + c; H. e* h- {) m
  58. #define TCCHEN_SHIFT                22) o" |- V" W1 h) q6 I
  59. #define ITCCHEN_SHIFT               23
    8 L* G/ H; u8 s4 o) b) f" ^( P  u6 K

  60. 9 R9 ?1 S4 A1 i( n6 ]
  61. static volatile int irqraised1 = 0;" Q' _# ]! [& d; }  a
  62. static volatile int irqraised2 = 0;
    6 s8 S1 N$ A" L2 c

  63. % ~% I" }! X) I0 g, p0 |3 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) P/ |5 c' J6 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) \* p9 i8 c5 K% {. v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 _* V' ]# e8 Z6 K

  67. 4 H* [+ o: {7 s7 s4 s* e/ y) `
  68. dma_addr_t dmaphyssrc1 = 0;
    * j+ H! M+ c- s( _( E
  69. dma_addr_t dmaphyssrc2 = 0;% [7 |9 q6 ]9 c1 _. s% c/ Z
  70. dma_addr_t dmaphysdest1 = 0;
    ' {2 G6 @- j8 N5 K% _
  71. dma_addr_t dmaphysdest2 = 0;. X3 ]2 ?! n4 f& H3 |. g0 S

  72. 2 U$ |8 ^4 m6 V( t
  73. char *dmabufsrc1 = NULL;3 c8 g' d0 k( m. u3 P. K: G
  74. char *dmabufsrc2 = NULL;
    / ]3 K3 m0 q( G  i) T3 c  b
  75. char *dmabufdest1 = NULL;* X9 V( j/ _* J2 v0 V
  76. char *dmabufdest2 = NULL;) }9 P# `. }3 }
  77. 6 ~3 V' C" {- W* z/ W& d- O
  78. static int acnt = 512;
    5 K+ ]7 _/ u. e6 U* n1 s/ n( f
  79. static int bcnt = 8;
    1 T7 H( c6 W" J- f6 I
  80. static int ccnt = 8;
    6 |; k6 r+ a3 g6 E

  81. 0 u* J  P7 ?, {0 n  t/ B
  82. module_param(acnt, int, S_IRUGO);
    ' Y- ~3 M! W! l& Z3 W
  83. module_param(bcnt, int, S_IRUGO);- ^" S+ A0 I6 b9 O- p& F. G! Z; }
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% g% W9 X5 c" Z1 s* E: G) }
* J; m& Z4 r, W( x) ~0 \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 ^4 h+ t! ]* p& x, T8 f( g/ P3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% Z8 d) r6 U/ b+ [: r( I" J" f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 H, i! c2 Z. G( ^7 N7 K# E
' y1 ]* n! x) s: _$ k6 T. S$ L% ?( K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-1 00:01 , Processed in 0.039626 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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