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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; e- F2 i0 m* }, A" o& ]& x
  1. [code]EDMA sample test application/ f% ^' Y5 {' E6 [% D
  2. /*
    7 v, E0 ]# r, n$ y" W- R6 |
  3. * edma_test.c
    ' a) o3 R) |4 @6 Z/ _- y
  4. *
    6 i' V6 I( [$ N4 p& @% l
  5. * brief  EDMA3 Test Application
    / M% O8 q2 p: B* p! v  i
  6. *8 S* c8 @$ K% o5 Q" A* |/ L
  7. *   This file contains EDMA3 Test code.
    ; ~/ H7 m3 _2 l, n; V) `5 O, K
  8. *
    / }. }+ [5 b! S* w$ v! `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- i/ K2 s2 Y, x- x8 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ B7 `. a7 {- t$ f3 M
  11. *         TO CHANGE.% H2 y; [; D5 ?$ O6 D' o- I: o
  12. *! t  f1 l* g: F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( p! M- b/ i7 b3 K* m
  14. *8 S$ f7 ~" v8 C* O, U" `+ v& A
  15. * This program is free software; you can redistribute it and/or, T0 X) W$ l1 e9 [: e0 E
  16. * modify it under the terms of the GNU General Public License as0 v$ y0 V& J8 ?" y
  17. * published by the Free Software Foundation version 2.
    ) S; m; M) F) h; d7 t# R. U1 J
  18. *
    ) `' l- C0 V* {5 S' p8 H1 v, ?- ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; Z9 a, s0 L4 x2 `) T
  20. * kind, whether express or implied; without even the implied warranty
    - c$ R$ W) I0 T6 E8 Y" i9 A- D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# {$ A: K1 h; O" X; O" \
  22. * GNU General Public License for more details.' w, x3 q6 U( V. r* I
  23. */
    9 b7 D+ H! w! B) y6 ?! b

  24. 2 |9 ?* ?4 H3 Q
  25. #include <linux/module.h>0 T- L' @; |- Q. A4 Y7 p
  26. #include <linux/init.h>
    5 |) x$ x' l/ g6 I' T* a
  27. #include <linux/errno.h>
    ( Z. O2 K, G3 ~5 z0 o; \2 ?
  28. #include <linux/types.h>" w- H; ?5 c" }. K& A3 Z
  29. #include <linux/interrupt.h>4 d7 ^* B/ O4 Z6 g* g7 H# O
  30. #include <asm/io.h>
    5 j6 A, Q: F1 Y. j( m! ~
  31. #include <linux/moduleparam.h>
      M0 A# j% r9 \( d
  32. #include <linux/sysctl.h>
    4 L8 T, _6 K; M- M$ V& G
  33. #include <linux/mm.h># z6 m8 N( a8 d* X
  34. #include <linux/dma-mapping.h>
    7 j/ L( V% |9 v0 g
  35. + B+ X! E* N6 L4 M# ^& [
  36. #include <mach/memory.h>
    6 b* h6 J2 N7 q
  37. #include <mach/hardware.h>
    $ p  o+ V) ?9 @6 U
  38. #include <mach/irqs.h>3 K% p* E  U/ ]. X+ ^
  39. #include <asm/hardware/edma.h>( g  w! f2 w6 r0 e
  40. 0 B3 g; m' ^1 I6 q, G
  41. #undef EDMA3_DEBUG# \2 R$ v, Q' @( k; ?
  42. /*#define EDMA3_DEBUG*/6 T( G& d% t* F$ [6 r
  43.   w2 n* g" d, L7 e% q( y
  44. #ifdef EDMA3_DEBUG# R1 h4 D3 ]0 h. o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& A& I9 V( L4 w1 q4 C7 M2 a# z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 D  t+ l, e# [8 y3 l: |: W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . I6 ]. M' N+ P2 C' a' b' E+ Z3 Q
  48. #else
    ! I, Y- \6 a( C- n
  49. #define DMA_PRINTK( x... ); Z# I% e( x* Z. Z
  50. #define DMA_FN_IN( G. d; D9 ]4 L
  51. #define DMA_FN_OUT
    5 C' e! b' F3 o& P' |5 \% Q6 M
  52. #endif
    . Y. O) V% f: w% S) j
  53. + B- s; I! M9 H6 U. J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- Y8 g$ P6 b* k
  55. #define STATIC_SHIFT                38 f; \6 C. t$ p7 F  f
  56. #define TCINTEN_SHIFT               20
    8 L8 y9 R2 q; f% ?4 g: T0 U* y
  57. #define ITCINTEN_SHIFT              21
    : K+ M; T" B( O6 h* L) L3 g
  58. #define TCCHEN_SHIFT                22
    0 H3 w4 S$ Y; S
  59. #define ITCCHEN_SHIFT               23% d: x3 t- n; ?% {, o& `; h

  60. % R8 N) |1 F/ d. O0 O7 q
  61. static volatile int irqraised1 = 0;2 T& }" q; d0 l4 J
  62. static volatile int irqraised2 = 0;
      _, s! V" v6 B/ F7 J
  63. $ p4 e7 Z6 P0 q/ j4 c" F) [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' S. w  ~! q- o$ O& q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Y; }2 p8 I1 X3 ]+ O" {: \3 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - D; h# \" n" m( j( D4 [

  67. ) W2 E3 m' q, g! }  g3 w$ }2 G" }$ X
  68. dma_addr_t dmaphyssrc1 = 0;! d2 o% e$ {, p. [) ]
  69. dma_addr_t dmaphyssrc2 = 0;& C, r4 U. m" H
  70. dma_addr_t dmaphysdest1 = 0;
    2 m% {+ p0 @0 @' e4 D9 Y
  71. dma_addr_t dmaphysdest2 = 0;
    0 r3 f' w8 y( `2 p

  72. ' d8 H& u: c1 n+ R# Y3 S
  73. char *dmabufsrc1 = NULL;
    ! r" b1 e+ w# z. R$ J8 Y
  74. char *dmabufsrc2 = NULL;3 |, p8 O% n# W. k* N
  75. char *dmabufdest1 = NULL;
    3 z  |) D8 c, ?7 y
  76. char *dmabufdest2 = NULL;+ s; W2 w* Y& a0 ~0 x

  77. ; K$ i9 _/ c! O6 j0 x$ ?- I
  78. static int acnt = 512;
    : l( ~; v, j' ~
  79. static int bcnt = 8;+ R: w: X, P2 E; R* h% M
  80. static int ccnt = 8;5 @, Z  O& U: A& t- @+ J

  81. 6 M4 r. z6 F/ e, \/ }( _
  82. module_param(acnt, int, S_IRUGO);: h, b9 [. Y3 ^# Q& L# w# l
  83. module_param(bcnt, int, S_IRUGO);5 U) s( t5 Z6 T; C7 D  K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  @3 t- {6 [. z

5 U# C) d- [0 |3 \/ k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ U# K# j$ `" V! P+ D, I/ D. Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, \. f) v7 L: J+ M5 j" ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% S+ h7 N# @% H) p# c- }% s% V  Q  N) p5 Y/ i) h
/ z% e" _3 W! V$ ^' t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 02:14 , Processed in 0.042053 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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