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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * K% V& e+ L9 c$ u
  1. [code]EDMA sample test application
    ! O: z# Y7 G* J
  2. /*; p7 F+ `- K% R
  3. * edma_test.c
    4 E. q; K' h8 g& s
  4. *. n% M' L5 P8 ]- }1 ~
  5. * brief  EDMA3 Test Application
      F7 [: Q+ z9 H' I' x# h% d
  6. *7 ~5 F" ~& Q+ Z- F( T! ]
  7. *   This file contains EDMA3 Test code.
    9 n% N8 {, ~# ~$ Y$ B2 a* Y) n  T7 ]
  8. *
    2 X5 l: d4 E9 R+ j* J' x# `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 N  u) ]1 _% d$ V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % O9 e' l+ a+ p- ~" c
  11. *         TO CHANGE.; M- @' W- t$ \" `' z% |* A
  12. *- c! \2 K3 m7 L7 L6 n  v* l% d: G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 P  s2 |. H; u. \+ U& b+ @
  14. *
    ) h$ g% }; K& N# X$ Z
  15. * This program is free software; you can redistribute it and/or' v" i& ~3 h0 c, |
  16. * modify it under the terms of the GNU General Public License as# ?9 ^" T, \. S! i, ]" {
  17. * published by the Free Software Foundation version 2.6 ^1 n; y: R9 I) C) t
  18. *" G4 @4 M7 ]- y) A/ @4 [* g* I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - c: ?% L( r4 C3 M& C
  20. * kind, whether express or implied; without even the implied warranty
    # L3 c' q* \# b4 C  N+ u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- A# r' J# d* n7 M' ^
  22. * GNU General Public License for more details.
    3 s" x$ ?! h1 f3 @& T  Z0 a5 ?
  23. */: n5 }/ @# J  n
  24. : Y+ b1 m4 v6 y) c+ ?
  25. #include <linux/module.h>
    0 F; B8 Y( r! X/ B7 X4 ]% ~
  26. #include <linux/init.h>" b! `4 p8 L/ B7 T; ]4 N" {
  27. #include <linux/errno.h>
    % Z8 z: ^1 B7 Z& y  p2 s7 i
  28. #include <linux/types.h>0 N! O8 V( F7 o. x- s' s
  29. #include <linux/interrupt.h>
    1 ?: m& }9 \' b  M' f
  30. #include <asm/io.h>
    8 c3 T; y, D: W, _9 E' g
  31. #include <linux/moduleparam.h>
    6 b& {% i3 W; C+ u9 S7 H) _  p% q
  32. #include <linux/sysctl.h>6 v. b3 Z: d# |' H
  33. #include <linux/mm.h>
    : E- {+ D$ d1 r& B8 v
  34. #include <linux/dma-mapping.h>
    1 X% Z+ F9 V/ j8 S. n
  35. " J$ Q/ ~" a" f- V' {# z& C5 O% n
  36. #include <mach/memory.h>
    9 M4 P# f* T' O) s5 g
  37. #include <mach/hardware.h>- ]9 w3 B8 _3 Y4 M5 y
  38. #include <mach/irqs.h>
    6 B' E3 |& r9 W8 u  e. B# d
  39. #include <asm/hardware/edma.h>
    2 G; B' a( p$ F2 W0 z
  40. 0 z. i" u! q, ^  K# y- _
  41. #undef EDMA3_DEBUG
    $ a1 C6 h% P  O, f
  42. /*#define EDMA3_DEBUG*/
    # V$ N6 z0 }  i7 z8 P+ P2 M" K+ [) d
  43. ' m5 v7 r$ V  ]: m2 \5 `
  44. #ifdef EDMA3_DEBUG8 v0 u8 I+ r6 w$ P6 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! j! v1 a  r9 x% C% ^* ^/ K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( G5 v: u* T5 F; G1 G- R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - Q7 o) _4 p" r+ Z0 `% d+ q
  48. #else
    7 c5 V% {9 u  T5 Y+ z4 D
  49. #define DMA_PRINTK( x... ), J" z# a8 w' Q) U, d/ c! F1 A
  50. #define DMA_FN_IN
      ^4 S9 E6 k2 a6 N, R6 A; \  b
  51. #define DMA_FN_OUT% @) r5 Z3 U' I
  52. #endif/ \1 L9 }2 _( {& Y% J; A" J0 L

  53. 6 k  v& k/ ?5 T! W5 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 ]4 q) I- S- S9 E" o3 n
  55. #define STATIC_SHIFT                3! B& i7 E" ]! o; C# L$ \7 g( }
  56. #define TCINTEN_SHIFT               20. M% q, V4 n6 V$ o
  57. #define ITCINTEN_SHIFT              21
    5 @3 g6 |& Z8 Y$ `1 V, I7 Q5 |' ]% u
  58. #define TCCHEN_SHIFT                22
    7 R$ e5 R" ]' A9 n$ r( l9 I1 Y
  59. #define ITCCHEN_SHIFT               23
    ) W4 X) E: U3 p* m  X; j* H+ g3 I

  60. - u8 b$ P  y0 G2 B: h
  61. static volatile int irqraised1 = 0;4 a. W/ w" n  l1 s5 p
  62. static volatile int irqraised2 = 0;
      Q3 ^2 y6 a6 [) \* v
  63. ! f3 I) c1 P- x7 i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 V) Y; V$ H4 \3 Z9 }- B: A! I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) o6 @3 K3 q( w0 p" U5 y8 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# l$ ^0 g# N, M, I2 U1 `; }  |* E

  67. 3 V0 h" j! o, F+ o% C# T
  68. dma_addr_t dmaphyssrc1 = 0;6 X1 X: g) V3 `% I& d
  69. dma_addr_t dmaphyssrc2 = 0;/ ?. ?; o2 P$ g+ t
  70. dma_addr_t dmaphysdest1 = 0;- U/ H2 ^- s; n2 t
  71. dma_addr_t dmaphysdest2 = 0;
    / v1 o. U3 a) A, U( a

  72. 8 {* u8 V, X) A" V: y. C1 O
  73. char *dmabufsrc1 = NULL;
    8 b0 R6 c; K& R3 d6 e5 K, s3 R
  74. char *dmabufsrc2 = NULL;& d, V2 V! D9 j4 |" f7 g
  75. char *dmabufdest1 = NULL;
    9 f% m, p) d& B" M
  76. char *dmabufdest2 = NULL;' `. ?$ g' @- A+ {5 c$ q
  77. ; j3 i% U# K2 B- D) T
  78. static int acnt = 512;
    7 b) E$ a0 T/ g$ t9 A* y1 k9 J+ S
  79. static int bcnt = 8;
    5 u: V- u0 H: c
  80. static int ccnt = 8;
    , f2 f7 H9 x6 A: @+ `' v

  81. 0 p8 G- }6 R/ J2 e7 C* I2 f" ~
  82. module_param(acnt, int, S_IRUGO);) x1 f1 c/ H( ]9 c' q
  83. module_param(bcnt, int, S_IRUGO);
    1 @) U# U4 ?( ~3 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. m' I5 v, Q1 g
' U! {8 ~/ \7 N2 Q3 e! ~4 A& _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 y2 I! L7 x# L4 T" i  harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' c# h# [4 `+ z4 `" h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# @5 t+ E8 F+ J. \* p1 q3 A! h5 V- K: ^  ^# P

& X5 F3 k4 C; h# c5 G& w- d6 J. D& ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-18 15:46 , Processed in 0.041750 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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