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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - t6 {) x3 l, |) L/ N7 u/ s
  1. [code]EDMA sample test application5 C% b/ t6 x+ h, X9 ]
  2. /*( k0 v2 _6 O! y+ W
  3. * edma_test.c! v( J; ?* [. c0 N7 a9 e
  4. *
    % K: @, ~  C8 F& j: q  _) o" r
  5. * brief  EDMA3 Test Application6 J  \9 \$ e  p- w  G9 A: Q* c
  6. *
    3 [2 [2 m  q+ L6 S
  7. *   This file contains EDMA3 Test code.
    ( _7 G! j# o$ V& K9 z
  8. *& U' E8 M! V9 ~) Y+ |3 r4 w  G+ H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 D& \$ I9 d5 Z0 n% J" w  k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- C2 c  {- W9 `: Q  \
  11. *         TO CHANGE.$ d/ \! g8 }) |% H7 D
  12. *
    ' k5 N% @* T3 U# Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % k8 x! J6 m5 i7 S! t
  14. *7 ~. s% [: a- n9 {7 s
  15. * This program is free software; you can redistribute it and/or  ~+ g  h$ T# W" v4 C3 v
  16. * modify it under the terms of the GNU General Public License as
    , n' T! V6 `- c& q) {
  17. * published by the Free Software Foundation version 2.
    $ k! e' f; B) ^; g; A$ [* @/ g9 D' C
  18. *
    % ?+ Z& e9 v: `$ f& f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ _0 A& u8 Z4 P% d( B
  20. * kind, whether express or implied; without even the implied warranty
      }, j+ o  \; W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 R- p- ~3 @$ y) a4 A
  22. * GNU General Public License for more details.( z2 S3 a( I  _# f- M
  23. */
    4 ?& N5 P$ W$ n" H

  24. , [) O+ n+ O- Z; j4 h% m
  25. #include <linux/module.h>$ R. N9 U' @3 k  b
  26. #include <linux/init.h>
    ( q, }. q% X" m$ U
  27. #include <linux/errno.h>5 U# X! ?; U3 T: k$ C$ S7 T9 S7 T
  28. #include <linux/types.h>
    1 F0 [6 z4 @( s& z  F" u
  29. #include <linux/interrupt.h>, r! I1 s% h& `8 j
  30. #include <asm/io.h>6 y" ]6 `& p. h4 m; M; a( l4 q
  31. #include <linux/moduleparam.h>
    / k+ E; n( z6 F, X. A8 Q
  32. #include <linux/sysctl.h>& |* v' g$ Q, L! y. m# `
  33. #include <linux/mm.h>: Q0 C! _; K9 ?# q/ C- q7 S
  34. #include <linux/dma-mapping.h>
    - Q$ T; R& U1 R0 @

  35. # w' l0 }6 w" R1 s) r! L
  36. #include <mach/memory.h>/ c2 H) ]* d+ ?1 s- d! [9 ^! O: P
  37. #include <mach/hardware.h>
    6 p6 x/ i# w, }7 C# H8 u4 I
  38. #include <mach/irqs.h>
    3 C0 K3 ^* f" ?
  39. #include <asm/hardware/edma.h>
    " i5 e" V; q8 H8 c: B, @
  40. 6 [& s3 R" x4 ^
  41. #undef EDMA3_DEBUG! e- u( r* W( o5 J5 ~
  42. /*#define EDMA3_DEBUG*/# e. k* A: L' W/ l- b
  43. * q( Y. z$ K2 i5 c9 o8 P
  44. #ifdef EDMA3_DEBUG
    + o- S, {8 P% V) a$ O8 W; z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 k& t5 x! @9 {+ ~: ~7 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 H* [% ~5 a" V- p- W1 R( l- L/ r2 M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 j0 G- f' a( G4 O, y$ a$ I3 Y
  48. #else
    9 S+ z) U. v  q2 H
  49. #define DMA_PRINTK( x... )0 V5 ^2 _( C1 E8 ]. |6 T( f# w
  50. #define DMA_FN_IN9 F) l1 r" e0 _/ B1 H0 [
  51. #define DMA_FN_OUT
    ' D: {2 Z% t  y" Z0 W
  52. #endif) i# f3 [5 N6 o! X
  53. . ^8 J1 K4 i# `* M' B9 u7 i+ ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 E: Z  n& g9 B; s/ ~0 D0 V
  55. #define STATIC_SHIFT                3
    1 N7 ~% Q& e2 b5 u& [" t! v
  56. #define TCINTEN_SHIFT               20- C* M! d- u( p6 B4 d/ _' _. D: z- a
  57. #define ITCINTEN_SHIFT              21
    / l) E8 q; W) E
  58. #define TCCHEN_SHIFT                222 C# T$ S. o* p3 K( ?5 ~, q
  59. #define ITCCHEN_SHIFT               23! E- {$ h) O% x. M6 m
  60. 3 v$ U) o( L3 y# [
  61. static volatile int irqraised1 = 0;
    ' O" j# x5 C) [7 F, |4 M1 i
  62. static volatile int irqraised2 = 0;
    8 n3 X; T+ d8 s$ s+ Q3 w

  63. 7 E6 y3 S( E( R, k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & B  }. Q/ d& A$ P, q* w  o; d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 s# ~( O9 L. S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 H. s- k0 d! o6 b( ?; w( x
  67. ( Z0 [  t" s/ b  |% v& G$ g) M7 g
  68. dma_addr_t dmaphyssrc1 = 0;
    1 ]1 f3 M4 R4 z9 Q- F9 Y
  69. dma_addr_t dmaphyssrc2 = 0;, {4 |/ f- L4 @" Y0 I1 p
  70. dma_addr_t dmaphysdest1 = 0;
    , a5 z& ]1 n! _8 ^, s+ v, `
  71. dma_addr_t dmaphysdest2 = 0;
    . q4 u/ [$ A, ]2 t! o  z- c! Y) l
  72. 5 K. F. q- C/ l! q7 A3 v/ c
  73. char *dmabufsrc1 = NULL;
    5 y& ], R9 T) g: O5 T2 q
  74. char *dmabufsrc2 = NULL;- K/ g1 d2 ]+ |# I" y' P
  75. char *dmabufdest1 = NULL;
    7 y- ?. v$ ?/ J! J' p3 f% n, A4 S' v
  76. char *dmabufdest2 = NULL;! z2 |7 [9 z  H) i+ ?' S
  77. 8 x/ j9 T% h) Y5 C1 l1 X0 w! e
  78. static int acnt = 512;& o3 o( {; E6 |
  79. static int bcnt = 8;
    , E6 S3 d; d& j1 Q5 a# ~
  80. static int ccnt = 8;
    : o0 b; Q2 f4 \7 {" f- q: q" n; R: D
  81. 8 `) j8 ^, n1 O5 L0 I
  82. module_param(acnt, int, S_IRUGO);
    $ {; D; I' k: s7 C
  83. module_param(bcnt, int, S_IRUGO);( U& e+ o% k( `; n# u6 }
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) R+ K% Q, M1 Q! p6 a
' j( k7 X( x# S% M" u! j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ [1 h9 L6 |: g3 Z; q4 F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ d( G) z- G6 o+ I8 l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* J! n2 {) X+ R  r# d6 C  a- r& @  J/ U' r( I3 h6 n

* K7 ^, O, h, S, V" h* p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-16 20:42 , Processed in 0.038076 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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