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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / M( M- H7 {0 W$ z0 V- O) U* `
  1. [code]EDMA sample test application
    ) l7 j, Q0 ?: K) `
  2. /*
    . M6 U* j4 O" D7 c, o# I. V' N1 l
  3. * edma_test.c$ b- |: _7 i& l* T) t7 u
  4. *- I( O6 d* u1 F: ~: f+ p0 R
  5. * brief  EDMA3 Test Application
    : u, K2 c; \4 z7 Y& v( ^% z
  6. *' `# V; b! b4 \  A  }( I, ^5 u4 N
  7. *   This file contains EDMA3 Test code.; v/ m0 U2 i1 Q8 Z' ]
  8. *, P8 a! v. s' D4 Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 i# b7 F, z. M3 \2 I% g$ r) o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! p4 E% ?/ W- U! s
  11. *         TO CHANGE.5 W0 Y. V5 v, u& o) C3 D6 c. e4 O
  12. *6 @$ Y* \7 `' j! X" Z7 `* s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' Z8 I/ r# R* d; e/ o8 d, ~5 H
  14. *6 o$ a) K4 q& X4 z- f
  15. * This program is free software; you can redistribute it and/or
    8 ~1 d& U; U# \8 ^  q
  16. * modify it under the terms of the GNU General Public License as
    7 h. g& g5 `0 o+ z/ T$ E2 M( R
  17. * published by the Free Software Foundation version 2.
    $ f  p0 G3 E4 f  Y4 i3 a: \
  18. *
    ; E# {" r: f- R' X# i% N" f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ b5 H* p8 N: q
  20. * kind, whether express or implied; without even the implied warranty/ e- E" {& g6 S- _3 g2 C  P6 _! B+ H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: f# b; _! s- G( X( M# `
  22. * GNU General Public License for more details.
    & n9 ~% T: P2 m) G5 ]' |+ f# A$ [
  23. */
    ; A! s3 b9 e) C1 p  X5 x) t9 W

  24. 5 p- Z! H9 f1 `( m% O+ ]
  25. #include <linux/module.h>
    3 [3 g7 o; p1 Q$ Z( y
  26. #include <linux/init.h>
    + y3 h# Y, x* z7 I
  27. #include <linux/errno.h>' T& y$ q+ p" U) ?5 m
  28. #include <linux/types.h>
    2 F' H  |# [' Z
  29. #include <linux/interrupt.h>2 u- p( I: o  U. M" e8 ?7 l
  30. #include <asm/io.h>  N3 J5 i9 a! k' o6 D
  31. #include <linux/moduleparam.h>
    , }( |# N( \' J" Y1 V
  32. #include <linux/sysctl.h>+ C3 e$ k) g* A8 V8 Q
  33. #include <linux/mm.h>- }" p* T  ~1 b/ J  G
  34. #include <linux/dma-mapping.h>" y! _8 U! A' o/ f$ _9 E  W
  35. ' C7 Y$ O3 a- w+ [4 Q. \: O
  36. #include <mach/memory.h>
    5 t6 k, }4 b: N$ Y: v( d0 D
  37. #include <mach/hardware.h>
    % i- y7 m: O+ l2 h/ A6 R9 E( m
  38. #include <mach/irqs.h>
    1 N7 o( X+ w/ V' e0 g( C1 @) J
  39. #include <asm/hardware/edma.h>5 d$ F7 I9 u, D1 Y6 L* x0 ]- [6 W2 r

  40. . t) {% E; P" C" z% O: v( X1 F( B' [
  41. #undef EDMA3_DEBUG, n' J7 O# i- I0 Y2 ?* V
  42. /*#define EDMA3_DEBUG*/) Q  C- t) t) W3 p! o" W
  43. / A. N: j8 R  k' b
  44. #ifdef EDMA3_DEBUG/ x* K2 k+ Z9 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 [0 u7 R- T% W, E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) R. `, q7 u3 j# F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 ^2 q1 r; V* |. w2 ~- h
  48. #else
    : I4 g, d" }) c  {
  49. #define DMA_PRINTK( x... )& ?. {; E5 G1 i* h( v- a
  50. #define DMA_FN_IN
    - Z  x- r- D1 X9 V% _8 E
  51. #define DMA_FN_OUT
    ) z/ S. w. k$ [% z$ J2 _" e7 ]
  52. #endif/ B+ b5 G6 D; z$ }' Z% ]

  53. 8 x2 a0 T; d# h2 R* H0 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* G. o+ D) w+ ^" d' M
  55. #define STATIC_SHIFT                37 ^1 p) k8 j- w( P2 Z
  56. #define TCINTEN_SHIFT               20# d$ N& E; y6 X& b3 s5 {) Q$ r# Y, V
  57. #define ITCINTEN_SHIFT              21
    ' ^5 F' M5 Y2 j  t5 J6 \
  58. #define TCCHEN_SHIFT                22
    & l/ D7 }: Y6 c# \# Y5 z
  59. #define ITCCHEN_SHIFT               239 P6 O; k4 H- x+ W

  60. 8 u0 a1 n8 C8 |* H# `
  61. static volatile int irqraised1 = 0;
    % ~* @. |$ U3 Y2 s: c; C- |
  62. static volatile int irqraised2 = 0;
    ) Y9 t- o$ M  k' r4 x+ ~
  63. : G' y4 q' M5 h- ^" U/ u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 s. w1 s& l) a! G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; G$ y; z9 Y8 C2 s5 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' i: t: P7 n1 R( [2 m

  67. & X7 B+ O8 U- ]
  68. dma_addr_t dmaphyssrc1 = 0;9 B( l% t* I/ T/ v  g8 s
  69. dma_addr_t dmaphyssrc2 = 0;  g/ {& p+ t' t; h( S6 a" M, K) W
  70. dma_addr_t dmaphysdest1 = 0;: m/ }! Y; A- E* x* w
  71. dma_addr_t dmaphysdest2 = 0;& G: |) n$ L  T6 Z2 Q- @0 y
  72. * r3 Q9 n3 y+ O# n5 a
  73. char *dmabufsrc1 = NULL;
    . Y; a" d, y5 U: R# j  w( Y  Q8 X
  74. char *dmabufsrc2 = NULL;
    ' d! H/ r6 `: Q2 C; j
  75. char *dmabufdest1 = NULL;$ W! [+ o: |* r; l
  76. char *dmabufdest2 = NULL;
    : ~( Y& V" W2 B3 u! h; L2 R! s: X

  77. " s0 ]8 B4 q! W: l5 ]% @3 E
  78. static int acnt = 512;
    * U% ?- {" f+ d. U' |  K: \; ?, N
  79. static int bcnt = 8;
    8 u+ h% g; d/ Z2 o
  80. static int ccnt = 8;5 y9 z# r+ _4 W+ q/ v

  81. ; [8 j( b" L% H1 t, Q! F* j
  82. module_param(acnt, int, S_IRUGO);5 j/ Z2 x6 u+ j$ c8 a7 [. B8 s
  83. module_param(bcnt, int, S_IRUGO);3 l( X0 O; j3 o$ b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% N( a' @) T0 d1 @: u
. X7 p# m. M/ Q) \1 s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 k$ U* \$ k& Q* d- [8 {4 |! x, Iarm-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' |+ Y2 {# x2 j0 ~% R$ Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 U, S% X# z  Y) Q5 D
/ [- b3 ?( s! r: U: i) j- C

; g; N4 b  F) ^9 j9 {* I4 L+ e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-7 15:08 , Processed in 0.037454 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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