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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 Y, a. p2 \( G
  1. [code]EDMA sample test application3 \5 M; C( b) V5 T8 p8 O
  2. /*, |" f, _6 W1 W! F6 ?
  3. * edma_test.c. s! b" \3 F7 W8 J3 _% d
  4. ** r$ k- P0 ]  j- k
  5. * brief  EDMA3 Test Application
    + J# C8 d, f! U# w" P; V/ X' f8 E
  6. *
    ; W" B1 S4 L' v/ R8 ]. q
  7. *   This file contains EDMA3 Test code.
    ( M$ R! E8 U7 q/ [
  8. *
    : _, ^& W% S+ U. R" i+ k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( l" u7 J9 X0 E/ p6 M1 y$ K! R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* S  t* ]7 h4 ]0 _$ q* B- v
  11. *         TO CHANGE.
    * o) {! j$ `- H7 I% v) s$ Q
  12. *- ?# V7 g& _5 y2 \! ^8 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% Z" x8 V" M8 S+ B* c
  14. *0 G* j% l. ~8 |6 \+ n4 f* w
  15. * This program is free software; you can redistribute it and/or
    : ~; v& r7 b; ^
  16. * modify it under the terms of the GNU General Public License as
    3 Q2 T7 R; N) _# ~. e2 {- M
  17. * published by the Free Software Foundation version 2.2 b7 E7 A) A, |# S0 s  b
  18. *
    * v* E: G5 O4 D+ u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ Y7 X2 P# t; w& W1 g$ U
  20. * kind, whether express or implied; without even the implied warranty
    # I9 x( a4 f* C- I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 b4 M( u5 K) [2 `
  22. * GNU General Public License for more details.9 o  V6 }9 {6 y7 u
  23. */, \0 R: ^  t7 R5 ]7 m
  24. 6 A3 C9 R! [! k
  25. #include <linux/module.h>& z+ a+ w4 x# g9 s2 [1 q4 S
  26. #include <linux/init.h>" O9 `- B; S4 e7 G3 v
  27. #include <linux/errno.h>  f5 |5 O4 p( d2 p
  28. #include <linux/types.h>( A  p" h9 V9 i& }7 Z3 }
  29. #include <linux/interrupt.h>
    2 M$ \1 o+ ]* Z3 [
  30. #include <asm/io.h>
      P9 m/ j7 H% f
  31. #include <linux/moduleparam.h>! D3 m3 a3 J' m7 p
  32. #include <linux/sysctl.h>
    ; U3 S2 B5 b: S. f/ C/ Y0 @: P) A( \
  33. #include <linux/mm.h>
    6 i6 l" V  a) [6 C6 [7 h
  34. #include <linux/dma-mapping.h>1 U4 ?8 ^' O/ \" D  t

  35. 8 \6 L6 R, b* Y' R
  36. #include <mach/memory.h>
      _4 D. S8 Y& O# Q
  37. #include <mach/hardware.h># f' u! j( x5 R  l2 q- M
  38. #include <mach/irqs.h>: k9 u3 i9 M/ g+ j) u
  39. #include <asm/hardware/edma.h>* X4 ]/ F& }: L9 D8 E& Z+ [: t

  40. * i5 h" c" L, G& n# q2 t  R
  41. #undef EDMA3_DEBUG
    " ~& I; k' j& M) K$ h) R4 K2 ~& K
  42. /*#define EDMA3_DEBUG*/" Q) R$ z- I) ?" _. z

  43. 9 M7 y: x: d6 X1 N. U* t  _
  44. #ifdef EDMA3_DEBUG" f2 ~2 ?  p6 u2 I4 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), Q/ M. g0 x) C( ^1 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + O; {& v4 {8 B3 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 C4 I: S  ~: a0 W
  48. #else
    , d$ {* _- w* e8 T9 F
  49. #define DMA_PRINTK( x... )
    8 U9 g& ~' h0 U  p0 L9 G; B
  50. #define DMA_FN_IN
    3 g; p8 _! Q+ S; ~$ I
  51. #define DMA_FN_OUT
    ( h5 |1 z  f+ @/ b1 q; B- x
  52. #endif
    9 F% k* K# _; g

  53. 7 P3 s* J6 J) h( {2 g3 a9 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / j; ?( T, {" M* _6 N7 p" M3 O, l, ^
  55. #define STATIC_SHIFT                3
      Z8 f  a) ~% p! q7 p3 q  b( a
  56. #define TCINTEN_SHIFT               20
    " Y- t2 T$ f! t- _3 c* G' F
  57. #define ITCINTEN_SHIFT              21
    ! }  M. _& V8 ]' J( H6 N
  58. #define TCCHEN_SHIFT                22$ `3 d# h5 A1 Z) c
  59. #define ITCCHEN_SHIFT               23% ~5 U1 A( @) F& x
  60. . m! ?7 K) r8 o
  61. static volatile int irqraised1 = 0;
    $ h! j1 y: q$ ]1 k3 v" l1 {
  62. static volatile int irqraised2 = 0;$ F! g- T; t& H- U
  63. * W( ?; P1 d1 W, j5 E- i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : q! E6 s1 Y* J# k' j2 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 i. m2 M9 @5 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ t  Z& ^6 w+ R  D1 e' K( U" I, J* K
  67. 4 C" k* D. d8 Y! A% R7 }
  68. dma_addr_t dmaphyssrc1 = 0;
    , m9 H8 z& h4 q/ R2 q$ C3 g; ?
  69. dma_addr_t dmaphyssrc2 = 0;% y8 E+ V% F: U
  70. dma_addr_t dmaphysdest1 = 0;
    7 U% V. z( y- ?2 j) f2 F
  71. dma_addr_t dmaphysdest2 = 0;( o8 j$ y7 H+ t" u9 u
  72. # p! n; J) ~( N) m0 Q8 s5 F1 J. c" `7 a
  73. char *dmabufsrc1 = NULL;
    6 z7 r0 }/ q. W& X
  74. char *dmabufsrc2 = NULL;
    % G: t7 E6 u7 u
  75. char *dmabufdest1 = NULL;- i3 b3 d" _! A& f
  76. char *dmabufdest2 = NULL;* ?& Q0 c5 ~, W; O2 t) o
  77. 9 u# g( o7 u* y! a# p. m
  78. static int acnt = 512;
    4 P6 A& w; h! x9 X# e6 t& S
  79. static int bcnt = 8;
    & s' n6 y* B5 s0 @4 r8 m% j- e. E) |
  80. static int ccnt = 8;
    ' Z4 G* J6 R, Y: F6 p7 ?( I
  81. - p( X# z( k  x) G* r3 B6 O3 d
  82. module_param(acnt, int, S_IRUGO);9 c! E& N. O; v
  83. module_param(bcnt, int, S_IRUGO);
    % u, ^6 R/ ]7 U1 Q( U0 F; \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 h) e" o: p3 }; E9 C( _

7 [& _. ?3 {8 U* f" a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- ?$ C& S* j! [: Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 q! P: i7 ?. ~/ L& Y' D  G0 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! [" s$ W! \2 ]& T
3 q' S, Y5 Z  u3 z# @

' G  e/ |$ n! p' J2 a8 t& [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 18:58 , Processed in 0.038695 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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