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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % n+ c# t. U7 ?  B6 l, f
  1. [code]EDMA sample test application
    * M2 d+ K3 N1 `8 Q" ?9 y9 C# Y5 n
  2. /*
    4 ~/ {6 D$ W( Q
  3. * edma_test.c$ d2 u8 k  O- E! }& h* W
  4. *! `8 u' r4 e  W7 ~0 S- i3 V% v- C  U
  5. * brief  EDMA3 Test Application, \9 `6 ?) N. ?" c3 b
  6. *
    ' v. f- D& ^, j7 R6 Z
  7. *   This file contains EDMA3 Test code., d  b6 w) [% Z: ^6 z' p/ x
  8. *- _! W* k( `  @. f! @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 Y% V; G4 _' o0 z- B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* d% q  w, _2 E2 i6 u) B: D( F3 C2 M
  11. *         TO CHANGE.
    ( N. q( S6 j4 Q6 u% H
  12. *( Y. R% [3 g7 U, k! {" T0 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ A9 z1 h$ ~5 a- P. b1 W
  14. *$ R! V5 Q. l, `4 n; g6 }: u
  15. * This program is free software; you can redistribute it and/or- H! ~2 s: D5 F  E
  16. * modify it under the terms of the GNU General Public License as
    * J$ s# b3 I. T
  17. * published by the Free Software Foundation version 2.
    $ q: N3 v. W- X" f9 P0 G
  18. *
    ) u- ^0 w' t& l+ y* e5 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ @6 P' Y# I1 w/ A$ M) i7 B; T& u
  20. * kind, whether express or implied; without even the implied warranty" z  f1 n. l% j; M0 i3 _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 b& T3 d% C0 @# ?: C5 v
  22. * GNU General Public License for more details./ E! a. X5 D, E. P, y  P4 j
  23. */
    7 G' a) ~' W7 y  `) L. r* @

  24. 4 o! C$ z0 c& d# F& Q9 q
  25. #include <linux/module.h>8 x  ?: [' s/ u3 P
  26. #include <linux/init.h>, w/ R1 D: {  j' ]
  27. #include <linux/errno.h>
    4 V. V* [, w$ T, }! h; _+ f
  28. #include <linux/types.h>
    1 H- M. K8 C; Q
  29. #include <linux/interrupt.h>
    ; {* ~) l' E9 O
  30. #include <asm/io.h>+ |0 I8 x. ^2 I0 B
  31. #include <linux/moduleparam.h>+ P# q$ C- q7 m
  32. #include <linux/sysctl.h>$ y) J# T0 N" ^2 I
  33. #include <linux/mm.h>
    / b" b4 P; R% T4 f+ f
  34. #include <linux/dma-mapping.h>
    9 w! G6 X7 U7 s$ m! B, V% m2 J3 ]
  35. / x, _9 F5 k: |$ [' G4 ~" I
  36. #include <mach/memory.h>
    6 s5 P0 x: D# M* J+ O, Y' i6 X
  37. #include <mach/hardware.h>
    7 k/ m& J0 w+ f! M
  38. #include <mach/irqs.h>
    4 Z1 C/ H! |  Z1 H1 M- d
  39. #include <asm/hardware/edma.h>+ {, b* s0 p, g5 F0 M$ g6 C

  40. 4 d+ O( @' w7 Z$ Z
  41. #undef EDMA3_DEBUG
    ) f9 S( I# \" [  ]
  42. /*#define EDMA3_DEBUG*/
    7 j& V0 P$ T  q+ f/ e
  43. - p7 p) |& p7 l, e& A; Z
  44. #ifdef EDMA3_DEBUG( q; g$ a: m+ s0 x1 r; b7 s' v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 F$ a& F* C  N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 s; A- S7 Q6 j9 j0 i! |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ `4 O% @: r6 p/ k5 ~2 g( T$ O, ]
  48. #else
    & A4 f) U( b: B8 N
  49. #define DMA_PRINTK( x... )
    " K8 C% ~( d. {; O
  50. #define DMA_FN_IN
    ; y9 O6 `5 Y  k
  51. #define DMA_FN_OUT
    , J4 }9 `7 R3 O& T
  52. #endif
    ; u" O. G, a8 c2 N$ u
  53. * Z, o  h% l8 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; b1 y: J$ x% X/ e
  55. #define STATIC_SHIFT                3
    9 g6 z+ M& A. a  m" `
  56. #define TCINTEN_SHIFT               20
    9 ]) k0 ^% a# `9 W
  57. #define ITCINTEN_SHIFT              21
    $ E( d5 }  Q3 ^3 t
  58. #define TCCHEN_SHIFT                22' I) i  _2 q' r/ e- h
  59. #define ITCCHEN_SHIFT               23
    $ D. V- `4 }  `$ s4 g

  60. & d3 y) \6 T; X
  61. static volatile int irqraised1 = 0;
    5 I* L3 [" P' Y  V$ E
  62. static volatile int irqraised2 = 0;
    % h7 b' K( @( @2 p; u, c1 ?  O# R
  63. # P3 Z1 U' }4 s, ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 A* o% B& j. y2 N2 j9 J' l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + G* c5 V. b% y* u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& R8 o) O- E6 n+ C5 Y1 _
  67. * X" p8 j! _) r: r3 }& `6 w
  68. dma_addr_t dmaphyssrc1 = 0;
    / s. m# p+ y% j
  69. dma_addr_t dmaphyssrc2 = 0;# ~- D: l$ _/ w( j8 G, N
  70. dma_addr_t dmaphysdest1 = 0;, B5 I  T# u1 m7 z# o/ c
  71. dma_addr_t dmaphysdest2 = 0;
    1 w! Z6 d1 z0 [# `: j& N9 j

  72. ' _0 L7 G; y8 j* d5 g) M
  73. char *dmabufsrc1 = NULL;2 r" D5 s$ O  E  v0 ^2 i) E
  74. char *dmabufsrc2 = NULL;+ B0 h+ G( U/ u' `% K) h
  75. char *dmabufdest1 = NULL;) w8 U) A; L) T8 r: X" L
  76. char *dmabufdest2 = NULL;
    3 m5 M9 T5 ]4 F# r5 j- M2 ]* X

  77. - ~% R9 ^; m% O, F8 {  j, `! x
  78. static int acnt = 512;' V8 [" ^$ e: D! I& U
  79. static int bcnt = 8;
    . c# }. o0 r. K4 X; Z
  80. static int ccnt = 8;: j) e7 w% D# a6 k2 ^) X
  81. " ~: ?1 r- a. S, N
  82. module_param(acnt, int, S_IRUGO);
    ( d$ g  b6 c& b/ s8 B
  83. module_param(bcnt, int, S_IRUGO);1 N5 {; y9 }9 [* r" j+ m6 i( Z9 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 B$ Z2 d* m0 {3 @8 @: Y
* {% P& X0 P9 ?9 e" Y* W2 O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 f+ b6 i& L+ Oarm-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 l. U5 T  Y* R( |& ~. F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 C' n5 C9 [) A* K8 f5 ?; ~
5 ~4 b1 K! R3 Q# a+ t8 m
& w9 R" q! x& U6 Q7 [/ Y5 m& f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-14 20:51 , Processed in 0.037262 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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