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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 L" o( H7 v0 l* a# @1 ~
  1. [code]EDMA sample test application
    + ^( J. B1 p: Z
  2. /*
      A( R% t- N+ f( v9 l0 @
  3. * edma_test.c1 {8 |+ E) V1 U( v& `, L2 m- {
  4. *
    6 A; r* N% {* I- I5 |, v
  5. * brief  EDMA3 Test Application+ i, [( C- n; Z- {5 A
  6. *1 T( K" e: K& Z3 L8 a) m& V
  7. *   This file contains EDMA3 Test code.$ {/ x* r  V8 o7 ?* m& j
  8. *
    8 h% ?' Y& @' Y: @  |* K1 x# J6 Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ f. u6 w, i4 ^' u1 A/ O7 B7 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! \, B- f: H, |/ \( e* _% p% c% m
  11. *         TO CHANGE.. F4 z$ |+ A" h* D* v* L4 u; ]
  12. *
    # v) Y. ]3 z) }) C2 `* ^- W- `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 \3 w1 v' x4 Y$ m+ h5 p' ]& t
  14. *; x, l! t% I8 ~+ P# T" e
  15. * This program is free software; you can redistribute it and/or9 \# m" T; g. f9 ], b- q+ G
  16. * modify it under the terms of the GNU General Public License as3 J9 z: L9 d: d  f
  17. * published by the Free Software Foundation version 2.
    5 c, S0 `- E) O: V
  18. *
    / D* d+ c7 y; ?9 |0 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 c* T7 q% _3 [" N8 j
  20. * kind, whether express or implied; without even the implied warranty+ v; Y- ^& z/ r/ s4 u2 \/ K8 S- L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & ~5 M4 n. D: A2 n; [
  22. * GNU General Public License for more details.* f, D; Z' U3 N$ f# l/ h0 }
  23. */
    " z% c1 f! M3 m7 P7 o
  24. ! }/ T7 M. I7 a5 b7 t+ z/ _
  25. #include <linux/module.h>
    ! q6 ]1 P3 x8 i2 D
  26. #include <linux/init.h>
    - W) K# l5 {- ~" d
  27. #include <linux/errno.h>- m. U8 o: h6 C3 M' J2 p
  28. #include <linux/types.h>
    0 ~! o8 j6 `" s
  29. #include <linux/interrupt.h>* o* E! J2 y; s* z1 J
  30. #include <asm/io.h>
    , w9 f1 x! R' l6 L& h2 {
  31. #include <linux/moduleparam.h>
    / S! R+ X, p4 V, _, V; K9 n- N
  32. #include <linux/sysctl.h>, v8 F8 U2 P  \( o% ~# x) \# {0 i
  33. #include <linux/mm.h>
    - F. J" B, m% e* H8 B7 n2 g
  34. #include <linux/dma-mapping.h>$ B/ w" L1 |& H3 F

  35. 4 f6 L) t. D- e; f
  36. #include <mach/memory.h>
    : J6 @% w( S! Z0 v+ z* r
  37. #include <mach/hardware.h>
    5 [# B$ e6 n: ]* M, \; R3 p
  38. #include <mach/irqs.h>
    1 v* X! z9 U0 W4 ^# x
  39. #include <asm/hardware/edma.h>1 c% ^7 d; b  y2 e3 p/ B% f6 u+ I

  40. ( q3 |* k( J+ z2 w$ ^% A! Q
  41. #undef EDMA3_DEBUG1 z6 h/ B! ~+ x7 ?4 d' \
  42. /*#define EDMA3_DEBUG*/8 d2 [: p9 K. C& x3 I8 s. k

  43. $ R4 m0 f: Z9 d8 n" B/ D& O- a
  44. #ifdef EDMA3_DEBUG5 P# b$ u6 ^6 d( _7 p% {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* }9 K4 K1 S! B) k  i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! b0 Y; S6 w* R  R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . q5 \, E/ S( U! T0 `) M- @
  48. #else
    ' a4 X$ f  S: L1 C# V# L
  49. #define DMA_PRINTK( x... )
    # _: U! H. u' K! j
  50. #define DMA_FN_IN. m! ]2 M8 u# C( S& w  {5 N% ^
  51. #define DMA_FN_OUT( H8 c7 v) @% o+ u1 d+ {$ a6 }
  52. #endif
    $ y9 b2 p2 {% {# V
  53. 6 c1 d$ Z/ ]! l. u1 A5 S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ v8 m# {/ Q) U" y( C7 A- D
  55. #define STATIC_SHIFT                3
    4 K( w1 g) ?% v9 z: x
  56. #define TCINTEN_SHIFT               20- m4 |% B" P1 X  _: E; Y: b
  57. #define ITCINTEN_SHIFT              21
    * A2 O; K% r/ a1 h3 c
  58. #define TCCHEN_SHIFT                22
    0 R/ ^0 P8 N9 u. {
  59. #define ITCCHEN_SHIFT               23
    ! ]& U0 U. |- ^& p. A
  60. & V8 R/ t9 `) ]% j$ @  C3 d  {* D
  61. static volatile int irqraised1 = 0;# Y' k/ X7 M; q; m
  62. static volatile int irqraised2 = 0;7 J  S: y6 y* s$ x8 G

  63. 2 M; i0 E8 S- Z# Z! P6 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ `9 ?- N$ j1 u8 t- L5 e. {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( o' M  [9 v+ v. [7 v) G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' v8 a! ]! K* y4 `* R9 D

  67. 8 l" ?# f  U" r# i* _
  68. dma_addr_t dmaphyssrc1 = 0;+ M0 ~2 B( Y7 s3 T! ^  d. A  k6 _
  69. dma_addr_t dmaphyssrc2 = 0;5 E0 _" C' T' X7 E$ q/ Q+ a5 u
  70. dma_addr_t dmaphysdest1 = 0;
    $ l% T) F0 Q7 T: @9 e# O$ W; d
  71. dma_addr_t dmaphysdest2 = 0;* ]7 j  U% b& ]* Y( f6 U1 k. [

  72. 5 w2 M) Z# }' `& c$ z4 l
  73. char *dmabufsrc1 = NULL;
    ( o+ B8 |8 l: P) h( o
  74. char *dmabufsrc2 = NULL;' R6 F3 H" s( e0 s9 ^; ?/ V8 Z$ P
  75. char *dmabufdest1 = NULL;! @# r6 o6 Y0 R1 g  K
  76. char *dmabufdest2 = NULL;& g8 j+ a4 N& p4 u

  77. 2 t5 f) s2 G- V" i5 P
  78. static int acnt = 512;
    & h3 O, }' u7 T
  79. static int bcnt = 8;$ E" I9 G0 @3 k& q
  80. static int ccnt = 8;
    ( r/ s5 z) z6 g# ^, C6 d* N( p( M# r
  81. ) X/ L5 ?! u8 M. V' q3 d+ t1 ?% k
  82. module_param(acnt, int, S_IRUGO);
    $ |- E3 J0 k0 f- q
  83. module_param(bcnt, int, S_IRUGO);, V8 [3 m: |% ~& y" w( m! _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) m! U4 n; W& }  Q. K: v! ?$ Y7 q4 P( u, w* H* j  ]4 E$ i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 b. T2 T% W( E1 g( Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ ~5 ^7 N+ ]% i& c3 ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 x1 ?  K. A9 ^- K7 q: f8 D, @
) I9 d. W9 ?# G. h9 X# s7 x
6 r$ T; i5 f- y) Y) ?- }9 R. O& a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-29 10:24 , Processed in 0.037786 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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