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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 W% ^. T0 k& v
  1. [code]EDMA sample test application
    - D2 I7 W: V( c) s0 K
  2. /*& v- I- h: [+ p3 C1 r, T
  3. * edma_test.c
    - `$ ?2 ?* b0 z9 H+ _( X# I' q
  4. *
    & }3 ]+ G9 E/ O: T
  5. * brief  EDMA3 Test Application  T% u8 c: _( x) M: f% c& D
  6. *) E1 E. h1 F9 ]* d( O
  7. *   This file contains EDMA3 Test code.$ w( b2 @& m  A. O+ u$ H7 }5 B
  8. *' f& P1 j( w. x9 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 \- L1 \' A- {0 ?7 P0 D8 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . S0 [8 _% A8 w% ?9 Q2 I- K
  11. *         TO CHANGE.
    ' ^: B8 p0 `( R: W7 i+ U2 a2 e
  12. *
    + i  g, _) L" z0 }& Q4 c8 I& R# f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % _# l. m9 F7 s1 k% J; ^
  14. *( B; v: [5 I3 k/ s5 w1 ?4 E
  15. * This program is free software; you can redistribute it and/or  R' v  Z9 C& U8 [+ x+ U1 Y
  16. * modify it under the terms of the GNU General Public License as
    ! m1 V; d9 U1 E2 f3 m! Y
  17. * published by the Free Software Foundation version 2.
    + M+ m% k  O" y: a, e
  18. *  b7 X* d( A! ?& L' c# X! M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( ?4 {4 u. |5 N6 x+ K
  20. * kind, whether express or implied; without even the implied warranty
    6 C' l& p8 z  }) x# \- e0 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / N, Q. N+ C. y3 I+ w& s1 ]0 r2 J" B
  22. * GNU General Public License for more details.3 Y* w/ u# |9 z5 o
  23. */* e, O- ~/ i4 X  |; B
  24. ) J/ w3 W0 v6 W3 u) L0 B2 z! K  v
  25. #include <linux/module.h>: c1 w1 ?; V# K) [/ \/ }
  26. #include <linux/init.h>
    0 l7 c$ w/ p, S& B! X8 a7 l0 F
  27. #include <linux/errno.h>) k( ?0 w- e" _4 @- V* r
  28. #include <linux/types.h>, S, h, ~4 Z/ X. v1 z! o
  29. #include <linux/interrupt.h>1 D+ D8 H+ l9 F. ]4 J3 [) h: z6 L
  30. #include <asm/io.h>
    , o! M. `# D& b  T- I
  31. #include <linux/moduleparam.h>
    $ a  T* z: |. F* x# H2 I8 d
  32. #include <linux/sysctl.h>
    5 x% O) Y2 e* j8 i! Q+ d
  33. #include <linux/mm.h>% r. M( U# a& \5 T5 z8 ~
  34. #include <linux/dma-mapping.h>
    . k: Y0 J* K; L, `! t! a3 ^- V
  35. + F1 X, o* W9 U3 w; s' Q% t5 C$ k
  36. #include <mach/memory.h>8 y. |. e5 a9 S; U" G
  37. #include <mach/hardware.h>. ]  N, [5 D3 e' x" X0 P& @5 R
  38. #include <mach/irqs.h>
    ! ^9 d- j1 y. M4 c4 b" r( W
  39. #include <asm/hardware/edma.h>6 ?8 L; t$ n5 W( d) i- q& q
  40. ; [" t& n& s/ s0 u7 b/ }5 ]
  41. #undef EDMA3_DEBUG6 [3 b, ~* P- U" g5 N' i  f3 x2 M0 Q
  42. /*#define EDMA3_DEBUG*/
    6 |9 c7 {6 r, l- E
  43. 2 F# ?% j2 d$ b7 Q6 n2 V; g; `: T
  44. #ifdef EDMA3_DEBUG
    4 R+ s/ y! e9 \8 I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), P+ ~& q" L' M2 a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! H: K: S6 z3 _# p# R! U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 i6 h" ^1 H3 O0 P- m$ G' @( b
  48. #else
    / l) U" x, E2 M1 k
  49. #define DMA_PRINTK( x... )) C! b" k/ _' A7 z6 G3 s' K
  50. #define DMA_FN_IN1 D* f8 ~4 v- d  Y" \3 V0 q
  51. #define DMA_FN_OUT
    / T9 s" }: G7 y4 W0 h
  52. #endif$ h- X% N2 s% b% }
  53. : j5 B7 c& F  e0 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* L5 B; \+ y. y
  55. #define STATIC_SHIFT                30 {2 V1 I6 ]6 e4 C% ?0 g
  56. #define TCINTEN_SHIFT               20
    0 p9 C$ {$ M8 X, J
  57. #define ITCINTEN_SHIFT              211 ]5 a% g& x5 u' J8 |! @1 R( f
  58. #define TCCHEN_SHIFT                22+ j9 s% m5 E4 [  x
  59. #define ITCCHEN_SHIFT               23
    # i. k: ~3 ]# v) R, _0 y4 \

  60. 8 M8 R8 d0 p1 h  H2 L( i
  61. static volatile int irqraised1 = 0;
    $ I. p6 W" [; h( l
  62. static volatile int irqraised2 = 0;( w+ o: o/ K; ~( @1 r& I

  63. " c! K+ O/ d! _' |2 g9 L0 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , A3 y5 m( Y8 N  n) l" M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Y" p6 F  v6 ~; E$ q! O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) N+ S$ s7 e7 [( L4 B: G  }

  67. ) o( e2 y5 R5 @# V
  68. dma_addr_t dmaphyssrc1 = 0;
    & a1 Y& p. l) T9 w0 R
  69. dma_addr_t dmaphyssrc2 = 0;
    6 Y/ ]+ |2 _5 n/ K% v/ e
  70. dma_addr_t dmaphysdest1 = 0;+ q2 f( f/ c# ]: g  D
  71. dma_addr_t dmaphysdest2 = 0;' z5 e3 R5 T" Y2 V% S

  72. " T: r3 y1 `4 j6 ], d/ K
  73. char *dmabufsrc1 = NULL;+ d* Y- D* H5 @% _) D0 _
  74. char *dmabufsrc2 = NULL;2 X* e- A; o) x6 R
  75. char *dmabufdest1 = NULL;
    : N, N# Y$ ~/ D. G8 H
  76. char *dmabufdest2 = NULL;" k& w% X' |, o0 }4 L

  77. 3 G+ B4 R5 K# N; \
  78. static int acnt = 512;
    * E  p; H7 i3 F2 Z
  79. static int bcnt = 8;9 b4 b7 n. E. P0 Q) n  f6 @/ E
  80. static int ccnt = 8;
    5 X" [: s- }0 ?" e0 }0 ^
  81. " w5 `+ T+ b1 x7 i
  82. module_param(acnt, int, S_IRUGO);$ _' b! L% e0 w- S
  83. module_param(bcnt, int, S_IRUGO);$ z0 j3 J% w# z7 O: F/ Y/ `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 Y0 m. ~/ D- d$ ?0 ]3 D/ T' k6 N
$ s( x+ A9 S" r4 f1 k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% V/ [7 L/ ?/ h* e- B1 q6 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ |$ n  E+ X  o# e  g# l2 l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 v' V3 R& p1 o( w! g; S9 u( d
" X0 s1 L: q( l( n2 g' j5 b7 e5 @& P

; Z- v7 B1 l9 \" ~# P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 23:47 , Processed in 0.039800 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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