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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 r. p# B  _' b1 E# K1 Y
  1. [code]EDMA sample test application
    * d) K/ F$ x6 p, Q: F
  2. /*! I6 j* I4 R! S$ [5 w7 B' {
  3. * edma_test.c% s" z4 O  j: A
  4. *. N6 |3 f$ R9 k+ K# }6 h% c, q9 H
  5. * brief  EDMA3 Test Application* ?! m. }5 k; p4 b8 |+ s
  6. *& W3 A9 D/ n$ x7 K
  7. *   This file contains EDMA3 Test code.0 E1 X7 ~& X$ W) B6 C7 h% F
  8. *3 Y$ D+ Y1 a" ^8 ]8 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + Z, ]! L% T& \8 ~& N1 h3 D# M. C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; R4 t2 l5 H. j% n! a  u3 j. B
  11. *         TO CHANGE.
    1 ~, O( x# w; W) p: E2 K7 s9 Z$ c
  12. *
    3 y. z, b6 t* l) J6 L" E9 C- B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  a4 k/ F+ g) A2 k: J- v
  14. *' b$ q2 }, e5 w* @" F, C% ]
  15. * This program is free software; you can redistribute it and/or
    & N- v' F& c4 T" T. G+ k* z+ b1 E
  16. * modify it under the terms of the GNU General Public License as1 Q( l" m* b. T% c6 J3 E0 l
  17. * published by the Free Software Foundation version 2.+ A1 w. b# Y; [" {5 G9 R: S7 A
  18. *
    : W; D0 ~" O9 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( w% c5 w; E) r6 p
  20. * kind, whether express or implied; without even the implied warranty' o2 V  z( X* Y0 l) v4 R, c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 V3 t1 T( O& ~" G' T  ^
  22. * GNU General Public License for more details.4 a0 |+ f! A- }. T( k, R
  23. */4 D& p' g* J; E# B+ n
  24. : a6 q- z; J; j+ Q
  25. #include <linux/module.h>* ]4 K: r. Z4 x, {" j
  26. #include <linux/init.h>
      k5 R/ U) U$ @8 W: i, T* u
  27. #include <linux/errno.h>
    . a0 A0 x. ?/ a
  28. #include <linux/types.h>
      H* b7 t9 f, ~4 o1 ?4 r& t7 B; c
  29. #include <linux/interrupt.h>1 S! V- `2 x6 f9 p/ q  X
  30. #include <asm/io.h>3 }! F1 n9 }. E+ E' z6 q; G
  31. #include <linux/moduleparam.h>2 V# b" q2 P. p4 D2 T
  32. #include <linux/sysctl.h>& ^% ~: }$ T7 s: O+ Z
  33. #include <linux/mm.h>
    % k; l9 ], d) |) @. V  ~+ w' R
  34. #include <linux/dma-mapping.h>
    ; ?1 F; C$ {0 V* q& y
  35. 3 q" O, {# Q  N9 \# N" S% J
  36. #include <mach/memory.h>6 q1 |+ S0 D- `0 J+ k( O$ Y4 o
  37. #include <mach/hardware.h>
    2 W, Y3 m: ?: h) J# y
  38. #include <mach/irqs.h>
    ) {6 U6 ^, l2 T+ @
  39. #include <asm/hardware/edma.h>
    , b8 }- X4 t' Q" w  o( F; P2 k3 t

  40. / }" y! F$ c& l1 P" U
  41. #undef EDMA3_DEBUG, r2 p' r- u. W* W) n! }* Y. s
  42. /*#define EDMA3_DEBUG*/
    0 \7 M8 N* _& u2 N7 |; B/ U

  43. 6 E/ D8 ?: D& \! ?/ ^1 i
  44. #ifdef EDMA3_DEBUG
    % p5 n& M+ m1 n3 o4 `; z2 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , W9 N$ j7 A. t$ K/ l: Q' {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  v! \$ Q9 p5 R, S# g) W5 p- q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ]% B- ^. E7 i6 |
  48. #else% E9 D: r) c# w+ w
  49. #define DMA_PRINTK( x... )
    & p2 g8 a0 ^% N9 o7 X. J
  50. #define DMA_FN_IN8 [/ P) Z% N, Y# a
  51. #define DMA_FN_OUT
    ( D& k$ a' o1 K9 n7 T$ M: x; b
  52. #endif: B( Q7 w: H0 l7 Q
  53. 1 _1 z- z. G! o/ A9 A3 D' Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / H. E3 P" }7 |1 P4 x7 \
  55. #define STATIC_SHIFT                3( i6 \  j2 p9 G
  56. #define TCINTEN_SHIFT               20
    - W$ p& w1 ]: Z8 d+ @
  57. #define ITCINTEN_SHIFT              210 J7 O6 R3 t2 T% O( e# u1 T& t
  58. #define TCCHEN_SHIFT                227 E1 o1 ~, ]( H" R' r
  59. #define ITCCHEN_SHIFT               234 z, \2 ^4 K% H0 R( r
  60. - \! y# O* [6 [0 s6 r# ?; N$ Z
  61. static volatile int irqraised1 = 0;
    2 n7 q* g2 g7 Z# z, O- }3 b
  62. static volatile int irqraised2 = 0;
    2 d8 M5 Z8 ]  h7 F- d; _' ~
  63. & _+ o3 T7 A% X9 V2 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( J. e* f* p9 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! X  D/ @# H* y, y$ p3 P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ^7 K' u0 _7 s7 g8 c. d
  67. 3 _% I# |& T' x) x! @! {2 _* u
  68. dma_addr_t dmaphyssrc1 = 0;7 s( f9 H7 f2 z: f* Y: b
  69. dma_addr_t dmaphyssrc2 = 0;
    $ R0 g" w  _; j5 g9 j1 |
  70. dma_addr_t dmaphysdest1 = 0;
    . V2 m- |* t7 p. u
  71. dma_addr_t dmaphysdest2 = 0;
    3 `  a) I' c  [* T; L

  72. 5 ~6 [$ R9 V# d5 G7 p
  73. char *dmabufsrc1 = NULL;
    3 A9 s. K. s- z) _8 u
  74. char *dmabufsrc2 = NULL;: W2 j+ P/ F) \3 `
  75. char *dmabufdest1 = NULL;
    + o8 [; K$ c8 B
  76. char *dmabufdest2 = NULL;
    ; }/ w3 N; X' y' M8 a% M

  77. 8 I8 Z  {/ t. i3 d4 m2 s' ^& G( y
  78. static int acnt = 512;8 S+ B( H5 j" ~
  79. static int bcnt = 8;% d* b1 t+ v! r8 s
  80. static int ccnt = 8;
    9 `3 f3 B) V  i' w7 V+ |

  81. ( ]& p( A+ a6 u2 v: J: A
  82. module_param(acnt, int, S_IRUGO);! i0 p: w3 m8 r! J" s( l, ?
  83. module_param(bcnt, int, S_IRUGO);0 Q, @7 ?9 h6 x1 |+ D, c! T  H* {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ Q* B4 O" g, k7 E7 \1 L
! o/ @& A8 z4 j8 f) L6 Z0 c/ B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 a0 L3 @# v: X" q( l  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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 H+ e4 ]3 u0 J- U! I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ g/ {4 l/ Z8 h1 E4 \9 h3 J  p
/ f! L; p* p% _
0 ]. @5 j2 j( F. i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-31 22:54 , Processed in 0.044389 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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