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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ^' N. K- V2 z9 V$ f  Y% G
  1. [code]EDMA sample test application
    / U4 f8 n* O6 e: G; K# n
  2. /*
    4 N7 }7 c9 ~) m& T' @* T: V' f
  3. * edma_test.c6 N# j  y& I& Q, o7 N- }
  4. *2 q  y5 B5 v0 D5 ~* j7 C
  5. * brief  EDMA3 Test Application2 j9 i5 ?0 h+ p$ W
  6. *
    + ~1 A7 Q- [1 w' @
  7. *   This file contains EDMA3 Test code.
    * T& I7 ^% I: X
  8. *
    ! Y2 A3 e, V3 P! _3 b1 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ X" @, M% v+ ~, Z. a; y6 Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 w8 F: V6 \9 A, p8 A
  11. *         TO CHANGE.' h& y: D9 ^- o% k8 }
  12. *8 M" r; {  i! z. P# M, E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 |$ Q! z. p+ l
  14. *, P9 Y( f2 B  \: @! c4 P! A
  15. * This program is free software; you can redistribute it and/or
    $ Z1 G. N  l. P: ^9 W
  16. * modify it under the terms of the GNU General Public License as: @- Z: i  s$ f
  17. * published by the Free Software Foundation version 2.7 O$ z8 t( S# e( ?- M, j2 g/ o9 c
  18. */ i* {2 Y' L; Z! U# L! F4 ~0 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 e. g1 |" W9 x
  20. * kind, whether express or implied; without even the implied warranty
    $ M: ?$ V# I/ o# @# e: o  w. w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + u2 s; o7 t! \% c1 G. k5 l
  22. * GNU General Public License for more details.
    / F6 R8 ?( j' l- `7 P
  23. */) h" a5 H1 I$ ~( `8 f) L! X

  24. - J& C7 I9 E2 i! ?- E3 y
  25. #include <linux/module.h>1 R/ Z1 j# }3 }9 W! O
  26. #include <linux/init.h>
    ) y5 z- Q* S$ P& A
  27. #include <linux/errno.h>
    1 ~8 o8 ]* o5 u! P6 P  R2 T- e
  28. #include <linux/types.h>4 V: p) }- J% q1 Y1 b, d5 ~% |
  29. #include <linux/interrupt.h>
    $ r% [0 l0 J/ V' W) Z: S
  30. #include <asm/io.h>
    . ~, ~, l) U  M) Y: _5 d9 x7 B
  31. #include <linux/moduleparam.h>2 k0 T$ ^' I) @" V1 |
  32. #include <linux/sysctl.h>
    6 J5 d1 ^  v5 P: p, q2 m" f. V
  33. #include <linux/mm.h>
    ! p4 |  K% e! Q& j$ e# n& I1 p
  34. #include <linux/dma-mapping.h>
    + h/ P& y5 n, x

  35. 6 y. @& A4 s2 [. H
  36. #include <mach/memory.h>
    1 l+ [7 p8 W8 j
  37. #include <mach/hardware.h>' v. u. S& G. l
  38. #include <mach/irqs.h># f( e) k3 _0 i6 Z! V
  39. #include <asm/hardware/edma.h>' H' U1 B* v% M  u' L3 B2 C3 D$ B
  40. : o- L: |, K/ T
  41. #undef EDMA3_DEBUG7 L( A5 K) X! o2 H, D
  42. /*#define EDMA3_DEBUG*/6 }: w6 w2 X/ J( @+ @8 o7 u6 \
  43. " N- }# z: x$ n% U& R- @
  44. #ifdef EDMA3_DEBUG$ m) L4 z7 e2 y1 g& W& ^% |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 z( Y) e% n, [( D, C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . u  h$ h* B; H2 j0 _! W3 ?5 \8 _, [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ Z1 S3 e+ z" D
  48. #else- t0 P2 Y- C: {' N% p
  49. #define DMA_PRINTK( x... )
    5 V7 f1 b3 v, P% k( A
  50. #define DMA_FN_IN
    " j1 I8 z. c+ D
  51. #define DMA_FN_OUT
    * I+ G+ t, a% A
  52. #endif+ [. c8 G7 L) `' o
  53. $ Y0 E- C" l2 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 r9 }9 i) T  {1 ]9 q" x
  55. #define STATIC_SHIFT                3
    & u* `5 i! u1 O& x
  56. #define TCINTEN_SHIFT               20
    9 M7 v9 g6 s" b$ r3 y: m
  57. #define ITCINTEN_SHIFT              21* r% a* k8 D, B% a# z5 p
  58. #define TCCHEN_SHIFT                225 a: o3 X& v! f2 l
  59. #define ITCCHEN_SHIFT               233 N' i# c: X' u- G4 U( M. B/ c) B

  60. " Z# Y+ ?- ~7 C0 {
  61. static volatile int irqraised1 = 0;5 k$ f/ w: n* L2 q
  62. static volatile int irqraised2 = 0;& k. f5 e2 D5 C% }9 ~9 `
  63. 0 W* _" S3 w: b* a/ J) a# k( r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, n: M9 c, y5 m  G2 R9 j7 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ^$ s# f1 ~1 h- _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / S9 }5 j7 o% u  m  L6 j
  67. ) r. X0 C; L4 }( f1 {
  68. dma_addr_t dmaphyssrc1 = 0;( O* Z; g( \0 g- A2 X- K  R
  69. dma_addr_t dmaphyssrc2 = 0;! [9 W/ f4 _* h- h
  70. dma_addr_t dmaphysdest1 = 0;+ x3 `  x7 M; A& A/ q
  71. dma_addr_t dmaphysdest2 = 0;4 R; d- m. d1 [( R2 ~

  72. ) [; F" `2 e  n* d8 f  [
  73. char *dmabufsrc1 = NULL;
    3 m1 p5 W0 |: q$ W2 @
  74. char *dmabufsrc2 = NULL;1 u: b! u( T  E+ c
  75. char *dmabufdest1 = NULL;
    3 E1 y! g" u3 q/ h
  76. char *dmabufdest2 = NULL;
      z5 A( j6 F5 \6 F5 L( R' a

  77. ! I& M1 Q4 q: W% R6 B+ y( R
  78. static int acnt = 512;1 ^- f- u" M; @) L- h  m/ H
  79. static int bcnt = 8;0 ]3 I2 A7 o2 C
  80. static int ccnt = 8;0 X; M% e5 w8 {% @/ C; _
  81. - p# k  @( ?& ~
  82. module_param(acnt, int, S_IRUGO);
    " S1 F9 y/ r  v# o! _/ y1 s
  83. module_param(bcnt, int, S_IRUGO);- Z* }4 f3 ]; K! p( h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. T9 n, \4 B5 F3 N$ |

0 y5 ?# a3 X: G6 {2 ]( s: k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- g1 A# P- q' p# r! h) y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 {8 P" x% N/ _" a! R. G# E/ b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* r3 V1 i$ L; k9 ]' b' a$ J% A  y- U" B3 K+ a
! C  W! F: E  k: O$ J, b5 k' Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 03:37 , Processed in 0.039644 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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