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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / _9 @, L$ p; |& X  Y" C, O+ h
  1. [code]EDMA sample test application
    # d% Q9 b& ?# t' }! a  V4 b5 U
  2. /*3 L" {0 Q& _7 Q2 I+ U
  3. * edma_test.c5 K/ }% c/ P2 I3 d
  4. *, V/ J# I5 ?6 {* f& Y
  5. * brief  EDMA3 Test Application6 Y9 y' Z2 @1 V
  6. *
    / q  m2 l2 y- L- s
  7. *   This file contains EDMA3 Test code.- t6 {/ f- {0 I& T9 V2 c$ U0 k
  8. *
    # M( b+ Z7 d( _6 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) i( r1 l3 \. Y8 E  \* ?5 q0 F* {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( |. c" g- u; T4 k5 y; E
  11. *         TO CHANGE.0 S' y4 V5 E1 K4 Y( g9 L! z
  12. *
    1 u; l- u3 z. X  Q% i9 d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 @$ E# _: K, X. g+ s
  14. *5 @$ j! _6 O# I* \% X' j
  15. * This program is free software; you can redistribute it and/or& ?9 E' M: a9 g' Z( ?
  16. * modify it under the terms of the GNU General Public License as
    ( i2 r! |/ B. Q! c! M4 `* o
  17. * published by the Free Software Foundation version 2.5 _9 v/ ~; E7 r
  18. ** R8 O6 B+ r. m2 p% S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 r. I6 @. z7 G9 j& h% y4 \9 P
  20. * kind, whether express or implied; without even the implied warranty
    ' H5 t: Z/ J8 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 Z) z! r) N/ {; N' D1 d2 ]$ E
  22. * GNU General Public License for more details.
      d: E; h6 r- S3 d
  23. */
    8 I6 B) z6 H8 f4 U1 |3 ]

  24. $ o* W0 e% N( [, `$ z6 g
  25. #include <linux/module.h>
    ' l: _" a" Q. C- [8 I5 N
  26. #include <linux/init.h>0 G' T+ m: W' j7 L$ p
  27. #include <linux/errno.h>
    & |1 [' d7 M. G& T8 h, \$ W
  28. #include <linux/types.h>! A2 b; v/ [5 h
  29. #include <linux/interrupt.h>5 {  s+ ]7 n! Q7 q
  30. #include <asm/io.h>
    ) ?: r' X2 n. b+ g; s
  31. #include <linux/moduleparam.h>0 I3 G$ U  |* [& x* t
  32. #include <linux/sysctl.h>' E4 h7 ~+ G; m! J2 N3 K& y: l
  33. #include <linux/mm.h>
    / w% L* q# e# x$ @# x2 \# K
  34. #include <linux/dma-mapping.h>
    2 I4 ?* m# ~6 N. Y& v

  35. ; ?6 N, B, S+ P' U! H4 X, t2 K
  36. #include <mach/memory.h>
    & ~" w! P+ E2 w0 _) D$ s
  37. #include <mach/hardware.h>% Q7 T5 P4 r8 }
  38. #include <mach/irqs.h>( ^2 c! f/ i! l# c/ H) p
  39. #include <asm/hardware/edma.h>. O8 u2 D7 J+ k, H: N- V" h, v: I
  40. 1 Y( J3 x- u5 \  ~7 P5 d* s
  41. #undef EDMA3_DEBUG6 A3 r! d/ v" Z0 F0 d- m
  42. /*#define EDMA3_DEBUG*/
    2 S' l' x! U4 y9 ?5 P

  43. " Z+ \4 e0 y8 a
  44. #ifdef EDMA3_DEBUG
    . s! A2 d# A7 [5 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). x% e4 p! b+ ^; C6 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 x% q& n% j: h* L1 C/ C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ j2 g. J( K' u3 b) I3 t3 S! E
  48. #else8 ]" \- H7 b! r( n
  49. #define DMA_PRINTK( x... )& Q$ }8 G: p9 Q3 l" w
  50. #define DMA_FN_IN
    7 M" q' ~9 m' ^: P3 Q) k
  51. #define DMA_FN_OUT
    # H. s2 Z0 Y" W% c5 a6 O
  52. #endif( ^, O% y  \6 f  K
  53. 3 {: Q7 @1 R! d2 o' L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- ^  T6 j! U- H" G* [
  55. #define STATIC_SHIFT                3
    ) U. q  ]  t! s* f8 u) u, Q
  56. #define TCINTEN_SHIFT               20
    7 q* R, }7 W9 J8 X( k, u
  57. #define ITCINTEN_SHIFT              214 m; D- x0 [) L- X
  58. #define TCCHEN_SHIFT                22
    / ~' y0 x+ {& v/ ?7 ^5 N% k& e8 Z
  59. #define ITCCHEN_SHIFT               23; N  ~6 `& B( Y6 x& J

  60. & P; _4 r1 s8 b' G. p
  61. static volatile int irqraised1 = 0;
    # h: G1 K! x( T/ N
  62. static volatile int irqraised2 = 0;
      Z. |' [3 k: h0 {
  63. : N# `9 ~3 E. b) h4 j+ d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " h! }% P0 J+ e% y# |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # D5 u" e" ^  d  K2 Y. m/ s. y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      Q( L& ~  J0 h( I* ]  G

  67. : p7 R3 W) X9 v# Q, V) J2 i9 A! n
  68. dma_addr_t dmaphyssrc1 = 0;
    0 [  ?% U* ]: X, _9 V
  69. dma_addr_t dmaphyssrc2 = 0;0 f, _+ Y. W, ]( z8 ~/ y8 T
  70. dma_addr_t dmaphysdest1 = 0;
    ; m$ a* a+ f) I0 \; w# x
  71. dma_addr_t dmaphysdest2 = 0;' y6 |# Q* }: I$ @. u
  72. & u# T' R* e6 O/ b( S: X( _
  73. char *dmabufsrc1 = NULL;
    6 y2 {( I( C! e4 @) @4 B5 B
  74. char *dmabufsrc2 = NULL;
    / `8 o1 U7 R* y
  75. char *dmabufdest1 = NULL;5 F9 I! a8 O2 J2 k0 \2 \
  76. char *dmabufdest2 = NULL;3 X. T4 Q: X$ W0 c" v
  77. 1 y; y0 H  x3 P) h  U
  78. static int acnt = 512;; j; Q, F7 F, L  I
  79. static int bcnt = 8;7 x) l9 L: V$ }5 v) b: X
  80. static int ccnt = 8;
    # Z# M$ p9 V( _, _4 r# Q

  81. 8 Y8 X" }1 [& N6 ^" _
  82. module_param(acnt, int, S_IRUGO);% O; C9 ~! X$ M
  83. module_param(bcnt, int, S_IRUGO);
    ! t6 G" V9 D- ~" n; E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 K( S6 b" |4 A

8 U3 k! j% ]: ^6 D. L* G: \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: Y& u: ^3 M8 {" ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' o5 x1 E5 B  X5 j/ |2 {, d& e( |& z7 m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 p+ K9 s! U( g3 s; G" K/ i, m; ^5 E% R2 U
9 H% k8 y0 A! z. @4 a! I' X3 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-9 08:03 , Processed in 0.040282 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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