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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 k, J+ _6 d7 j' W3 a( [. K
  1. [code]EDMA sample test application5 ]! X# f5 l; z9 G: N
  2. /*
    , \9 V; f7 U! \8 L' u# [; s3 _. H
  3. * edma_test.c
    9 I! b  }* ?* S' Q+ d
  4. *
    - @; T6 D/ U' V. ~, s. {/ N* G3 E
  5. * brief  EDMA3 Test Application
    9 P  \8 z( A' @; @! N# P2 a
  6. *  w& y% A1 J: I# ?; r! _9 K- @
  7. *   This file contains EDMA3 Test code.
    / V6 C) Q6 h+ Y
  8. *
    3 F& q- e) y7 Z: E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; W7 G  N' @7 l& x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# P# |' b) B* Z$ e9 j. G1 R  h
  11. *         TO CHANGE." {  u! {( {, W2 |+ |; k+ }* T% r/ g" V  u
  12. *
    / m5 v) \& W, M3 ~. H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. `+ f# Y; n/ k
  14. *$ E- A, T$ `8 b, j6 g, J
  15. * This program is free software; you can redistribute it and/or1 V) ^) {/ o* I
  16. * modify it under the terms of the GNU General Public License as' R) N; d4 }; L: \+ P
  17. * published by the Free Software Foundation version 2.
    9 S, |1 Y/ L6 r- w! z
  18. *
    9 w3 Y, i7 V! a" m8 t5 q5 J9 j( S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ J( I9 E" A7 \& w$ I; U2 F
  20. * kind, whether express or implied; without even the implied warranty
      |7 x$ _! H' N  e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : L* ]% E5 U8 D6 Z  r9 `) Y
  22. * GNU General Public License for more details.
    7 J- D' N6 c% p2 r3 g, ~
  23. */# d. A* L9 o8 j4 \
  24. $ O; F- U! Y% q$ K$ r* X5 Z1 v
  25. #include <linux/module.h>! y# Z( P% K6 q
  26. #include <linux/init.h>
    . `: O, a  O7 D0 ]
  27. #include <linux/errno.h>
    - i: U8 a$ d' u) h1 b
  28. #include <linux/types.h>
    - F/ g. ?4 U5 y3 C; W0 V
  29. #include <linux/interrupt.h>
    , ?, \% g& X( D" t6 M. L) D: `# O
  30. #include <asm/io.h>. l' P% z! f; n" e, k
  31. #include <linux/moduleparam.h>
    : Z- R  s/ s9 l/ U
  32. #include <linux/sysctl.h>' n, R% S, u" q# ]- z
  33. #include <linux/mm.h>
    1 h1 W+ m! ]- k* A$ d" D
  34. #include <linux/dma-mapping.h>4 l9 w# p$ w! Q
  35. 6 D2 f# n$ b) Y7 N
  36. #include <mach/memory.h>
    - Z1 x- p3 H  K. z" {
  37. #include <mach/hardware.h>
    ( p3 M* _' E3 }5 q- b; g
  38. #include <mach/irqs.h>" K/ ?- T* n* H  e$ a' ^9 h! M* O1 }2 Z
  39. #include <asm/hardware/edma.h>5 D% h( ]- }2 I' s8 J7 Q/ n1 e
  40. . F0 N4 N5 k: m% P8 ]
  41. #undef EDMA3_DEBUG/ T! N! {& \6 M; [. p/ O6 U
  42. /*#define EDMA3_DEBUG*/2 |0 H6 B0 }2 x8 y1 ~
  43. 2 @- Y' y" l& |% Z
  44. #ifdef EDMA3_DEBUG6 U7 r6 c3 Q- J7 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  y, M/ c1 P' w: D- {9 ^6 t- E/ O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 ^% D: A$ z2 z% B* Y$ u+ s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ q/ C* A8 p" P
  48. #else
    5 {3 h! L6 _1 O
  49. #define DMA_PRINTK( x... ); g7 b# x( L5 I; t: I  P
  50. #define DMA_FN_IN+ {; j' G, D6 }7 H8 Y$ F1 M5 l
  51. #define DMA_FN_OUT
    . j, V( T+ T. E
  52. #endif
      ^! ^1 H8 r2 S" t
  53. ' f0 |$ o/ p  y% ~% ~* ]0 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 x: e9 ?3 M6 {
  55. #define STATIC_SHIFT                3! @# t. @: R$ Z. U; a
  56. #define TCINTEN_SHIFT               20# X+ ^! p' V0 s0 D1 a
  57. #define ITCINTEN_SHIFT              21! v" y2 Q. p# h: y3 M
  58. #define TCCHEN_SHIFT                22
    2 \- ?7 Z# c1 H6 s* d
  59. #define ITCCHEN_SHIFT               23
    6 P' u: Q- x8 V% L$ r1 p7 `
  60.   L6 ]( w; X4 D1 x( l& P1 q! \0 W& m
  61. static volatile int irqraised1 = 0;
    2 U* w& O* _: F8 o% @/ `
  62. static volatile int irqraised2 = 0;, c1 C# }' l' k5 c( K( c1 Q
  63. 2 ?$ [3 i. L0 l+ D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* {" w5 _; c9 J  N$ K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 {" m7 \# B8 o( {7 c- w7 f0 b; q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # q" U* Z# R0 J  _

  67. - o" h4 T  `4 k$ j) g$ @* Q
  68. dma_addr_t dmaphyssrc1 = 0;
    7 P# J$ W3 f* y. y$ a' E" N
  69. dma_addr_t dmaphyssrc2 = 0;9 U9 D7 ?! L5 s9 z& c" u
  70. dma_addr_t dmaphysdest1 = 0;) Q/ R+ }. _! i, i0 {9 R
  71. dma_addr_t dmaphysdest2 = 0;# O, I, Q0 @; t# V6 A  W. M
  72. , T6 \6 [' [/ O% a* x9 f/ d/ m" a
  73. char *dmabufsrc1 = NULL;1 y! ?* ]1 z4 f& ?9 I
  74. char *dmabufsrc2 = NULL;
      W# y7 `+ @. I: Q
  75. char *dmabufdest1 = NULL;
    4 S7 K2 ^; B* G) M# }
  76. char *dmabufdest2 = NULL;6 o7 y) L: h+ o, k
  77. 3 d" T& ?/ ^- V
  78. static int acnt = 512;
    , F) |+ y  o+ N
  79. static int bcnt = 8;
    ' t3 J) W/ ~3 X1 h3 s7 j
  80. static int ccnt = 8;
      ~+ u5 A$ d( p) S9 {

  81. + z) g) c+ i4 ]* O# Y
  82. module_param(acnt, int, S_IRUGO);' Q  G( D4 p1 d9 K
  83. module_param(bcnt, int, S_IRUGO);+ |. @' X* r7 r7 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# ?" }' s! |: r4 t$ S6 O5 C3 x0 K. f! u, X- H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 M5 G/ G8 i0 x! V( S& k5 [. V2 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  p0 B% E/ e: _  |6 v3 p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ i; J3 H6 T- G5 g* J
. Z: q9 R3 {' L# m

  X5 Q) M1 t2 K( |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 08:46 , Processed in 0.042744 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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