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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ L% l5 L% V- z  O# Z
  1. [code]EDMA sample test application! I7 M3 p0 c% {
  2. /*. y. w6 \9 B4 N
  3. * edma_test.c5 R$ n- s& {5 T
  4. *: Q! F1 y+ S/ l: v3 C8 C( `  Y; i
  5. * brief  EDMA3 Test Application
    ' G( j7 s9 W& c7 Y  O$ Y
  6. *
    + m! i7 F3 E4 h# X/ w+ N4 `% s  [
  7. *   This file contains EDMA3 Test code.& v, k# q" K: D  r
  8. *
    ( l2 v3 |  J1 h3 U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' j, n" ~* x. d; P3 i: A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # P' _* N0 n7 \. }! B
  11. *         TO CHANGE.
    0 V9 N% E+ T5 H' S& V
  12. *
      s% D! u  m6 S, R9 b0 h0 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 K! w. m' a7 f, l# g0 c# X) q$ x
  14. *
    ) h1 I! Y9 n! ~. n
  15. * This program is free software; you can redistribute it and/or
    & M9 ?; {- s9 E6 V
  16. * modify it under the terms of the GNU General Public License as
    ( U" E  _0 T& R
  17. * published by the Free Software Foundation version 2., s; f3 o1 j. ?0 H  _' R
  18. *
    / e$ h# ]* @1 d$ N/ j) U- }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 r2 J7 m# X- U. j$ q9 [
  20. * kind, whether express or implied; without even the implied warranty
    6 k+ M" \% _/ J% i9 t2 k, w& O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . j* c0 p; Z. K! h0 f5 Z
  22. * GNU General Public License for more details.
    / i& e% @% P$ X8 i$ H, i5 s
  23. */1 d6 [' u' ^' R; H
  24. / Z, k, m( H2 X* `
  25. #include <linux/module.h>4 o( g8 y% P: S: b1 N# r; K/ B
  26. #include <linux/init.h>
    0 J$ Y& g% H. {% G5 B2 x1 B  q- a( ]
  27. #include <linux/errno.h>
    6 S! p6 E8 e! V( c5 {" l. P
  28. #include <linux/types.h>
    5 O/ j7 Q5 Q* `
  29. #include <linux/interrupt.h>& [% Y5 Y- u+ ~- Y
  30. #include <asm/io.h>' B2 v0 @+ P* y0 x2 e0 J
  31. #include <linux/moduleparam.h>0 G) u7 A8 x4 g8 w6 S
  32. #include <linux/sysctl.h>
      _. R. h7 ]! c* n/ \' d: @5 e
  33. #include <linux/mm.h>) Y1 U: H: X5 o" }$ N* k
  34. #include <linux/dma-mapping.h>; A+ p5 y4 f, i! E) y% c
  35. 2 i0 w0 @- E; d+ l' e
  36. #include <mach/memory.h>* F7 f) e/ b% E" ?- u# Y' p
  37. #include <mach/hardware.h>
    5 a4 D# y$ ]9 Y& @
  38. #include <mach/irqs.h>
    9 z" I" n6 _# M
  39. #include <asm/hardware/edma.h>
    ; Y2 K, W1 A% \5 d; ^* J) a$ b
  40. 9 Q6 E( p& W: {/ `2 m: S0 ~
  41. #undef EDMA3_DEBUG. K9 w( ?/ O1 z- }3 V
  42. /*#define EDMA3_DEBUG*/. ?3 [; V9 j9 b

  43. # Q; e# ]/ X9 J2 |# t9 X" I' |
  44. #ifdef EDMA3_DEBUG
    4 T6 C$ A: P0 t+ t/ B9 @1 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , |! J( F) @, c6 e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , B: S% ?$ e' q" d" b' `' L6 U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " ^- U+ S( |5 W, _# c% x+ Y
  48. #else
    8 ^% _4 a5 |! J- R8 m
  49. #define DMA_PRINTK( x... )
    3 \5 g7 a& ?+ Z; z& E1 k! y
  50. #define DMA_FN_IN
    ; H" H/ B, l0 R$ G4 |6 w# ?2 c
  51. #define DMA_FN_OUT
    : e6 y) P* o3 q2 L3 l! K: c
  52. #endif9 Z# ~5 u. a/ w( ~

  53.   R& W5 y; y# T& Y6 W! |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - L- ~6 n. Z4 q2 ]/ N
  55. #define STATIC_SHIFT                3
    " R9 i- U* `: e
  56. #define TCINTEN_SHIFT               20; H+ y4 M& y8 s  z+ t
  57. #define ITCINTEN_SHIFT              21
    * q6 ?( n+ L3 B" e  E, l" N- x
  58. #define TCCHEN_SHIFT                22
    " r! [  f5 E2 [  |  F
  59. #define ITCCHEN_SHIFT               23
    3 I) p% X1 G) F2 e1 ?

  60. ' N& f* S/ N- v( m4 d
  61. static volatile int irqraised1 = 0;" g& e2 z3 t: ~) U3 Y/ ~5 j  [- i
  62. static volatile int irqraised2 = 0;
    4 ?! g( D3 c, [, s$ k8 D
  63. 0 O/ ?$ H% `* m: s' G2 p9 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. s. m- }" N# g, o: ?8 g( C( q# k9 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ^' J+ n, \/ A4 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Z0 g" [' V7 Q0 G' s0 d) Y
  67. 9 l8 b7 C# b6 J# N+ v7 f
  68. dma_addr_t dmaphyssrc1 = 0;5 U. {  p- X# r" N
  69. dma_addr_t dmaphyssrc2 = 0;
      p: o3 i2 d* f
  70. dma_addr_t dmaphysdest1 = 0;
    " s3 V$ ^# A+ L/ i
  71. dma_addr_t dmaphysdest2 = 0;# R# m- |( ?/ `- d& u
  72. + O' U  s" A+ ]1 c# _
  73. char *dmabufsrc1 = NULL;4 x  q, w) P, y: t
  74. char *dmabufsrc2 = NULL;# K1 y) j+ D6 k7 {) V1 e& W
  75. char *dmabufdest1 = NULL;9 R. d% R( |! x. \$ t
  76. char *dmabufdest2 = NULL;$ i8 P. t2 |7 J  N$ Y

  77. ( F0 e0 L& j# d  g  g( @2 k
  78. static int acnt = 512;. B7 |& U! p7 n# Y: G
  79. static int bcnt = 8;. _, W. `# N! j* b/ D0 N1 b; [8 U
  80. static int ccnt = 8;
    # M$ ?4 c; f' n. Z0 F: j- f
  81. & x* C5 B# y7 b: D
  82. module_param(acnt, int, S_IRUGO);
    3 X) w6 ?( p9 n" G  H% z( r% d
  83. module_param(bcnt, int, S_IRUGO);: M; j+ c$ V7 W: \  B8 ~7 g: y' W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( O$ C6 c5 ^; y5 e/ A' ^. ^- m
$ S$ m3 }. p& Q, K# O+ n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  z8 }6 }4 d% Y3 ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 G# V1 c% J0 c! c  z" O7 U( X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ U* t1 [5 S& F2 z- \. [
" [' w$ u" d: h1 M4 E2 F

* L8 l5 m( w$ Y! F8 X8 `1 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-17 03:19 , Processed in 0.038684 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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