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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 ^3 s9 x) Z! a( D* r
  1. [code]EDMA sample test application3 Z* Z3 D2 B/ j) g7 p& a
  2. /*
    6 \: \( c& o% F
  3. * edma_test.c: z. e7 @: K0 d
  4. *- w) D* T4 w; U% r( f2 V0 ?
  5. * brief  EDMA3 Test Application
    4 ^" ?0 c, o4 |) G' k7 j/ c
  6. *
    " j* }1 @/ S( I+ g' W# s3 h
  7. *   This file contains EDMA3 Test code.& Q! ~2 R7 _+ n# _
  8. *
    6 s/ B# p: m3 L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + d3 h( L& u# t1 Z, d: C4 P# I; O. H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& m2 N; x6 J7 Y- f) I3 K
  11. *         TO CHANGE.
    * g( k6 g; x! H" z
  12. *' G& `2 a0 R( U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 {2 n: K- G1 B- W: }/ B1 t* {
  14. *
    2 X* K+ u. E) s$ m+ l, C8 K7 G
  15. * This program is free software; you can redistribute it and/or1 z8 e4 A5 z/ ]7 o, }
  16. * modify it under the terms of the GNU General Public License as' O( J7 J) K: h  u
  17. * published by the Free Software Foundation version 2.
    2 U. d" k. t; C( f
  18. *$ P; I* q9 Z0 m" ^2 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* F" K0 H8 ^$ x% q' W2 |
  20. * kind, whether express or implied; without even the implied warranty+ U/ X2 w$ C) _% x. W/ P2 D1 m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + B) |! `" N7 N% i. L% e: _9 Q
  22. * GNU General Public License for more details.( u7 c1 c! x7 c
  23. */
    ' X1 C5 N9 N+ _* S+ y8 \

  24. ; Z0 F" v. \' |% g+ w. y8 A1 d
  25. #include <linux/module.h>" F+ E  y* R2 X7 }8 J* G
  26. #include <linux/init.h>
    0 w9 f8 Y" S' i* ^2 F  ?
  27. #include <linux/errno.h>+ s1 B" Z$ w" U- w8 s, i& E
  28. #include <linux/types.h>
    & }; R& R. y, s* E
  29. #include <linux/interrupt.h>
    # }$ A: Q; ?. j1 c* }2 [) @
  30. #include <asm/io.h>
    9 b* C: M, X  G( {- ~6 |% Q8 n* U
  31. #include <linux/moduleparam.h>
    ) S, p6 I3 L+ [
  32. #include <linux/sysctl.h>
    / _1 V; x) C, I( Q5 m
  33. #include <linux/mm.h>2 ]% s! G* y/ E# h: n" ]6 t9 R
  34. #include <linux/dma-mapping.h>7 V" D# C# \6 i8 O& U( g

  35. 6 K6 P0 Z, Y4 `/ n. F: c
  36. #include <mach/memory.h>2 d7 P. n: M, K# f) {9 v. B) @
  37. #include <mach/hardware.h>0 i& K  t' Z! m6 Q) G$ [) N
  38. #include <mach/irqs.h>
    ; }( N3 M! |1 \7 |$ M/ d. R( \) x6 Y
  39. #include <asm/hardware/edma.h>: j; ]0 j8 Q! ]; J
  40. $ S5 I! a- ]& D
  41. #undef EDMA3_DEBUG
    + J+ Z& \0 w! p8 |3 N
  42. /*#define EDMA3_DEBUG*/
    . N7 i4 a4 @# E9 r$ V3 e  G+ b

  43. 1 g4 ~! n* ~" Y# ?
  44. #ifdef EDMA3_DEBUG
    ' I. f3 k* C* K2 f4 [& O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 e1 |  c/ h3 @  o" M  S# i3 C% x+ L1 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! A2 O* D* F( h1 X9 ?1 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( `: P! B- D- K; Y
  48. #else
    3 J6 S% M3 z" z3 A# ~% A
  49. #define DMA_PRINTK( x... )7 @# h2 T/ e+ U' ~
  50. #define DMA_FN_IN
    % J) X8 L( ]+ H7 O
  51. #define DMA_FN_OUT
    - }, }7 F2 B+ [: o. M5 ^: u
  52. #endif
    0 Z# X% X& }( v
  53. 8 c# W$ a; t8 a: o; t" n2 D4 |* m5 ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 {6 N) [6 q9 O' ]
  55. #define STATIC_SHIFT                3
    7 Q* @3 ?7 n4 ?0 z. n6 s' v
  56. #define TCINTEN_SHIFT               20- b( K% E' ^% X: B
  57. #define ITCINTEN_SHIFT              21( [" I. C1 K3 m5 @
  58. #define TCCHEN_SHIFT                225 A" G# X# r. l6 |/ |5 l
  59. #define ITCCHEN_SHIFT               23
    4 _0 i6 }% A. e, g6 ?
  60. 0 Z1 O( i% h% q5 T7 B
  61. static volatile int irqraised1 = 0;* {. V; B9 c" F- u& Q( \
  62. static volatile int irqraised2 = 0;
    : @; V0 o" A9 U2 {! d% k

  63. ( R! M& N% ]+ h0 E2 m' U; Q% E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 N7 z+ `- Q! M* m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' W9 K" i" |4 D6 Q1 F( k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 M' u- e+ Q; m+ C( ]' z

  67. % z+ A' H% A+ H1 R' \: M
  68. dma_addr_t dmaphyssrc1 = 0;
    - N- q4 J8 M7 V* X% \3 P3 y9 Q
  69. dma_addr_t dmaphyssrc2 = 0;
    3 C/ G! ~" U2 L: y% ]+ F
  70. dma_addr_t dmaphysdest1 = 0;5 K& q1 O# g0 L- P7 a
  71. dma_addr_t dmaphysdest2 = 0;" ^, v9 i8 i' {# H' L3 w

  72. , i' _) ^' ?0 p/ u( N) n" v' g
  73. char *dmabufsrc1 = NULL;( o4 k* l* \. z' c; n# q
  74. char *dmabufsrc2 = NULL;3 M2 [9 D4 s  z9 \+ Y% N
  75. char *dmabufdest1 = NULL;; ]) z- Z3 u9 _: s; w* k7 k
  76. char *dmabufdest2 = NULL;
    ! b2 A9 f% t4 A5 W0 o9 J  q  y! X
  77. + k$ `  T$ [% m1 X& @8 {8 _- f& V
  78. static int acnt = 512;9 ^: C* K+ {& o, [; n
  79. static int bcnt = 8;# I7 h8 b9 f; V
  80. static int ccnt = 8;# l  {& N3 ?( u+ W3 H4 f; G( @
  81. ! a4 H# m3 `/ J' E! \/ M6 ]/ T
  82. module_param(acnt, int, S_IRUGO);0 H' D1 ^! a3 g+ K. G( E
  83. module_param(bcnt, int, S_IRUGO);
    5 V# ?8 Y8 A( \/ D9 ]5 o. g0 t8 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 q# D, l3 A3 B) h/ b: G: ?

# H- }4 j5 ^) w; n. P$ f7 B* [2 \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 l* [# Q  \% b) u8 b( N7 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ N# N$ f; P+ H( o) q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 d& c$ u; q. b' W
# o4 F1 d6 r  x

2 |, j: u. H+ e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 11:58 , Processed in 0.037254 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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