OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' I: R# z2 L3 v( ~0 {+ k
  1. [code]EDMA sample test application
    : a3 {$ R7 r  Q, I5 e
  2. /*
    + \- j" V6 X4 }" W  q  v' Y- _
  3. * edma_test.c6 i+ [& t* }, k0 Y
  4. *6 ^% |- y; d/ ]! Y9 A( F& g
  5. * brief  EDMA3 Test Application
    2 M9 P/ Z1 c, x! u9 _
  6. *' ~2 X4 d0 ~7 J. G$ `+ ^
  7. *   This file contains EDMA3 Test code.
    , L) E/ Z0 i" N% {
  8. *
    & Q  J; N5 W) x7 X. e; l. q& Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # ~! X: a/ {8 [, |9 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " ~# g8 A0 G4 M8 U5 ]
  11. *         TO CHANGE.
    3 K  V$ X% S+ ?4 A! ?4 B- [" A$ h, W
  12. *4 b2 n, G2 _- v" ~7 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , q0 n7 K2 {" Q$ Q6 b
  14. *
    * L% X5 x1 M& B/ x
  15. * This program is free software; you can redistribute it and/or/ J% s% `# @# m: X$ h5 H# \
  16. * modify it under the terms of the GNU General Public License as. _4 w: K5 f& Y3 [" [
  17. * published by the Free Software Foundation version 2.
    % }( e- e; h, N0 S* B: T4 t& y" z" i
  18. */ o0 h5 G! x/ _' w- P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. u1 J! w; Z5 S: Z7 @) G% Y+ s
  20. * kind, whether express or implied; without even the implied warranty! W" t/ a* a* e; E, x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 H# S: V( R$ f5 i1 J! ~" G8 s
  22. * GNU General Public License for more details.7 j! t) a- n7 F" U6 U. x" n9 d
  23. */
    . p0 R  B# c3 Z0 H
  24. 6 R- p, r% e6 |) D, x* R* W
  25. #include <linux/module.h>
    & e2 I7 S1 g0 D5 c, `
  26. #include <linux/init.h>
    ; x: j7 t# B# W! }! N8 I; i
  27. #include <linux/errno.h>
    # a  p4 D) N  \0 [; i3 {
  28. #include <linux/types.h>
    ( V7 b8 r6 h4 r
  29. #include <linux/interrupt.h>; Z+ t" h! v3 p: x- N
  30. #include <asm/io.h>" ~) W; t% C0 V. c- @# j
  31. #include <linux/moduleparam.h>
    , Q  E3 z$ o7 ~
  32. #include <linux/sysctl.h>8 }* v0 \  }& ]) L
  33. #include <linux/mm.h>
    . N; o, T9 l1 e+ E
  34. #include <linux/dma-mapping.h>
    2 x1 T( T7 l- ]4 f

  35. ' L9 ^0 A. O  R- Z0 G- F
  36. #include <mach/memory.h>  h9 c: p  k9 _
  37. #include <mach/hardware.h>
    # p" X; y7 b: X3 m3 p
  38. #include <mach/irqs.h>
    $ P. r* H$ C# o$ E
  39. #include <asm/hardware/edma.h>
    ) ~/ _/ F, |* U- ^
  40. # p; E' ?$ d: \0 |
  41. #undef EDMA3_DEBUG
    / `& {1 h* A  Z. C4 B) f
  42. /*#define EDMA3_DEBUG*/+ @+ @+ d9 J; Q( R5 J0 V+ M1 ~
  43. ' o& Q' S+ e1 b# _6 u/ w
  44. #ifdef EDMA3_DEBUG
    4 n" `2 ]3 D4 d4 P( ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; A8 u! V' e3 [- \& h) `( `. b4 b! h2 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & M: Q0 E' Q* z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 u6 r1 B8 V" w& Q; S6 K; }% d
  48. #else, F; l* H+ y$ E1 [8 P, ^2 l* e
  49. #define DMA_PRINTK( x... )
    & ?; i  s6 k$ t$ {
  50. #define DMA_FN_IN
    ( L$ R4 h* Y% o( W9 y
  51. #define DMA_FN_OUT2 c4 q- x- q, R" p7 h- P
  52. #endif
    - Q' W) k  E: D6 \( v9 q

  53. 2 z( t8 M+ p# y* u1 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # W- \- ]8 Z% |4 X2 t
  55. #define STATIC_SHIFT                3
    # Q! U* \7 e: C/ W
  56. #define TCINTEN_SHIFT               20
    . o) ^; X; J# b  @( T4 [
  57. #define ITCINTEN_SHIFT              21
    $ n; x) k6 D1 R
  58. #define TCCHEN_SHIFT                22$ l$ w8 x$ v0 b' A6 L' C
  59. #define ITCCHEN_SHIFT               23
    ' L- E$ I% N/ s2 e

  60. 5 M  A* S  J: w! Q1 D) `) ^9 V
  61. static volatile int irqraised1 = 0;$ N2 W' D' @3 W+ i3 r
  62. static volatile int irqraised2 = 0;
    1 A. A0 a7 ^7 F4 R( `( C

  63. ( G  d6 f5 K# a" F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * L5 D1 e+ t( N9 \1 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ C+ J* m( [" V' C& g4 Z% I# h) ?4 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( o9 }6 M3 U; s. U
  67. 5 `) F1 ~9 E$ e0 k2 I- a. S
  68. dma_addr_t dmaphyssrc1 = 0;/ j& N+ Z, x: r
  69. dma_addr_t dmaphyssrc2 = 0;
    2 J4 X8 B0 v+ ~- C
  70. dma_addr_t dmaphysdest1 = 0;  j: n8 S' |+ u! K4 I; Y
  71. dma_addr_t dmaphysdest2 = 0;
    ) G9 B1 h6 d5 i# }: V

  72. 6 O* d3 i* p1 r1 x" k% v! C
  73. char *dmabufsrc1 = NULL;$ y( k0 `8 x0 i# Z, H# v0 W( l
  74. char *dmabufsrc2 = NULL;9 F5 t; F" u0 J, b$ K
  75. char *dmabufdest1 = NULL;+ ^* }; G3 l7 j. N% p) F+ a
  76. char *dmabufdest2 = NULL;
    6 H% c# b+ @- A- k8 s0 R2 F

  77. : h" ~' ~, o# d" ^6 z8 R1 K; C
  78. static int acnt = 512;+ G5 J! h' S. G, z) v6 B0 ~/ y
  79. static int bcnt = 8;
    ( V2 s1 D, c: B1 T4 e
  80. static int ccnt = 8;6 j5 v* l. S: ~$ f. w7 ]
  81. 3 w4 z( T# `6 c$ Q: r" x( j* L
  82. module_param(acnt, int, S_IRUGO);
    / m5 R  T: W6 _, b; N  j2 v
  83. module_param(bcnt, int, S_IRUGO);
    7 w$ d4 z8 i% P: w+ y8 n! W' P9 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ f  y' B3 r7 Q7 J) V0 X
2 |( K9 c- A8 e- |+ M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- L  w7 d  G2 ^* Z$ I, Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* g: |& m6 r+ {' U) k, V; S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: j! J. N+ |$ B

& c- z) x( v6 |6 A6 g
5 o2 r. C* D/ n& b! ^2 j4 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-2-17 21:55 , Processed in 0.039396 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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