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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ Z- x) ~- [/ D2 U, B
  1. [code]EDMA sample test application) ]$ D# K6 f7 {: Y7 I
  2. /*7 L9 p% D6 z! I, p
  3. * edma_test.c, A' Q# G. r  S& S; W
  4. *6 K9 k3 _8 U. {& g: t' Q# I
  5. * brief  EDMA3 Test Application
    4 l' D: F% r" t$ g& p- p5 M
  6. *5 V8 O  V  R9 o) X9 S; T
  7. *   This file contains EDMA3 Test code.5 l8 j$ e+ U. y) w; H1 _
  8. *8 V0 X5 e( n  [: G( v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / C) R5 E) H" L* e- `" z# P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " Q! O- \1 _# `
  11. *         TO CHANGE.0 R/ Z" D* _1 E* ]
  12. *1 B1 W1 ?& j* u# k! P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' b$ c' a; x+ S
  14. *
    " S9 K. \9 a5 }' b3 K& Y
  15. * This program is free software; you can redistribute it and/or
      |) E1 ]. p; O8 S/ m
  16. * modify it under the terms of the GNU General Public License as
    * j3 g7 G# u: ~  P% t3 q
  17. * published by the Free Software Foundation version 2.+ O7 Z3 V5 O! {- |
  18. *
      n# \: x8 {2 C) g+ O) |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 m  s" r/ X/ O( q7 i3 z
  20. * kind, whether express or implied; without even the implied warranty
    & D5 i/ D1 z: T0 X; a# k0 w; D* f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  \1 _6 W% \  s2 C
  22. * GNU General Public License for more details.$ k6 X! U- I3 Z& f' f
  23. */
    2 P! B1 K# |9 R. l* A) n3 [( o* G
  24. ! D9 j+ X0 w  a" O5 o, H, w# O
  25. #include <linux/module.h>1 K) J8 I5 N( L3 v/ q  `: r; |
  26. #include <linux/init.h>
    9 K. o1 Y, H- U2 t. p* _1 l& F
  27. #include <linux/errno.h>
    5 D# Y6 u: \1 g" H/ H8 E! k4 T  P
  28. #include <linux/types.h>
    0 t5 Q3 w. h$ F2 e- ~* C
  29. #include <linux/interrupt.h>( o  n7 _% B/ o( Y% F8 l
  30. #include <asm/io.h>
    $ a1 J1 z* H& J4 B
  31. #include <linux/moduleparam.h>
    ' ^: Z4 \+ \' ]- d3 B% A/ v. T
  32. #include <linux/sysctl.h>6 W6 D6 D' {8 O% E
  33. #include <linux/mm.h>* O& R2 u7 |& x+ q- k
  34. #include <linux/dma-mapping.h>
    + \% B7 h$ ^6 Y( n

  35. ; _0 h. W9 D9 W- o3 I
  36. #include <mach/memory.h>
    + O, O% P1 Q7 m& G. D
  37. #include <mach/hardware.h>9 W" I7 Z6 M  u2 [- O
  38. #include <mach/irqs.h>" ]- I$ I0 X+ Z9 l% L: B
  39. #include <asm/hardware/edma.h>, F; ?. m' a; B" E$ s
  40. 7 [' t8 b3 O- M5 M- \8 F
  41. #undef EDMA3_DEBUG7 h# r4 z3 J* P7 }7 ]
  42. /*#define EDMA3_DEBUG*/0 t. N; O& ?# c) Q' \5 q* @- \, Z

  43. 6 K) F' @3 K. p7 o# j* x; D7 l
  44. #ifdef EDMA3_DEBUG5 [# Q, K/ e7 Z2 ~& x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 M4 g' M- M8 _& Y2 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % w1 R( e8 @1 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " L8 D  i4 _* W
  48. #else8 A. u% S- I1 V4 y. R, H+ X
  49. #define DMA_PRINTK( x... ). `) _+ c: e4 q9 u/ {) t
  50. #define DMA_FN_IN8 i+ k: l: t) R! h! e
  51. #define DMA_FN_OUT6 B* D6 o: V3 d: }
  52. #endif! H9 I( b1 z  |4 Y8 ^0 v

  53. # n' ~: Y/ u( Z: k+ n. {! \% Z$ @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # i% m* G& c# H$ q. @
  55. #define STATIC_SHIFT                3
    % Q0 U( V* c0 e) `& I
  56. #define TCINTEN_SHIFT               20& o- {6 S, b; Q9 ?1 d4 s' z
  57. #define ITCINTEN_SHIFT              21# R$ u0 d& _) y$ j; _
  58. #define TCCHEN_SHIFT                22
    4 D# C) F$ r3 L+ `: |7 i+ [" z
  59. #define ITCCHEN_SHIFT               23
    4 I" g& w5 ~2 q1 _, E; Z
  60. 4 U" [5 I  |% w
  61. static volatile int irqraised1 = 0;
    2 u& P! z: _- i" K7 b' Q1 V
  62. static volatile int irqraised2 = 0;) M$ M$ P( C" Y, f1 I
  63. : L% I7 }$ P0 G3 y; z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 F8 w  s  Q; u% l# `. E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* @6 ^  U$ P! y. M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; C6 n- r5 a( B) y$ G8 y/ b) g  F* ~
  67. ) l2 [$ l& }$ w# o  K: i2 Q
  68. dma_addr_t dmaphyssrc1 = 0;* U4 t* N3 n3 y  [' B4 ~* `
  69. dma_addr_t dmaphyssrc2 = 0;6 b9 q/ E: S  R9 E# y* x$ U. k
  70. dma_addr_t dmaphysdest1 = 0;
    * y! J8 |  T6 m) ]5 G3 P- j
  71. dma_addr_t dmaphysdest2 = 0;! {% W! C8 b* H

  72. ) r0 p7 R/ Q# U; X
  73. char *dmabufsrc1 = NULL;) {0 M; J* r8 B
  74. char *dmabufsrc2 = NULL;8 I2 a1 J. H- _# `3 m4 a3 d- j
  75. char *dmabufdest1 = NULL;8 {' X7 v4 G3 G2 [0 K0 m* K
  76. char *dmabufdest2 = NULL;
    8 h- y1 U1 c$ l
  77. ) |5 Q: A. M. `# k% L
  78. static int acnt = 512;7 A7 l5 b$ Q7 B" o0 j$ N
  79. static int bcnt = 8;
    $ u2 h& d7 q3 N# r* [; }
  80. static int ccnt = 8;" [0 h+ J& w$ ]% |
  81. / k+ X& a# |& f% j! {- c( y: h
  82. module_param(acnt, int, S_IRUGO);& H; S# Y. ?& K7 [* R: f/ E
  83. module_param(bcnt, int, S_IRUGO);) K) r8 J& [7 s* v0 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 W) e( Z8 k* O/ e

3 }! l. E6 D8 n* `: C0 d/ c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% Y- R% k* @4 y8 q( {2 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" k# K6 T4 x# s. Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 r( u; x4 f; m( @0 e; D% [
6 Z/ r4 ]% P6 N2 s5 h5 y( k1 t. G3 X% b7 N$ E# W( L8 Y$ o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-31 12:57 , Processed in 0.040163 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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