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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) `/ ]+ h! K- ~" k9 o
  1. [code]EDMA sample test application
    5 P5 N/ T! U, H. f, [
  2. /*
    $ c: O: Z- R' K1 {# b9 l$ z
  3. * edma_test.c8 _6 _2 L* g) ^3 d
  4. *  w% ~, M  c% o2 w9 G) V
  5. * brief  EDMA3 Test Application
    & b1 s% I5 X) \: I- ?
  6. *& x( m* w" E% r3 V/ w$ a& D. O
  7. *   This file contains EDMA3 Test code.
    5 a6 Q; ?1 b$ h2 y
  8. *1 W9 n0 S* [3 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 [4 z! L+ U6 w' b& s" B6 Q7 F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 ?; W6 A* K1 V% Y/ H3 W- I
  11. *         TO CHANGE.2 }; v  N7 F; r$ B
  12. *
    ' c& a- U- i0 h2 [5 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 {" E: g3 `. u  E( L
  14. ** h' }# S8 S! [$ b& ]
  15. * This program is free software; you can redistribute it and/or
    7 Q7 W8 G2 v" H+ e! [
  16. * modify it under the terms of the GNU General Public License as
    * w) e5 V& L: {* W  F
  17. * published by the Free Software Foundation version 2.
    6 K% H, e' \' S8 a' S" \% q9 N( ~$ T
  18. *, M3 k5 a* Y# J2 @; {+ |0 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 A% a- Q$ D. g5 v. _5 x
  20. * kind, whether express or implied; without even the implied warranty
    $ b" M# a; ]+ O/ a! {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 U8 b4 c+ C/ W
  22. * GNU General Public License for more details.% c( X0 i* i! O& |& `5 t
  23. */
    ' _4 T1 z! T" j0 {6 m( Z" q3 {6 Z) i
  24. 1 a: q! G/ Z: y7 X+ H
  25. #include <linux/module.h>8 C- E$ T4 V1 ], Z2 w7 Y, i5 C7 B
  26. #include <linux/init.h>( }$ V; P2 I' ]- P; Q7 ]4 {
  27. #include <linux/errno.h>
    8 L4 s. g9 R) Z/ T/ y0 O
  28. #include <linux/types.h>
    % ]1 c" d7 S" W% H* K! l- q
  29. #include <linux/interrupt.h>
    ( U# Z: F: _' |, a
  30. #include <asm/io.h>
    1 g0 X* |- E9 w
  31. #include <linux/moduleparam.h>
    # \0 P# g2 V; J& E
  32. #include <linux/sysctl.h>
    7 b4 |- t" ~% |+ j! O5 q5 v4 @- K
  33. #include <linux/mm.h>
    : J1 ~7 z8 o( Z$ c# f  ?# H
  34. #include <linux/dma-mapping.h>3 ?: }4 k* n# G# g8 M
  35. 6 O9 D) r- l* o' ]; M
  36. #include <mach/memory.h>6 d- @1 S5 }; N/ g& R# a
  37. #include <mach/hardware.h>
    7 i( Q  K# U! P' h, A" j5 F3 Y
  38. #include <mach/irqs.h>
    8 v$ k6 y0 g' c- t/ N4 \
  39. #include <asm/hardware/edma.h>
    " X5 E: {9 x3 U2 Y
  40. 5 @0 y2 c' ^5 b
  41. #undef EDMA3_DEBUG7 N' `7 ?3 y3 P
  42. /*#define EDMA3_DEBUG*/
    6 D% B! c( S! A! Q% K

  43. + P. J( Z  x* q# F
  44. #ifdef EDMA3_DEBUG; B7 \9 ]3 e, n7 Y) V9 V6 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! |' k% Z$ M0 @& D2 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& e3 g  `7 ]5 N# ^$ B# f( o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- h, ?* U; h$ r4 w- m
  48. #else
    & e+ A/ y' @  f5 S$ W
  49. #define DMA_PRINTK( x... )
    0 O4 w+ N! M0 O) S- N8 ?* d- b
  50. #define DMA_FN_IN! L) f) P6 _. _! z
  51. #define DMA_FN_OUT
    , c/ C. k, a% W$ P  v6 R
  52. #endif+ D# J7 N4 T; p+ b  u3 N4 H
  53. - G% ]- c! U; K, Q) @, s; t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 U$ Y5 ~/ X( w+ ?0 n
  55. #define STATIC_SHIFT                3$ S8 J1 J2 r  h/ [4 S- s
  56. #define TCINTEN_SHIFT               20
    7 e! X" Q1 n: ^) m
  57. #define ITCINTEN_SHIFT              21
    , a4 Q* c/ _9 b) _  ~) M
  58. #define TCCHEN_SHIFT                22  x* t  \, B, F( ?, G% [- T
  59. #define ITCCHEN_SHIFT               23
    3 N5 B- w' t" [% @: Z7 j, P5 Z
  60. ( d9 s( V  n8 e; R' M' i
  61. static volatile int irqraised1 = 0;4 p2 f- B% U& _) @8 ~8 |
  62. static volatile int irqraised2 = 0;
    % A7 t% N5 g0 O$ c7 L) e: d# D

  63. 6 ]. t4 j2 W/ l' z  J+ I8 X, o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& U* P* @; i0 \$ C+ T- \' _0 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& J. r6 @+ v$ n; z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 B2 {( {+ E; t
  67. ) @7 M& C) z! {; b1 G, I0 j
  68. dma_addr_t dmaphyssrc1 = 0;/ H, j  q; ^' _7 d
  69. dma_addr_t dmaphyssrc2 = 0;
    ! z9 S3 E. Q- d0 `. w
  70. dma_addr_t dmaphysdest1 = 0;% A. u' n- Y, H2 I- Y( L  M
  71. dma_addr_t dmaphysdest2 = 0;; ]( Z" v# i1 j2 t  _+ z

  72. 7 {' V4 C2 v& l# T. }- X& Z# B
  73. char *dmabufsrc1 = NULL;
    % h7 l  x( C+ ]7 x  y' H7 ?
  74. char *dmabufsrc2 = NULL;
    9 C0 j: w6 A( e2 Q+ u
  75. char *dmabufdest1 = NULL;: ~  v& Y- k; @# r( t
  76. char *dmabufdest2 = NULL;6 D* m# u' ^( j$ s' O. h
  77. 6 [9 E+ X0 U3 i  X% C
  78. static int acnt = 512;" l4 e! D4 [( S% x) `
  79. static int bcnt = 8;
    , N+ r7 F' G& F: _
  80. static int ccnt = 8;. a" E5 ^0 G5 f& ^* g1 B

  81. 4 a' h- w* s1 E1 s% ?& h: }
  82. module_param(acnt, int, S_IRUGO);! ?7 N! S6 n- f8 B- j
  83. module_param(bcnt, int, S_IRUGO);
    2 H; Q( q1 q# u& Q/ F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( Q: }- x( d8 r+ }1 A; @6 a2 `
: J& E9 M% e; h3 ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ x7 K5 A/ |& c9 D' V2 e: barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( @  W& a2 K4 B: y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' j: {4 t- U. A" y0 f4 z$ l4 x7 r) `9 [) ~

( V; f  {/ J& A1 e2 \4 q3 m0 n8 ~) f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 07:00 , Processed in 0.227877 second(s), 100 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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