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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( B4 B6 f, y! E2 ?' R( W
  1. [code]EDMA sample test application4 m* K5 C7 _. G" Q4 _; A
  2. /** x& D/ T5 j0 C
  3. * edma_test.c/ D/ }/ w" A& n5 P* s, B! Q- Y
  4. *& P1 z- |' y* h$ q$ ?  l+ {
  5. * brief  EDMA3 Test Application, b9 e5 `! m( `) o  H7 z
  6. *! J: P* @0 v# ~. k7 N
  7. *   This file contains EDMA3 Test code.
    , P+ z# W9 ?5 s+ y, |2 G# d+ I6 U3 u( ?
  8. *
    3 Q/ Q3 p" X: a. Q+ Q0 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* L: N3 g9 e: K  N8 L4 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 F( l4 ?. a- P7 b) g$ t8 K
  11. *         TO CHANGE.! }' |& _* l, r' G$ B
  12. *8 C$ a0 K6 c7 Y: x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 t4 ]* s, r( s
  14. *
      w# Y8 E3 j% q1 i6 l5 H
  15. * This program is free software; you can redistribute it and/or! q2 Q+ X  o$ {, z
  16. * modify it under the terms of the GNU General Public License as
    " L% b: }' ]+ U2 T) h" j  B: ?% [! o
  17. * published by the Free Software Foundation version 2.
    2 e# C. C. M6 M4 M5 D  d: V7 t
  18. *1 T" L( L9 }  l' W* p0 [" @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, T7 q# W# U; t9 M1 C2 G
  20. * kind, whether express or implied; without even the implied warranty
    / ~& j+ J7 T- U6 I* A9 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 J; c$ G5 x! ]& p# \3 r) ~! S
  22. * GNU General Public License for more details.
    ! o2 v5 e4 F( b6 M, N
  23. */
    1 S9 w+ r: H6 V9 q  {% Z( t/ a
  24.   n, f4 S# ?2 l  U* e
  25. #include <linux/module.h>
    7 a9 `% H' Q; ], N7 E
  26. #include <linux/init.h>
    + a6 }5 o% @5 l6 q; ^- T8 l  }# w+ {
  27. #include <linux/errno.h>, A/ c/ z' x* k# r# |# L
  28. #include <linux/types.h>
    * J- T% i+ {: Q  z9 l5 u' D
  29. #include <linux/interrupt.h>
    2 o# l( [: H" c
  30. #include <asm/io.h>
    ' g% @* D* l" q1 T* f9 y* C6 c
  31. #include <linux/moduleparam.h>/ [! n" T" ^" ]
  32. #include <linux/sysctl.h>
    : ~; M9 [' |! J, c% V, n
  33. #include <linux/mm.h>
    ( t. O1 u9 x+ u' u6 I5 U
  34. #include <linux/dma-mapping.h>
    " Q6 I" J4 |6 _0 |; f; j

  35. . B& n9 k& K, a$ T7 P. ]' s
  36. #include <mach/memory.h>/ H4 n  ^! m# F1 A
  37. #include <mach/hardware.h>
    # ?( f  [8 d* M' u. |! r/ p
  38. #include <mach/irqs.h>& x! C' p# p" z! N
  39. #include <asm/hardware/edma.h>5 x/ z$ z3 F, o2 r, E. b
  40. ! j' h0 M7 ?2 m! J
  41. #undef EDMA3_DEBUG
    4 w+ _% L: h$ Q$ ^6 X4 \
  42. /*#define EDMA3_DEBUG*/5 |/ F7 C8 Z3 V4 T: A

  43. 4 m) p/ m) M% F5 i: F2 z3 |8 q
  44. #ifdef EDMA3_DEBUG
    $ b& ~2 c# v/ c4 F/ C* b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ n: q: t: V/ M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 |7 z/ A0 x! L$ C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). Z* F. L# f4 O5 R0 {2 J3 ~
  48. #else' [' {3 B* ]+ X7 N) V% {5 S6 q, K
  49. #define DMA_PRINTK( x... )5 Q4 [0 Y$ N( X+ {. |; r
  50. #define DMA_FN_IN  M. I1 `2 K4 @% M$ Q. W/ x
  51. #define DMA_FN_OUT
    5 K( a# L* C  R2 {  }) n
  52. #endif
    1 c. \+ }; c& W
  53. ( N1 [) N2 X' }# Z" t( f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) z9 u! a  H; Z6 Y4 r" {6 w) C) L
  55. #define STATIC_SHIFT                3
    ( H2 a/ Y/ h8 w
  56. #define TCINTEN_SHIFT               20
    5 r' l( Y; {/ q/ t8 i- u9 s1 h
  57. #define ITCINTEN_SHIFT              21
    ' ^- C0 k: B6 z8 K% N. G& O
  58. #define TCCHEN_SHIFT                22
    * _1 p* M( ~, C
  59. #define ITCCHEN_SHIFT               23
    $ Z# ?: g, Z* R- ^9 C

  60. ; C* J$ k- D# e% I$ r! c
  61. static volatile int irqraised1 = 0;
    + y; }0 Y& [6 M% V1 r2 @, h  @
  62. static volatile int irqraised2 = 0;
    3 O: b8 w4 O1 X+ t. e. b

  63. * M" d- K5 j5 e) ]0 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 V! f- D6 G# v+ _2 K4 Q5 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' H0 {: o4 J2 B# G3 \4 l' P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; K0 I) {- o4 y: I9 F- r
  67. 0 r. ~4 G* D& g3 R
  68. dma_addr_t dmaphyssrc1 = 0;
    , ^" ?( h5 k( c% h
  69. dma_addr_t dmaphyssrc2 = 0;: t4 k- I8 V' g- @: z
  70. dma_addr_t dmaphysdest1 = 0;
    5 y& B3 Y* y) H) \
  71. dma_addr_t dmaphysdest2 = 0;' x$ U5 g+ T: k, y& b8 F
  72. & f: N) t+ l1 w! m. I$ f
  73. char *dmabufsrc1 = NULL;
    7 R& V' u2 S0 `" w8 z
  74. char *dmabufsrc2 = NULL;% G9 ]( [. J6 m: k" U
  75. char *dmabufdest1 = NULL;
    + Q; I6 m, T( m+ s
  76. char *dmabufdest2 = NULL;
    % F( h' V% J9 }: }5 l7 Q. ?

  77. - v7 W0 W7 P( r
  78. static int acnt = 512;2 q. `  K1 y' i" w3 I6 b* a
  79. static int bcnt = 8;( l. N/ D( C* J" N* e
  80. static int ccnt = 8;6 M9 p1 q$ I: }

  81. - c2 `& ^! A, _% L
  82. module_param(acnt, int, S_IRUGO);
    1 J& R0 `- l& o# V8 ~
  83. module_param(bcnt, int, S_IRUGO);
      v1 O; i% S. q. V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# Q, n% f. w5 K* A9 S5 b& a
1 N6 D% ?0 B( ]3 ~4 {# t, _5 g( j: v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; ]2 A/ t, x) l" T. n& earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ a6 C; V& I# {3 s' J) y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 z' b% Y2 V6 Y9 Z" G
) f: j9 {2 E0 n, U  m9 {
* D- I5 n7 E/ s7 @1 S+ r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 00:09 , Processed in 0.040391 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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