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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 S) t% f7 I% e4 ~' N
  1. [code]EDMA sample test application: m( ~* @- _7 F- i! V
  2. /*
    # l$ }, ?/ [5 z  X/ b7 D
  3. * edma_test.c$ z5 W# D4 k! h* N+ Z
  4. *) D, u9 n. j$ A! ~' o) V
  5. * brief  EDMA3 Test Application. l! y6 i+ x; J* {' J
  6. *
    " Y% V% }/ `% `" P( u
  7. *   This file contains EDMA3 Test code.
    $ ]! O& T. g, M
  8. *
    + z2 u2 `2 h5 \9 [+ H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- e& [+ F$ @1 L* s) R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + c" c5 ^! U( V0 q: T! m
  11. *         TO CHANGE.; q6 j/ r9 Z/ D6 g4 E
  12. *
    + }0 c) G/ w6 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 \( R) b$ D) L" z& j0 {; J
  14. *
    & d. v6 p9 G0 T( H3 F7 G0 k
  15. * This program is free software; you can redistribute it and/or
    ! q( C, p8 Y- @2 r% Y! K
  16. * modify it under the terms of the GNU General Public License as" c7 g; g! N) s% @5 Y
  17. * published by the Free Software Foundation version 2.
    7 a9 E/ h4 h/ E) s. g
  18. *
    8 S. s: p/ H1 J! h# P  l; e2 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- G0 Q0 `$ I% g9 ]
  20. * kind, whether express or implied; without even the implied warranty2 T$ }' \# W0 ]; T4 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 q9 f2 Y+ `4 N9 }1 p2 f: Y7 `
  22. * GNU General Public License for more details.
    6 F" v; y) [+ D1 O! A
  23. */4 d' E( K. Z# c/ c- ?9 y- O1 P

  24. ) z( }4 x9 d1 h3 x2 r
  25. #include <linux/module.h>
    ( m6 y% E% D+ w" @& D, H4 ~( Y
  26. #include <linux/init.h>. _& ?4 w& G' K2 e! A
  27. #include <linux/errno.h>
    / B0 E, r+ V2 f9 E
  28. #include <linux/types.h>
    $ P: m% j3 A4 b  d% f
  29. #include <linux/interrupt.h>3 u" c8 ]4 e# T: D
  30. #include <asm/io.h>
    6 g2 ]' |# z  R
  31. #include <linux/moduleparam.h>% U. `0 |. R, E
  32. #include <linux/sysctl.h>
    ! V: V5 w0 t9 {6 M% X
  33. #include <linux/mm.h>
    ( E& O) Z, }; H' C) T: E* b! ]
  34. #include <linux/dma-mapping.h>0 f" y: u% p: }9 I7 g
  35. # o, M: f3 u. w$ O0 R( P. T  ?
  36. #include <mach/memory.h>
    3 U% d  }, b, p: E$ A
  37. #include <mach/hardware.h>
    " O. N1 c2 V. T, `
  38. #include <mach/irqs.h>& V" F, ?  w% Q3 s& j. @2 c0 a
  39. #include <asm/hardware/edma.h>
    / f7 d/ f4 |. p( n5 G

  40. ( Z7 f  `' T9 x, y  J7 J9 M7 b
  41. #undef EDMA3_DEBUG: J$ v- s4 |8 ~" C: Z
  42. /*#define EDMA3_DEBUG*/3 @$ ?" i, [- r: Q* a3 n

  43. ( D2 Q$ j! U8 }8 C
  44. #ifdef EDMA3_DEBUG+ {& U" S& k6 S  o# n5 z0 ]1 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 `" V9 g0 b: J: c( }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( Z+ N) m& S* k( P# R4 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 \- h: a% b) ]* {# Q3 m( S  C
  48. #else; C; \5 b! _0 w) x# R
  49. #define DMA_PRINTK( x... ). V8 I4 A  o9 F. N  m/ d- t
  50. #define DMA_FN_IN1 p, Q5 w' o2 [7 `' E
  51. #define DMA_FN_OUT4 n6 a) B2 H: S+ b& v2 O
  52. #endif* |/ \* ]3 P4 u2 F9 e( N! S

  53. 9 z0 b2 K* d2 B/ G" Y# j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 ~+ m2 x* N" ?# u, P# Y
  55. #define STATIC_SHIFT                3
    ! N  R& i" }3 }; E& M, Q1 n
  56. #define TCINTEN_SHIFT               20) C$ f9 l$ K" g# `# G* n
  57. #define ITCINTEN_SHIFT              21
    ) p! k3 q& J( j) m
  58. #define TCCHEN_SHIFT                22
    6 Z3 z# K) l/ n7 |4 t; t/ T
  59. #define ITCCHEN_SHIFT               23+ _# x! d* q: e0 V, z

  60. 6 V: Y& t# }- m
  61. static volatile int irqraised1 = 0;, d# O2 w' C& [/ u+ C1 }
  62. static volatile int irqraised2 = 0;- \# o" G( u- V/ g; }* ]- `: V

  63. 2 N- U7 R% M  u9 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ E+ X/ b; U/ @! G$ K" j& u9 W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 G+ w0 P1 P/ f6 U! ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & E: X, o% u  l

  67. ' _% G& Z8 s: h
  68. dma_addr_t dmaphyssrc1 = 0;! F! E( K# m- L5 u! i, V1 [
  69. dma_addr_t dmaphyssrc2 = 0;
    4 Q$ e. l: J3 T* z7 f# F) }
  70. dma_addr_t dmaphysdest1 = 0;
    : k; a$ E0 I; w4 b3 t2 ]
  71. dma_addr_t dmaphysdest2 = 0;& b( [& R8 w" ]  a8 I; p+ H3 E

  72. 1 V. Q+ Q% Y! d
  73. char *dmabufsrc1 = NULL;! n/ c5 c- a1 `9 j; d6 T/ j/ K
  74. char *dmabufsrc2 = NULL;
    . b7 N7 a- ^! `( x2 p9 S
  75. char *dmabufdest1 = NULL;- q( W, \* B  e  J
  76. char *dmabufdest2 = NULL;
    " \! o1 c$ w: [5 x# F$ g& C
  77. . g, u% P" @- ]- ^4 A+ [
  78. static int acnt = 512;
    # f  A" i4 x- w' s
  79. static int bcnt = 8;
    8 S4 y1 L, c' `% _$ f
  80. static int ccnt = 8;. J2 x$ x7 r4 d) w! C( f% g6 D

  81. 9 J4 O% |0 Q: D" ~8 I
  82. module_param(acnt, int, S_IRUGO);
    . a4 N0 |& Q' H. ~" O
  83. module_param(bcnt, int, S_IRUGO);
    9 \6 ^* P$ D/ S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ D7 P" @; D0 t0 C9 E( t

: H' x9 c* V& h' W$ ?% ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 ], _3 |( n, g( D- B# Narm-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 X. F7 }" e$ \7 `; V; g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 X) q- e) y2 G, V- ~$ _; m3 i3 L: v) y) x( m: R0 q( O3 g
- N+ I8 m0 w% B. \) U1 p9 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-4 22:23 , Processed in 0.036131 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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