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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  y. G' V& @: C6 ?% ]4 Q
  1. [code]EDMA sample test application) F$ I8 ?0 ^1 `- I: Q7 X
  2. /*
    ' M' P4 C3 o" u$ Z
  3. * edma_test.c
    1 o: n- y' a5 P9 Q4 q! O
  4. *
    ' e% Z1 p+ w. ~
  5. * brief  EDMA3 Test Application
    ! o6 H- @! c& @1 u
  6. *- t" p& Q0 i: h/ Y' h0 ^; \, s
  7. *   This file contains EDMA3 Test code.
      \6 d& Y5 k- E9 A
  8. *& t8 }- e4 C' C1 m7 a. N. B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ A0 e& I" K0 U* u/ h# }! i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * [) `5 H3 S& u) [; x, s
  11. *         TO CHANGE.
    ! Q: B- D- d  t" }: ?4 a
  12. *
    . K( t" C$ _; v/ a8 K" u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! b/ B! J- `+ \! c
  14. *
    ; u( Z' d9 l) L" R! y# X! o
  15. * This program is free software; you can redistribute it and/or
    & z3 Y! r) o' P# ~6 x( t
  16. * modify it under the terms of the GNU General Public License as5 i$ I! R* Y, C
  17. * published by the Free Software Foundation version 2.
      y% i* H! @5 \: S
  18. *
    ! a2 Y) w  O7 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, a7 J/ j; e2 K7 N/ C. C
  20. * kind, whether express or implied; without even the implied warranty
    ! l# }7 X: E$ T% W& ?* e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 S4 v6 ~# u  r) M: V- J& h. c- k+ F
  22. * GNU General Public License for more details.
    " }# p1 G4 V; p, X8 t; j7 j
  23. */
    3 q/ X2 p$ C) l' b1 [( x# ^# A3 l

  24. ; i/ n1 G* O* t. J
  25. #include <linux/module.h>4 h0 d7 L  ~; w& K
  26. #include <linux/init.h>
    ) Q: J' Q; F& U4 Q; P( F
  27. #include <linux/errno.h>  S1 Y: O& K! r- ^% o7 S0 v
  28. #include <linux/types.h>
    5 S5 x9 n+ f$ V- s+ e* @
  29. #include <linux/interrupt.h>
    # S: A" {) W3 S2 W3 I# a' x# Q
  30. #include <asm/io.h>, d, P6 L) ^2 m3 d0 ~
  31. #include <linux/moduleparam.h>
    9 I+ z# E2 A3 R, x7 S2 F' Y
  32. #include <linux/sysctl.h>
    # y& E- y4 g5 C/ S
  33. #include <linux/mm.h>8 D( q3 [, X# ~2 m  E! \9 v
  34. #include <linux/dma-mapping.h>; e: p8 K% U1 r
  35. * K* e3 y* h; K& u- Z
  36. #include <mach/memory.h>3 z7 [& r/ b2 x4 W
  37. #include <mach/hardware.h>
    9 E1 C; k* y2 T
  38. #include <mach/irqs.h>
    & f! u+ p( L% M8 ^( c
  39. #include <asm/hardware/edma.h>4 @/ R; ^. h5 @" x! b! @0 N
  40. $ p3 R; j9 r, F
  41. #undef EDMA3_DEBUG
    " l2 n) H; }( J0 F. V" k
  42. /*#define EDMA3_DEBUG*/
    ) h6 `) A, r$ @. u1 b

  43. ; v  Z# {2 {: s# O. i5 L
  44. #ifdef EDMA3_DEBUG
    ' c9 {- Q$ \3 u* E5 C/ W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 s; N. O' Z+ D3 m! _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( Z9 T" R( Z. `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 t8 x: t9 T* N3 ^( }  V4 ~
  48. #else" T+ |1 X% L2 B
  49. #define DMA_PRINTK( x... )
    + u: M. l4 O# r: x' f2 `
  50. #define DMA_FN_IN
    # O: n7 T, u4 }: z: s
  51. #define DMA_FN_OUT" o4 C# @0 Y# B8 I4 d2 s- P4 \. ^5 P
  52. #endif
    5 O5 Z( n+ Q$ h1 x  N" l
  53. 3 F2 a0 A. T# N3 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). h6 D1 }3 f- t/ C9 E) \; r  m
  55. #define STATIC_SHIFT                3
    3 t* b3 @0 G$ ?  A. t. x3 d0 y4 t2 z
  56. #define TCINTEN_SHIFT               20) f* B& ~; _0 Z9 h
  57. #define ITCINTEN_SHIFT              21. `/ r5 V5 O2 g% `
  58. #define TCCHEN_SHIFT                22& i, l+ _2 ?9 Y5 j: J
  59. #define ITCCHEN_SHIFT               237 s  _1 w$ G6 I2 i( V
  60. 6 n% H" [! d$ J% B: E$ \: T9 Y
  61. static volatile int irqraised1 = 0;+ T& w4 q5 Y" B  B$ L
  62. static volatile int irqraised2 = 0;
    4 B4 B9 O' ?( l4 y, N& C

  63. ! Z* t( S) D  h( u% g7 P% A0 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 J9 z( o) I" p' \2 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / f  L8 m9 L9 w  a! R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( D8 ~3 V1 B& A% f( h) t1 l
  67. ( w0 F5 y$ ]" G+ A, I% H3 I  ^" [
  68. dma_addr_t dmaphyssrc1 = 0;- r: ?  U/ h( ~2 R& a  I0 Y& o0 s
  69. dma_addr_t dmaphyssrc2 = 0;
    8 ^7 e: ~2 K8 q+ y- V
  70. dma_addr_t dmaphysdest1 = 0;/ F* L. @+ J) }$ v- J
  71. dma_addr_t dmaphysdest2 = 0;
    & s/ D) {$ c- x( p$ U0 Y# G
  72. $ Q. J; F0 T  {
  73. char *dmabufsrc1 = NULL;
    9 G$ Z/ E# E' t% a8 u
  74. char *dmabufsrc2 = NULL;
    2 {2 f( y" |. q" V. W
  75. char *dmabufdest1 = NULL;
    ' k+ |7 I. f( J+ D/ L
  76. char *dmabufdest2 = NULL;: Z3 X5 F& P; f) O! j
  77. - f. X6 `4 l; s! b
  78. static int acnt = 512;% Z2 x* \4 H4 G* F( X, q# T4 Q
  79. static int bcnt = 8;' l# c+ N: O# }6 R' |
  80. static int ccnt = 8;
    7 {: h$ m4 r  u8 w/ r% R0 ~# W

  81. 3 y) b( ?( D8 i" c4 I
  82. module_param(acnt, int, S_IRUGO);: s/ f3 C( @; O- u9 S) R8 x
  83. module_param(bcnt, int, S_IRUGO);% \! ^2 o8 I1 U1 m' h, I' |$ R% w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 O0 b/ k( K4 e+ e) h
  c: R. Q6 t# s+ G& N: l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  k4 x) P4 B3 q) varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% y1 j8 w/ m) U5 @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 |. N% t2 @7 _. {+ c, [$ C+ R
1 q) @2 I+ y3 y! C3 r8 U, g, V
4 w. ^! W8 w( h5 I% y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 15:46 , Processed in 0.037554 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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