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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ M  I6 w3 w6 k
  1. [code]EDMA sample test application
    ) c+ q& Y$ f  s6 S1 l& c& G
  2. /*  J4 D" [9 l5 Y* A* K
  3. * edma_test.c
    0 d7 Y0 G' E7 |! |
  4. *
    4 _$ P6 p) R. i0 z$ W; S8 R% h
  5. * brief  EDMA3 Test Application7 L) l( F% U7 C( e9 q
  6. *
    ( N# x0 T9 ~5 t, n7 r  O/ ?
  7. *   This file contains EDMA3 Test code.7 M% `! Q) t: e0 m" S8 C
  8. *
    2 n  @+ H2 _" J# R9 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  u. l# u3 V6 ?9 V9 j( m& p& U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% t! ]- ^7 f* @+ |
  11. *         TO CHANGE.! u0 U! h1 q' E8 X- P. X% ]  o
  12. *' x2 ]: U+ Z5 U/ G; k; E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 ^) R+ M- C* n" |/ B5 k
  14. *2 J1 @9 P2 C" u0 {; ^4 U
  15. * This program is free software; you can redistribute it and/or: E8 i2 f% L1 O" Z5 r
  16. * modify it under the terms of the GNU General Public License as
      q+ @" c. J( k7 h6 \3 y8 i
  17. * published by the Free Software Foundation version 2.
    ) u. _* Z: [3 c5 a& f7 ?6 i/ C
  18. *
    : [7 `" b4 d$ r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( g8 l; J$ [5 |' i; r
  20. * kind, whether express or implied; without even the implied warranty
    3 i0 M4 m( y# k% k. \2 ^" A( {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) {; Q' F$ [% m5 F* i1 x
  22. * GNU General Public License for more details.% v- z+ R0 X" `3 Q4 P0 L
  23. */# {3 r7 L4 j) j& _  V! p

  24. 3 F% R$ _$ H& {( P5 O& f
  25. #include <linux/module.h>
    - S1 T. [! Y* {0 B5 i$ }
  26. #include <linux/init.h>
    % b" @! H) _. b6 ]5 \- V% P
  27. #include <linux/errno.h>, E4 h! E' O6 {2 m
  28. #include <linux/types.h>2 G: O/ j: X; }
  29. #include <linux/interrupt.h>, t2 O3 _  b5 l, A# X
  30. #include <asm/io.h>. `7 t' |/ S' R* e* ^5 E  o9 M
  31. #include <linux/moduleparam.h>
    $ I2 I: j; g' t
  32. #include <linux/sysctl.h>
      c7 T8 }1 e. Z0 x% K
  33. #include <linux/mm.h>: P2 q* X$ h7 m; O9 |
  34. #include <linux/dma-mapping.h>
    ) y# |- o$ ^! z: _4 _+ ?

  35. ( V0 a2 T! X# L! \+ |* Q$ J
  36. #include <mach/memory.h>6 W4 }9 ^% N( r& l4 @
  37. #include <mach/hardware.h>
    . F6 S: \1 L2 A! |, J
  38. #include <mach/irqs.h>" q0 {5 f4 y2 L6 ~
  39. #include <asm/hardware/edma.h>
    & ~+ X$ y6 \1 [% ]0 [2 D
  40. # Z/ [2 ]2 K; p
  41. #undef EDMA3_DEBUG6 i3 m4 {- j9 z% M! L
  42. /*#define EDMA3_DEBUG*/
    # V( o. \/ d9 ~3 L9 S" N
  43. 1 D2 i# j1 G* F" p- H; V
  44. #ifdef EDMA3_DEBUG& U) O( a  @( _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! Q1 I  N" ]6 R# q& a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) W, U  i. Q5 E) X% b$ A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - v4 ~. x- P4 F5 U2 R# O
  48. #else" @( Q# _* L" |/ k
  49. #define DMA_PRINTK( x... )
    $ Y/ _$ }: Z/ c7 {
  50. #define DMA_FN_IN3 O; y1 |9 _/ |3 ~# h  p, p
  51. #define DMA_FN_OUT
    ) z. J: Y8 @7 m
  52. #endif' g# l1 Z" b  Q. @

  53. ( _" H, e, s2 j; n8 r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); ~; `6 B: J; Y) j( p
  55. #define STATIC_SHIFT                3: L' S, v- g. o$ O: J
  56. #define TCINTEN_SHIFT               20
    5 e, G3 h" c) t" F3 u
  57. #define ITCINTEN_SHIFT              21
    / c: |/ h# A; H0 `! c8 K
  58. #define TCCHEN_SHIFT                22
    # N6 N: n& x* y6 I9 Y) V1 F
  59. #define ITCCHEN_SHIFT               23
    3 K/ Q5 U0 Y6 Y% j( n) q
  60. ; S, d! P8 b% t
  61. static volatile int irqraised1 = 0;
    2 i0 T2 Q& B- y$ Q9 A3 X8 F
  62. static volatile int irqraised2 = 0;
    ; `6 E  |9 k. v
  63. * {$ Q2 `' b3 x. r! z& e, ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ x/ r0 c8 _6 Q3 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 g, g* h! E7 e( Y) z7 j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. A" D7 I( }) \7 g1 {8 i
  67. , x  ^4 k% \$ _; O
  68. dma_addr_t dmaphyssrc1 = 0;4 K" C3 g2 E1 e( n5 q+ W: @. L* j1 \) Y
  69. dma_addr_t dmaphyssrc2 = 0;4 t1 ]& w; z8 U% d/ B1 w: k- e( m
  70. dma_addr_t dmaphysdest1 = 0;2 s, j6 v& a5 |* X6 s
  71. dma_addr_t dmaphysdest2 = 0;
    . @) ]! c$ P& k- \& }  f+ w
  72. 6 n9 v4 ~  ^3 p! k/ q
  73. char *dmabufsrc1 = NULL;  P( V$ y& B, D4 }
  74. char *dmabufsrc2 = NULL;
    ) M, S4 S8 Q1 {& h0 v3 t5 _% Y
  75. char *dmabufdest1 = NULL;) p  d6 y4 C2 p) M' _
  76. char *dmabufdest2 = NULL;
    6 H; U, X0 J, e' Q, O! O; D  C# X$ H

  77. ( D  L( q. {3 _8 e3 W* i
  78. static int acnt = 512;. N5 I: d+ _2 M# U# W+ k9 s
  79. static int bcnt = 8;
    5 y+ d  h5 W% a9 `
  80. static int ccnt = 8;
    $ M0 h$ j/ V2 Z3 j5 t

  81. . {$ @1 H( y+ H
  82. module_param(acnt, int, S_IRUGO);
    7 T$ g+ v- z1 H: ^$ j0 L
  83. module_param(bcnt, int, S_IRUGO);1 L4 Q- f+ ^- W: i% Z" _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  R# M& w" J, |* m
* u6 p  ~. d8 T- Q2 V" o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# f7 E5 P" p8 P/ u8 }7 K( }  marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  _3 o/ O! S& [: o- o7 ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% M! C+ W6 R- k& k$ [9 a0 L( h
9 P/ B1 h+ z1 [$ U7 j0 ?
9 j. z; s* W  l" T% O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 22:43 , Processed in 0.042741 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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