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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 t/ N$ _4 G( L% u- L
  1. [code]EDMA sample test application: a1 }( o4 H5 p; b# z
  2. /*$ p% m& _/ V& o6 o# Q- g; B
  3. * edma_test.c
    % H: o: d( N, {3 [5 W# x: u
  4. *: n9 j- e; {5 w. h# X
  5. * brief  EDMA3 Test Application/ g  l5 q) h0 B
  6. *
    ! e& K) l! B& v+ Z; ]! [- p# U. C
  7. *   This file contains EDMA3 Test code.+ r/ }; W8 k+ x( b
  8. *# Y/ r1 R1 r* z9 r, D5 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 w. C, x( C8 {7 R0 {3 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. {- {( x2 D4 n7 M& X& G7 h
  11. *         TO CHANGE.0 z& P$ }3 S7 n, a, A  m
  12. *$ h$ |+ I( B( p0 O! |2 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 k+ a' e6 ]% E$ h" |
  14. *& j" W2 X7 A; @2 L
  15. * This program is free software; you can redistribute it and/or8 t7 O2 J7 {! }9 Q1 f0 e
  16. * modify it under the terms of the GNU General Public License as
    , W4 \2 f5 \3 ]2 _5 I* F
  17. * published by the Free Software Foundation version 2.5 z" f$ g8 C! K- t- z! h
  18. *- ]/ R3 Z% |7 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, Y, O+ ^" X6 v' ?1 g( }! w1 s
  20. * kind, whether express or implied; without even the implied warranty
    / N2 R7 q, N. _0 K! p/ z- i# K" p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 X1 s: q6 N% E& l4 M. s+ V
  22. * GNU General Public License for more details.3 b% v1 Z3 B$ a& c" B
  23. */
    7 `' J0 w$ m( i% d  f  t+ K  i, f
  24. % z2 D( n- n' D; @5 `5 V
  25. #include <linux/module.h>
    # W' a7 a5 e5 p. x
  26. #include <linux/init.h>
    * n  p( F/ ~# ]: |8 K! O- l
  27. #include <linux/errno.h>
      w* |) ]$ ?( Q. \# U& e) `5 S
  28. #include <linux/types.h>* S% B8 ~, |  Q. F& ?3 G5 S& }
  29. #include <linux/interrupt.h>
    . C; J  B7 g& ^$ A. z
  30. #include <asm/io.h>0 }* V1 r% x/ d8 r# K0 `1 q6 L4 Q8 B/ }
  31. #include <linux/moduleparam.h>$ z* h& `1 a; {! o9 |9 K/ j( U4 }
  32. #include <linux/sysctl.h>
    ' i) B, l9 f) f$ b. a' G
  33. #include <linux/mm.h>
    ( n+ B% Y; _! P& r" d
  34. #include <linux/dma-mapping.h># B, E$ G$ c% f3 m- T& e. j( a
  35. ( O6 `3 M/ N  l; T
  36. #include <mach/memory.h>
    + k( B/ {: g) a7 H% S8 v
  37. #include <mach/hardware.h>6 v4 c6 }( Y" s1 p8 A- g
  38. #include <mach/irqs.h>
    6 t" g3 g- ]  \/ K+ Y) d
  39. #include <asm/hardware/edma.h>6 ?% p4 S% s9 ]+ w8 \7 t$ ^9 x' q
  40. & V- P- {* H+ P* C9 i" ^6 f0 s
  41. #undef EDMA3_DEBUG
    8 k! K( o% P! p3 l
  42. /*#define EDMA3_DEBUG*/+ q! D) ]/ |% D. U- O2 }' p
  43. $ m9 ~4 h( u5 r
  44. #ifdef EDMA3_DEBUG
    2 ^8 W) K0 }/ b; J2 `$ h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 y4 k' S, [1 U3 I1 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* p& [' e  w4 s) u& W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . ]/ P. p" p% ]! ~
  48. #else# Z- B" h3 j  m3 f: t3 h
  49. #define DMA_PRINTK( x... )
    % q* O5 U7 I0 U  i9 y
  50. #define DMA_FN_IN
    % Z  ^; }" S. ?4 @. K  M9 U2 \. O
  51. #define DMA_FN_OUT+ \. D% \; H7 E
  52. #endif6 _6 e$ W" E: K- Y8 K0 U% u9 l

  53. 9 P1 q; J7 D$ [* c1 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 U, k6 b9 Y" N$ I, [0 R9 o* o
  55. #define STATIC_SHIFT                34 ^; r2 y& ]" g. b' r5 ]% B. R2 E  T# W
  56. #define TCINTEN_SHIFT               201 X9 m( I' t& ~! S, D  f, L
  57. #define ITCINTEN_SHIFT              218 I6 S2 B% B6 z; _
  58. #define TCCHEN_SHIFT                22
    ( Q  k6 Q3 G, ~* C/ r3 w  J3 V
  59. #define ITCCHEN_SHIFT               23
    " O) K2 }3 n1 {1 _' e
  60. ) ?. _' N- ]& T8 z8 x
  61. static volatile int irqraised1 = 0;3 q8 X# I# i1 O+ f  A0 M
  62. static volatile int irqraised2 = 0;* e: u; u+ z0 H
  63. 4 c2 O/ A/ d* j& l+ t+ w0 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ I7 W" q* f5 U$ n+ l5 `) c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 A8 X1 d6 X8 [/ h# A; F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ H# s% C* j( X( b  I

  67. / x7 \- T" Q- X* Q) P- l9 k
  68. dma_addr_t dmaphyssrc1 = 0;
    7 s1 ?& l# j7 j, a1 E' x$ G
  69. dma_addr_t dmaphyssrc2 = 0;
    : M9 a: Q8 I8 F  X# k" t
  70. dma_addr_t dmaphysdest1 = 0;/ p5 o9 T# \2 G# i
  71. dma_addr_t dmaphysdest2 = 0;6 `" o- @8 b+ c9 M! Q7 Q
  72. $ b/ ~( m; o' i% n; h) W" [* z
  73. char *dmabufsrc1 = NULL;
    1 \7 S1 R$ P8 E# i& r+ n& `7 X
  74. char *dmabufsrc2 = NULL;0 [# i# q: B, y5 d+ d1 M
  75. char *dmabufdest1 = NULL;
    " M& _% |4 j6 M4 G& P; f0 O
  76. char *dmabufdest2 = NULL;
    . z. v$ L  o1 l" I3 p3 h
  77. ) m  }3 E/ M- L; P' {" [
  78. static int acnt = 512;2 ~$ I" l0 j+ g" i( W7 H/ i
  79. static int bcnt = 8;2 i1 x8 q3 e/ `
  80. static int ccnt = 8;3 F( t* W3 }: M6 p9 V# Y

  81. ; K4 Y& v3 J' ~2 w+ W! E% u
  82. module_param(acnt, int, S_IRUGO);
    9 W+ {# R; o  s; I6 E
  83. module_param(bcnt, int, S_IRUGO);
    % b* A' M- {* Q1 M* M1 x7 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 B7 q; U0 B, u! o
( a8 b/ G+ z, k1 |8 [$ a0 O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' Z2 z& m; P6 H/ S* C* warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, b2 ^! U  \! f" ~8 b. ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" v6 Z. a% R- ^) C. q9 }2 d) g% b
1 b3 S; q3 i3 c. P. a6 u3 u1 G  J0 f5 }. m) V1 \" ?1 x' q4 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 09:14 , Processed in 0.039646 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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