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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * v  V* t" H, k
  1. [code]EDMA sample test application
    3 g+ ^: o& k! K# X
  2. /*
    6 F9 Q& a- S( j9 `8 T( _, k& Y- J. ]
  3. * edma_test.c
    + J; L% m2 W' ?- u# x
  4. *3 ]( p, N  {! H. i
  5. * brief  EDMA3 Test Application* w' p( y) g; P8 x' Y
  6. *
    , \; J4 a$ ~) x" y6 W/ r4 y
  7. *   This file contains EDMA3 Test code.. Q8 u/ r9 m& E* Q) K
  8. *
    $ @! T  W4 Q) n6 _2 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  X; g* O& N" D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 J. e  k+ f4 |9 C
  11. *         TO CHANGE.$ G6 d3 y" ]; ?8 e3 B, I
  12. *
    / O- C: @! u, J  P4 i! h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( X- n/ p# `# a1 Q1 S7 C
  14. *
    % U8 {$ l0 ?4 v  V  V
  15. * This program is free software; you can redistribute it and/or
    / u4 \& h  ~5 i1 B2 y
  16. * modify it under the terms of the GNU General Public License as8 @  Z8 {- {1 W. e. n( d0 }
  17. * published by the Free Software Foundation version 2.6 c( F( _3 T3 c: |
  18. *1 ?  j$ ^+ J1 ?  V8 K4 v" l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 ~  A- c0 [% L. c) G
  20. * kind, whether express or implied; without even the implied warranty- F2 Q  X" }# d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 q. J1 ?% n' H2 _8 G2 G1 P+ \
  22. * GNU General Public License for more details.  ?' O4 y9 }( H6 _4 h2 C+ f2 B7 R7 [( Q9 j
  23. */
    # G6 Z/ _& q2 U0 l2 E

  24. 0 ^) B+ r5 q: o& s9 }6 l- S
  25. #include <linux/module.h>
    5 H  {! l5 x5 u
  26. #include <linux/init.h>
    ' N; K: D9 k+ g* o. W2 J
  27. #include <linux/errno.h>
    + u) u; c" ]4 h
  28. #include <linux/types.h>2 C3 l# i, ^" W0 f
  29. #include <linux/interrupt.h>( S8 ]% n# [+ [4 ?
  30. #include <asm/io.h>
    2 B; d# p& G! @  x4 g
  31. #include <linux/moduleparam.h>$ E" b; I: F: R) U2 \) i
  32. #include <linux/sysctl.h>* E' C2 b" y9 L4 `# H- h+ V1 C
  33. #include <linux/mm.h>& t, q* K% `$ S1 `4 K
  34. #include <linux/dma-mapping.h>
    6 _/ |* o# w* z

  35. ! i, C0 b: R# X0 Y! E
  36. #include <mach/memory.h>$ Q5 u- ~9 v  z) v
  37. #include <mach/hardware.h>+ e$ R& Q( d! C+ w, c
  38. #include <mach/irqs.h>. Y# l4 b& a1 u6 R
  39. #include <asm/hardware/edma.h>+ E9 t0 D, ]: Y. {# d' s+ K% d

  40. ' J% [7 u7 l" q! {! s& n& I
  41. #undef EDMA3_DEBUG9 }" W  y, }) Q
  42. /*#define EDMA3_DEBUG*/
    9 N' m, E9 y- v$ I2 }
  43. 4 E3 ~4 r& N2 ?- \* s7 z7 J! U
  44. #ifdef EDMA3_DEBUG
    1 @7 P- s; f% s! E* N8 i& z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* o! o" @$ r$ ]+ H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . M" M) h- f$ a7 }/ F. V; D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ N6 s1 K! y* U2 H' Z
  48. #else; [7 V% E  N2 v# l. a
  49. #define DMA_PRINTK( x... )* l6 A# L  d* i& U% r7 T
  50. #define DMA_FN_IN; e( U, u0 y. h6 \
  51. #define DMA_FN_OUT( [$ P3 D3 i3 P" I' ]/ A
  52. #endif
    $ v$ ~; H& [# H1 `4 `  g% X

  53. 6 K+ C: a4 Y7 H0 \  Y+ E+ S- r: K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 \: }( V; h& E7 u' X4 O4 I1 w
  55. #define STATIC_SHIFT                3
    " ~1 F. _0 w: ^# Q
  56. #define TCINTEN_SHIFT               20# u- X% C- c8 h% b/ q
  57. #define ITCINTEN_SHIFT              21
    . A( @) C. s! o
  58. #define TCCHEN_SHIFT                22
    ( _; q( a1 R5 O% v7 c) O+ u
  59. #define ITCCHEN_SHIFT               23
    - |0 q5 Z0 @2 p; t# l

  60. % n1 ~4 c( n, V3 t& V# b
  61. static volatile int irqraised1 = 0;( }; o6 b, d: x5 ^4 u3 Q. P' B2 O" u
  62. static volatile int irqraised2 = 0;1 G) H6 u. y& F, \9 z' M- g+ L* J

  63. 0 M/ X# L) u) B$ {1 b# Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 \' H6 H% C' ]9 c  I6 L, Q+ {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 D5 e; F8 f, c% Q; ?- v( _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 [% Q4 I* I1 J. x3 L2 e

  67.   K/ Y4 L/ b- Q- r4 |6 {
  68. dma_addr_t dmaphyssrc1 = 0;" k0 t* P) x) e3 W5 O
  69. dma_addr_t dmaphyssrc2 = 0;
    * u$ U! h0 X8 T2 k  p+ ^) P# M
  70. dma_addr_t dmaphysdest1 = 0;6 s2 V" Y# u  `3 m' F
  71. dma_addr_t dmaphysdest2 = 0;( m! d! f6 t+ ], p0 H

  72. , ]. s% Z7 c8 I) }( o- X3 ]
  73. char *dmabufsrc1 = NULL;
    $ b- N9 z8 e0 p; f
  74. char *dmabufsrc2 = NULL;, n9 t/ ~/ U  f, V1 w
  75. char *dmabufdest1 = NULL;& X' U" _( E1 }0 {4 F3 k/ c) I( D0 b
  76. char *dmabufdest2 = NULL;  Q4 p" |, |5 i5 D
  77. 5 q1 [) N$ J. e: t7 I
  78. static int acnt = 512;
    * S! G5 [1 b' U8 M  ^# N1 `1 c
  79. static int bcnt = 8;4 i1 z5 _- r! m/ ?" J+ Y
  80. static int ccnt = 8;  J4 h+ G$ t2 j0 Y" j- C( Z
  81. , q0 a* x$ H9 W1 f; Z
  82. module_param(acnt, int, S_IRUGO);
    6 E: s1 k% S6 ^$ [: _( F
  83. module_param(bcnt, int, S_IRUGO);
    ( U' M( B+ z5 ?- R4 B4 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, Z) l4 e: G6 T0 D4 c
! e( [1 r' z7 U& o! v; e+ J6 k( c: }/ i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 o1 @" x' R- ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 M/ H! W7 _# f) D# L, r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# |. x; U' ?% s/ M" {3 g
! w) K3 v+ h8 U, e  |$ f

8 Q* f# X9 f" ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 06:03 , Processed in 0.039929 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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