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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( ]0 e0 w: M9 J3 Y
  1. [code]EDMA sample test application
    8 T/ I8 h! c0 A! k) \
  2. /*8 l: \/ \% F' x& _* T. [
  3. * edma_test.c
    9 [% k* K  ^) i) [
  4. *4 f  T# N: P& x) d* I
  5. * brief  EDMA3 Test Application
    0 A6 o/ r$ d: g& D1 J# u: v
  6. *6 x, X# h* @! s" y. S$ u+ Q
  7. *   This file contains EDMA3 Test code.
    5 k7 n  Y+ R: Z9 e6 ]) }! `
  8. *6 g; r, u4 K5 n5 ?# X& }# a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      v9 V' Q% Z) D- J4 u6 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 H2 o9 O, |3 u- D7 B% a, g0 r
  11. *         TO CHANGE.% n( o+ W$ R0 v
  12. *0 U; t5 Z' a6 M0 U, @/ G* C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      _5 |# _, V4 w  v* Y( v% l
  14. *
      _% l7 C3 F: \4 w( p: @
  15. * This program is free software; you can redistribute it and/or0 L0 R+ u5 M1 N( p' }
  16. * modify it under the terms of the GNU General Public License as! O' G9 ]& N$ J- s; P; J; r$ F
  17. * published by the Free Software Foundation version 2.
    , ?" G9 i" C% c8 A. x
  18. *
    - N: l  S# f1 z  L& h" w0 K9 {: o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, V+ |/ g$ _0 ?. f
  20. * kind, whether express or implied; without even the implied warranty% D2 I3 N* s# i0 x7 S5 P+ T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; R/ `' N- `. T) A
  22. * GNU General Public License for more details.
    ' t/ O+ `0 @( l- n, t' x; w
  23. */
    9 N$ h5 t: W. {3 Z- k" l0 @& L
  24. % d% e, \: B; [3 U* H2 f
  25. #include <linux/module.h>
    ' \2 }" W' }' ^, y! D# A2 B
  26. #include <linux/init.h>0 e; H5 H! [& F3 n8 }
  27. #include <linux/errno.h>; @+ j5 o+ K& q8 N& P
  28. #include <linux/types.h>
    5 @( n2 e3 z- d5 p+ B$ B7 h2 q
  29. #include <linux/interrupt.h>) `% a7 ?( R7 U5 D1 B5 k* L
  30. #include <asm/io.h>
    6 o6 E; T- g- Z5 i; v: v; a
  31. #include <linux/moduleparam.h>
    ) k- H- J8 H2 h, r5 R
  32. #include <linux/sysctl.h>
    4 b1 ^( u% q4 q
  33. #include <linux/mm.h>% d6 S, b* |# V# N6 w
  34. #include <linux/dma-mapping.h>& |/ Z, {0 i6 x( l# f7 U
  35. 1 v, o6 @$ p' T9 @
  36. #include <mach/memory.h>* \' f$ ]) g# f
  37. #include <mach/hardware.h>
    5 C" ^2 O$ M$ A* h+ G9 l
  38. #include <mach/irqs.h>$ J% c2 Y4 n/ \6 ^5 M
  39. #include <asm/hardware/edma.h>
      }/ d$ [# \4 I

  40. ( B7 t; @, [2 W* K- F# m/ X6 M6 ^& u
  41. #undef EDMA3_DEBUG( \5 I! C  C9 V& F* e: m! ]5 L) n
  42. /*#define EDMA3_DEBUG*/" Y; y- l0 G3 M
  43. $ ^( k7 Y8 ]( N. g8 d7 Z
  44. #ifdef EDMA3_DEBUG
    3 d$ t1 }% M7 a9 l1 }2 o0 ~. @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 D/ q) Y& i, j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! ~/ W/ G  t( {& d; |% O2 g7 @9 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) r0 F7 s/ t. @7 [( U
  48. #else
    . r$ h# Q5 I0 J, x' |. {* P
  49. #define DMA_PRINTK( x... )
    / Y' j- L, `: e
  50. #define DMA_FN_IN9 K" `+ N9 b$ ?
  51. #define DMA_FN_OUT9 ^" g1 C- F+ {9 ^
  52. #endif! F* P$ [/ B: w% p- @
  53. * R1 P+ G0 v) w' y' \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ P3 ~8 T0 `  q/ A) [& B. d! [
  55. #define STATIC_SHIFT                3
    3 e+ u6 f1 r9 m' M
  56. #define TCINTEN_SHIFT               20
    : G8 c2 ~. g' X0 t1 i) s
  57. #define ITCINTEN_SHIFT              219 G8 i( ^9 b- ^( d
  58. #define TCCHEN_SHIFT                22( e2 ^( e7 b( C2 N" }  g
  59. #define ITCCHEN_SHIFT               23$ `- h; i$ g7 S
  60. / I% q/ J9 G2 W: S- T4 Q
  61. static volatile int irqraised1 = 0;
    4 ~  T- O+ b: q
  62. static volatile int irqraised2 = 0;
    ) ?& j& _$ E& J# i9 d
  63. 0 [. G# R% I- c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ?9 N/ G' u! O2 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; A9 N* R3 Z2 X/ e: ?& i5 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 P$ y, L8 ]" Q4 {. ]$ v

  67. / `( @0 q0 Y% {" h% p% y
  68. dma_addr_t dmaphyssrc1 = 0;
    & k' `- G9 `) A4 z
  69. dma_addr_t dmaphyssrc2 = 0;1 d4 H% M, ?* w; G7 _" q. J2 \
  70. dma_addr_t dmaphysdest1 = 0;2 x' r; M7 y. r5 p
  71. dma_addr_t dmaphysdest2 = 0;7 v, v' ?5 t/ G( y) a) w" _+ \8 e

  72. ! m$ b5 t/ c6 V" C
  73. char *dmabufsrc1 = NULL;* g: _/ A9 [2 N3 N
  74. char *dmabufsrc2 = NULL;3 _0 x" a% l; L8 u6 ?
  75. char *dmabufdest1 = NULL;) C7 Z. w  V8 R: b& N; ]3 T4 h
  76. char *dmabufdest2 = NULL;9 H+ v' r6 p% b7 L/ N! z. |( T

  77. 3 \8 L7 Q$ z. @4 B1 y& M  i4 a
  78. static int acnt = 512;& L4 K) {) \" W3 I" }
  79. static int bcnt = 8;! E  D6 x) w& Y& t! G
  80. static int ccnt = 8;/ {3 w/ v. S) c5 }/ i+ z  ^

  81. ' {# |8 v1 E9 m) Z7 B$ t6 k
  82. module_param(acnt, int, S_IRUGO);
    % I2 t. X; ]4 ]. t$ w
  83. module_param(bcnt, int, S_IRUGO);1 d; c! D  ?. G) w( J8 w- ]3 e7 X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 ]# M9 A. [0 b9 G! b5 I* _. ~7 q$ |& F2 t1 B0 O; }4 }$ F' c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. E* e9 o1 R- j, D+ darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  t4 z, j, V  M0 y9 L& ?% K8 o) q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ P% J5 p) p$ N5 n
# ?3 Z7 z$ e1 S  e1 E
, \+ V( `% f9 T, |+ S4 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-23 16:47 , Processed in 0.038546 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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