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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 ]5 V+ d) x8 z5 ~, G. t5 |. ]
  1. [code]EDMA sample test application
    7 n- [( Z  A! |# `9 w0 a
  2. /*5 s- C6 O9 Q( }  X1 q  \
  3. * edma_test.c$ {0 _2 ^/ s: N8 B
  4. *, U  M- p  r4 X" r' y5 {
  5. * brief  EDMA3 Test Application
      i& S. w- L# b, v
  6. *
    5 p. ]+ d" C& b# v2 N
  7. *   This file contains EDMA3 Test code.! F% k  r$ i9 ]3 q8 E
  8. *
    8 N$ h& l3 z2 g9 j! v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: y4 _2 I: l4 B1 [2 p7 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! _. _9 F% A2 W
  11. *         TO CHANGE.
    . u8 \9 ]5 i) R/ P9 t) a2 `% `
  12. *
    7 Z; F4 O0 K! x2 x# ^, ]% A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 j2 v2 t* _, [/ q
  14. *
    2 A* W# B& `1 u
  15. * This program is free software; you can redistribute it and/or7 @) ?  y5 l1 ~3 c% D, R7 u
  16. * modify it under the terms of the GNU General Public License as
    1 a; V& P& W; n. y9 W% P
  17. * published by the Free Software Foundation version 2.
    - n! |5 n7 G- ]1 Z" Y/ p6 B
  18. *) H2 ~3 {+ J  i/ f2 M. V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 }3 t3 d, `' h  e& M1 Y; I! p* h
  20. * kind, whether express or implied; without even the implied warranty7 Q5 ]+ B# v$ J. x/ X- {+ k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; j5 c/ J* b  J6 y& v
  22. * GNU General Public License for more details.
    + O( M9 h( O% q" I/ }9 s# {- L
  23. */- N# e' J4 X+ W4 G- [# _
  24. 1 r$ j8 V. a4 n2 x. L  m
  25. #include <linux/module.h>
      M0 K9 w9 x, a
  26. #include <linux/init.h>- r% h% y0 ]; Z% J. r, }
  27. #include <linux/errno.h>
    + j. X% {) P9 B' z  [
  28. #include <linux/types.h>3 N& E% O3 Q# s6 C
  29. #include <linux/interrupt.h>
    ' \! `2 c0 D$ z+ O
  30. #include <asm/io.h>6 s/ O7 w9 \! e) J/ L) h
  31. #include <linux/moduleparam.h>
    7 m% F8 Y# F, E1 W* H9 @
  32. #include <linux/sysctl.h>
      ]4 W& i% E( M% @) K% {
  33. #include <linux/mm.h>
    0 U+ i8 C+ f6 K) X/ P; ^: ^
  34. #include <linux/dma-mapping.h>
    3 S, Q, B5 z1 B3 ^1 k5 G* F
  35. 3 C! W: _! l+ V. ?$ j; S
  36. #include <mach/memory.h>, k7 Y' w( [! K. j2 H6 ?
  37. #include <mach/hardware.h>) `: l5 P: ~3 Q! J5 c3 X
  38. #include <mach/irqs.h>
    $ {- C: i' C3 h+ c) N7 ?# l
  39. #include <asm/hardware/edma.h>7 u; m- w0 Y  P/ M! e) ?

  40. 6 C9 b5 _5 z3 w8 s6 y* [4 s$ R; t- J, ]
  41. #undef EDMA3_DEBUG1 ]  n) ]+ X" M5 E& S3 e
  42. /*#define EDMA3_DEBUG*/, ?6 z: A2 y8 x" w  T7 z; B

  43.   n0 h1 V% f! l  G
  44. #ifdef EDMA3_DEBUG
    / o( _& A1 Q& Q7 e7 C. G1 h# @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 t, S9 I, P# x: r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! W# V8 W% T- z2 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) {. }; y" S& z: d+ ]& \% Q/ H! Z
  48. #else
    " K" p, {& \* Q" w& _; F
  49. #define DMA_PRINTK( x... )! y1 [3 r" ^5 P0 B4 f
  50. #define DMA_FN_IN
    " E6 E! M4 Y. o8 g# o# |
  51. #define DMA_FN_OUT
    4 K# R  j; g$ s6 h- l( u
  52. #endif
    # K! W/ ~/ L7 t4 E% A8 X& X

  53. 6 R+ r1 ~' L. \1 u: `3 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- {$ z2 |, a' z' h4 p' S( P5 G- l
  55. #define STATIC_SHIFT                33 M& O# D6 i: ^! ~5 g
  56. #define TCINTEN_SHIFT               20) I: U" Q$ M$ k7 T9 H! \. V
  57. #define ITCINTEN_SHIFT              21
    3 h1 G( C8 b8 Q5 `" l: k
  58. #define TCCHEN_SHIFT                22" f- \/ H8 F' \, S6 @9 G1 @, Z
  59. #define ITCCHEN_SHIFT               23
    3 ^7 f/ a9 h* _
  60. , u( p" e2 d2 I4 p" `
  61. static volatile int irqraised1 = 0;- w5 \2 x/ W5 p# Y/ V
  62. static volatile int irqraised2 = 0;
    7 n5 }& B8 ~" z+ z) v5 R' b
  63. ' g+ h" d% U: k6 z# J9 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! j- X; @5 j" \# V9 T/ L1 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! k3 h' P4 A& i5 S6 G! m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      j1 w3 N3 V2 Z/ Y. V
  67. . H& c- i6 ?6 |8 \( d
  68. dma_addr_t dmaphyssrc1 = 0;
    ' ^  F+ W7 e" I6 n
  69. dma_addr_t dmaphyssrc2 = 0;
    0 Y% M1 j( S7 A9 v" D
  70. dma_addr_t dmaphysdest1 = 0;
    - u  Q8 q8 ?9 V7 I
  71. dma_addr_t dmaphysdest2 = 0;) e3 s0 f5 V3 o1 F0 ~8 p% A
  72. 1 N' S- q" J  ?/ T
  73. char *dmabufsrc1 = NULL;9 n/ P; j$ Z, z/ s
  74. char *dmabufsrc2 = NULL;
    , g; ]+ r6 E# I# b& |. ]
  75. char *dmabufdest1 = NULL;
      Z0 V$ e2 x5 P. y
  76. char *dmabufdest2 = NULL;1 q. v. H% R# R
  77. . z$ |! Y" X$ [
  78. static int acnt = 512;
    1 K2 Y+ g# n2 m6 c7 `5 U
  79. static int bcnt = 8;
    + r) Y5 ]) K( N/ A, X
  80. static int ccnt = 8;
    . P2 E; \. I. c, h6 t

  81. 2 ]  e: q9 D* q& u; s
  82. module_param(acnt, int, S_IRUGO);
    ( r6 v# x  V9 W; v: C" U& S
  83. module_param(bcnt, int, S_IRUGO);
    8 }: |0 }3 v5 j: _! o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 B3 S6 z" ^2 K) J+ a. T/ t& x. H% d8 Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 W: `' c6 O3 Q" S9 Q9 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! Q1 w' B8 }, _) b5 L' s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; m: B; ?) w. d) W5 g7 t( r( l. K: X- l$ c: f& V
+ c% A+ M% D* O" W) i4 _' @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 03:10 , Processed in 0.040900 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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