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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' k: r9 }* y& _4 E
  1. [code]EDMA sample test application
    . Q3 T) X1 ^8 `4 U- b! ?9 J
  2. /*
    + u. D- p' y8 J- d* I+ E9 ?
  3. * edma_test.c
    * _, T; d0 l1 J! C2 a- P! g3 s- |) W
  4. *, _! L6 W' G2 o* }! p3 @2 J. H
  5. * brief  EDMA3 Test Application7 T' ?* f; f, l( R5 R7 ~$ Z1 I
  6. *1 ^8 @: _' i6 @5 O1 R7 X
  7. *   This file contains EDMA3 Test code.  X! [% M1 c# M# V0 T4 L1 L
  8. *
    - K5 o& I1 U0 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / ]. r/ s. c- e& f6 A) T3 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ z% t: x# o- T2 ?; X0 _
  11. *         TO CHANGE." b: R& E- I3 e/ C6 B
  12. *
    ! u. t3 u2 X8 e9 S3 t, m/ J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * N; W; u' r, p; i: \" ?: a1 Y# _
  14. *
    % g* K5 Y( P% q- Y: J. G
  15. * This program is free software; you can redistribute it and/or$ Y3 h+ J+ ?' _) l9 F+ o' _
  16. * modify it under the terms of the GNU General Public License as
      A1 s# y) {- c5 s% ?* ]
  17. * published by the Free Software Foundation version 2.3 ]* I2 s- C8 }
  18. *( M' Y5 T  K9 ~7 ?4 P2 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ x" N8 \  i: x# ~! c) Z  J  H
  20. * kind, whether express or implied; without even the implied warranty
    ! w3 a; i+ ?1 e' H: G" h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; ?; L' @& Y4 l" `/ I
  22. * GNU General Public License for more details.+ R- i5 ^( b: Y/ H% V
  23. */+ A' O* w4 ^' ^' p7 p
  24. : h7 u' T( q$ V/ x: j8 _. j" D
  25. #include <linux/module.h>
    # I" u/ o4 ^# k, h
  26. #include <linux/init.h>  f4 }- @7 e5 v/ Q& H
  27. #include <linux/errno.h>8 M* b& e, q/ x7 x
  28. #include <linux/types.h>
    8 E. g: T7 k3 t5 N1 x; E  O8 n9 o
  29. #include <linux/interrupt.h>& U  B, }5 `9 [" J& O) @
  30. #include <asm/io.h>
    : {6 B8 v  l0 a$ F- A; @! M8 y
  31. #include <linux/moduleparam.h>
    5 g5 z% S: m" Q  d+ T; H0 M4 o4 E, \. k
  32. #include <linux/sysctl.h>5 V( ~0 D) T6 l/ ?" T! t
  33. #include <linux/mm.h>2 x  _1 x6 g/ F+ \4 c1 h
  34. #include <linux/dma-mapping.h>3 ?( B! O( ]! A2 x/ H) S: _2 @  `
  35. & }/ k- m# @; }
  36. #include <mach/memory.h>, U1 ~" U* ^2 B9 h9 x
  37. #include <mach/hardware.h>' h2 X5 s+ ]- c1 v8 `
  38. #include <mach/irqs.h>+ R/ Z. F  I. m1 m# X& n9 X# A
  39. #include <asm/hardware/edma.h>
    / n# P: U7 X' ]4 ~5 L9 R( d' \

  40. ! J( U4 Q2 E( j  o/ M- b0 M
  41. #undef EDMA3_DEBUG  z$ v& Z. ~+ _/ |# T$ _0 R: c
  42. /*#define EDMA3_DEBUG*/
    6 S! v/ U4 R5 Q  E0 R9 y2 `
  43. * T" c. A6 p9 X& a/ M
  44. #ifdef EDMA3_DEBUG
    ; i# c0 h# q' u7 k  I9 x7 ~0 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% m! h" S# o7 J( ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 _, q7 ^8 [  Z7 `* e8 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 W+ e% {2 z, W' v* m
  48. #else
    2 D: M, ]1 R5 e, j
  49. #define DMA_PRINTK( x... )
    ( M7 R! M) C/ E2 z5 f; ?3 j
  50. #define DMA_FN_IN/ n; A. V' w- x1 c1 B
  51. #define DMA_FN_OUT: t6 b8 ^1 b$ G6 j4 n
  52. #endif; C6 Q+ S1 S6 T, K
  53. 4 Y; \0 d* [0 B0 O4 ~' |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . J. R9 ?" I' E' s
  55. #define STATIC_SHIFT                3
    : u0 \# p: X6 C$ S
  56. #define TCINTEN_SHIFT               20
    6 B% j$ ^7 P# r3 P$ }
  57. #define ITCINTEN_SHIFT              210 s4 K$ k/ @2 f; p8 L
  58. #define TCCHEN_SHIFT                22& D/ [9 F' _& a+ h) _% Y6 b' p$ j
  59. #define ITCCHEN_SHIFT               23( ^; x% R! S2 S' E0 \! @# Z) X
  60. ! Q1 h, a& p' Y6 F5 X1 D* F9 p
  61. static volatile int irqraised1 = 0;
    # R% |5 W" f- P; `( Y2 R4 i
  62. static volatile int irqraised2 = 0;+ M8 Z- E6 o7 g0 f4 U' t# c

  63. ! Z( l; i, q; |3 E2 j+ s, U( N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 w1 o) u0 l/ K3 y7 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) w8 k4 I4 y' S  a% r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . f/ r. H  }9 w* V0 g3 u: d+ G0 B

  67. 4 x( U/ {# J5 C& _( h6 [+ \
  68. dma_addr_t dmaphyssrc1 = 0;
    # s, A  T7 H" s4 ?
  69. dma_addr_t dmaphyssrc2 = 0;
    ' ]! r! h4 b( y1 J. E- P; ]3 e% Z
  70. dma_addr_t dmaphysdest1 = 0;
    9 W% m% I$ D% d+ E" w  t
  71. dma_addr_t dmaphysdest2 = 0;
    8 Z. B/ ^. z) E' j' X

  72.   o8 L' t( Y1 U6 f; B
  73. char *dmabufsrc1 = NULL;
    7 x3 P9 G4 q7 S7 U4 }* T; S
  74. char *dmabufsrc2 = NULL;
    & l; |# C: z& s2 Z9 B
  75. char *dmabufdest1 = NULL;
    + i9 }/ T7 M$ M3 h/ V
  76. char *dmabufdest2 = NULL;
    ( f" x( y8 @9 U: S6 l' b: S- ^

  77. 0 S2 X8 X! w$ g
  78. static int acnt = 512;
    0 G' e  C0 E+ S5 [/ ]. r; {* h
  79. static int bcnt = 8;) O7 R4 |2 {; z9 Q, p9 _2 c
  80. static int ccnt = 8;
    & P. \1 L1 Y  R4 O  R, V# {1 U; O2 [

  81. 2 V) Q; E. q6 e% Y, {* j1 k
  82. module_param(acnt, int, S_IRUGO);
    & o& d! B5 ]  A6 K
  83. module_param(bcnt, int, S_IRUGO);
    / x. J# d, }; q: M5 a; Y. J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 f% [7 P6 M- F; b
$ Z. ~  Y9 o% F; T. ^- }  k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ F! s' n  E7 p( F. n5 D' X/ k0 g
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% E! G. O; C  C  b7 r8 x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 |- q) l( U/ d+ E  h

5 E5 R. h) x4 H& {+ A+ u$ b6 \/ J4 W/ X7 }+ H0 [/ B0 t/ c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 04:51 , Processed in 0.039901 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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