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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# N4 I0 d4 G& h/ p; w  R
  1. [code]EDMA sample test application. s1 M  o5 m' Q
  2. /*
    $ b8 U6 v$ t; G+ K9 K4 u* G& O5 K
  3. * edma_test.c, c8 l. X. z# `3 d
  4. *
    4 R) g$ h7 q9 u, Y' x( ~) p+ m. P) k
  5. * brief  EDMA3 Test Application
    * z% K' i  _6 x1 D% d: C! [& h' L' `
  6. *- }1 b% b# g: W& D! \6 ^' @
  7. *   This file contains EDMA3 Test code.- r9 a) K( _  X
  8. *! S+ ^" B2 o% j( C* ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, V1 n% k/ M3 J' F$ A# F2 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 P9 @  e+ {! `8 O" i: {5 g5 a! q# a
  11. *         TO CHANGE.
    : e4 o5 _; @5 k: E7 \  V0 Z
  12. *
    + [- x. t, }  z; U0 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 x/ c' }, k! \7 y: `6 }. t" ~
  14. *' a" [8 E) I* E  b- r1 t
  15. * This program is free software; you can redistribute it and/or5 W8 w/ q4 b% R) ^7 d9 @
  16. * modify it under the terms of the GNU General Public License as
    ' V5 G; }& X5 L& Q+ Z1 q# ?
  17. * published by the Free Software Foundation version 2.
    : [+ ~6 P" u. A: t
  18. */ ~( a7 a, Q2 S2 C" b% @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 D% W9 t* {* E3 h! @1 U
  20. * kind, whether express or implied; without even the implied warranty
    ( ~2 V$ T% ^* y+ \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! u; b: ]& \! p1 R
  22. * GNU General Public License for more details.
    ' C2 x$ x+ S1 j! {3 C' Q
  23. */! O( N; B0 B* j6 e6 @; [
  24. / ?  e# Z( |: K; Y1 }. C  _. i7 i
  25. #include <linux/module.h>* h& w8 Q7 J- W% [
  26. #include <linux/init.h>
    * y* w, Z" B* W5 s' R
  27. #include <linux/errno.h>" C* ?$ f3 t9 v6 g/ [" m. O- g* K
  28. #include <linux/types.h>' F9 `; x5 ?! Z% O8 ^
  29. #include <linux/interrupt.h>! N" U" f2 o' v' _! [) X/ o; l
  30. #include <asm/io.h>
    7 [; X- O) c  r5 ~- C0 B1 w4 q5 I8 L
  31. #include <linux/moduleparam.h>6 b6 ?$ P; x( p6 Y1 q$ L
  32. #include <linux/sysctl.h>
    : i! S: k+ d1 ?  e5 C
  33. #include <linux/mm.h>  h8 e" e0 J$ q# Z$ `* Z1 ]( M
  34. #include <linux/dma-mapping.h>
    4 e( Y* F& E0 d, X% z6 P

  35. 8 u; g& c3 J( m0 j* U+ u" P
  36. #include <mach/memory.h>
    $ g1 Y! ^/ G3 Y1 Z* \" O# k
  37. #include <mach/hardware.h>+ y1 N6 ^+ R; c
  38. #include <mach/irqs.h>
    ) ]0 @) ?% j% n! F$ G
  39. #include <asm/hardware/edma.h>- M' t! r' v$ ]
  40. ; S7 F/ j$ S7 m2 u4 {2 F
  41. #undef EDMA3_DEBUG
    ! m! @8 \' _9 F8 _# @" g8 E
  42. /*#define EDMA3_DEBUG*/
    % v& W* h9 }& q+ v4 {1 _" R: u7 V9 S

  43. ! c" w$ T! v' y* q! G; \
  44. #ifdef EDMA3_DEBUG9 [. s7 J7 O3 N0 f) Y+ z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 a; m: t8 q5 `- l$ Z  l! f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ O" L; t) {% E- E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) a6 u* k: o6 v/ h% E6 N) Q" o
  48. #else! w5 f( o; X4 ]- _* s
  49. #define DMA_PRINTK( x... )
    . H% L9 i1 W3 T
  50. #define DMA_FN_IN) C9 R. z0 _) H8 m6 R4 w. G; o
  51. #define DMA_FN_OUT
    2 q( f1 X4 F& S0 K5 W4 o, v/ T
  52. #endif
    . p3 \) `+ F4 d1 W, H8 L* [

  53. + P' d6 c# L7 }7 T6 V9 C+ F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 l) Y( g( t- [, ?* s2 s
  55. #define STATIC_SHIFT                39 S+ R7 b# f2 [! ?1 ~4 F' `
  56. #define TCINTEN_SHIFT               20
    + {- Z8 A" L& V
  57. #define ITCINTEN_SHIFT              21
    - m, m. C9 ~3 ?9 [
  58. #define TCCHEN_SHIFT                22
    ! f' D3 ~. H8 r# d& I  k
  59. #define ITCCHEN_SHIFT               23
    ! {6 h  z1 ^- ]5 Y# v

  60. ) F" d5 P4 h% d! `) I
  61. static volatile int irqraised1 = 0;
    1 H$ \3 Y' d7 ~  ~
  62. static volatile int irqraised2 = 0;0 y3 y+ v' N' B) ~- ?
  63. : W2 d( |6 u0 w8 ?: I6 }& |& |4 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( J0 ^' `* F9 V- o8 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 P/ M. t% J0 r9 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , A0 l9 _0 M% B7 C

  67. . a2 j0 C: {" R, Y0 Y
  68. dma_addr_t dmaphyssrc1 = 0;4 O7 t1 B% g, U" m4 U
  69. dma_addr_t dmaphyssrc2 = 0;
    6 `: c7 U0 v, w' y+ ^) |  J  @
  70. dma_addr_t dmaphysdest1 = 0;
    9 `- o& C4 g1 {7 F
  71. dma_addr_t dmaphysdest2 = 0;- O. I7 C! M* E' M3 N
  72. ; F# u: S7 y1 E' x- d
  73. char *dmabufsrc1 = NULL;
    . ~; q/ S6 `/ b' v
  74. char *dmabufsrc2 = NULL;
    6 G! e4 T: G) f+ }5 |' k- `
  75. char *dmabufdest1 = NULL;
    : x' Q' H' d) s  |% y' U
  76. char *dmabufdest2 = NULL;
    + B2 \' s1 x. |5 r* N( T

  77. " b3 A3 o4 m& o$ B
  78. static int acnt = 512;
    / e8 [. a, J! s
  79. static int bcnt = 8;
    & |4 d/ K( f' H0 ^9 _% z* ]( k6 X
  80. static int ccnt = 8;
    9 J$ ]8 \2 ^* C+ A6 ?8 t( V: [

  81. + x* ]  r/ ^2 ^5 q+ y2 z" b0 U
  82. module_param(acnt, int, S_IRUGO);
    & j$ m; O- p0 E0 n
  83. module_param(bcnt, int, S_IRUGO);
    8 U/ y4 }9 g8 h' h( h+ `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" N" I5 x$ \1 g# Y. G! m% P
/ G& v" j1 S9 m0 L+ J" G6 N! ~0 c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) f: f6 t9 k9 N" j  barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' k2 G* K! L6 F& \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 u4 @* E. ?# b5 d3 l/ r
- v8 A% K, j" |7 V3 Z
' W/ [& d) _- O6 n: ~# }' ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 21:08 , Processed in 0.039994 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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