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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & X& {8 W6 Z( y2 }
  1. [code]EDMA sample test application* M- R' x% f1 @. Q
  2. /*$ P3 K4 R! _  M* W
  3. * edma_test.c" |# ]/ k- G' ?4 M! M" F$ B3 Y7 I
  4. *
    " G+ J2 O9 c+ n8 w$ w
  5. * brief  EDMA3 Test Application% _$ o  @5 B6 ]( r
  6. *
    ) s5 X7 t. l  U% a2 n
  7. *   This file contains EDMA3 Test code.1 U: U: \, U3 }
  8. *
    ) O6 x; m- g  w3 l5 v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! z: H* K1 \- A( o  {1 n6 @. h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& j9 }; ?0 h( n9 ]: d
  11. *         TO CHANGE.
    0 h* O. z3 U/ A$ |5 L" g; j  x
  12. *
    " C# M  C9 g. s' u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . \2 V7 y8 R/ T) }" }, A' x' O
  14. *) \" g1 u) P$ [% u
  15. * This program is free software; you can redistribute it and/or
    . \& L0 j7 T4 D+ T
  16. * modify it under the terms of the GNU General Public License as5 X- A/ H; Q3 s# d
  17. * published by the Free Software Foundation version 2.
    * f* {9 K$ t1 R0 K
  18. ** W7 S; P5 n2 E( w3 A0 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* ?% A8 u. b* B
  20. * kind, whether express or implied; without even the implied warranty
    - s5 ~* A' h7 \* i- g; [: h( e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 V. N" S" J" j2 u* F
  22. * GNU General Public License for more details.. E2 z& H& y% `1 K2 ]/ m
  23. */
    ; I( G, n. j- D) r4 X. B6 d5 \
  24. / O" l; v+ u0 k% N) p; B; B
  25. #include <linux/module.h>7 W9 S9 K4 r3 n) }9 V! d
  26. #include <linux/init.h>
    2 I$ @' a& E" t9 Y/ x: \& j, G
  27. #include <linux/errno.h>
    , \* o3 ]/ v' I3 Y1 |0 P/ m0 Q& e3 [" N
  28. #include <linux/types.h>
    6 M4 s0 A* D' Z  p2 G
  29. #include <linux/interrupt.h>
    ) {' B# l" t& k
  30. #include <asm/io.h>
    % Q  `/ X% T; ]+ B: M5 H$ `
  31. #include <linux/moduleparam.h>
    ' D! w; k+ k8 D% R: J
  32. #include <linux/sysctl.h>
    ' j% d' T$ y& o" g
  33. #include <linux/mm.h>2 m, v7 ~8 T7 S: \8 x, P
  34. #include <linux/dma-mapping.h>
    " r/ O2 Y0 g6 a% f( L$ i

  35.   u5 P5 q# q7 r8 ?. A
  36. #include <mach/memory.h>
    , z9 J5 y! Y5 o9 J) }0 ~
  37. #include <mach/hardware.h># ?# i0 a  i1 \- Y' a0 s. M
  38. #include <mach/irqs.h>; R! C6 ~: ~& ]% @! ~; @& G5 M
  39. #include <asm/hardware/edma.h>: p0 Z8 ?1 g- Y% }6 Q" e0 @+ S; T

  40. ' f8 B4 `: g# @4 B! C! y  D
  41. #undef EDMA3_DEBUG2 t: U( `! t! O+ ?
  42. /*#define EDMA3_DEBUG*// W2 f' k) b9 X$ [9 y9 ^

  43. 2 m' E6 s6 `6 h7 j& s& M# L! @
  44. #ifdef EDMA3_DEBUG5 P0 U; \& w0 K( X# R9 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' x! s% S( k4 S! c# f) ~, [$ m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 `, v; K! \0 o! s  f; I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' J# o1 ]( ]3 K: M) D
  48. #else
    ; A) J) r+ `. T' S# \
  49. #define DMA_PRINTK( x... )* c- U* A, [6 f2 V
  50. #define DMA_FN_IN
    . K8 y1 y# |9 ]. {
  51. #define DMA_FN_OUT
    6 w3 O* m1 y+ c4 z
  52. #endif
    7 O( F& P  ^% w: @

  53. ' a4 [$ n) w( U6 Y; l7 k+ v4 H* t. ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; X) l6 V6 J+ s3 p% {& X0 h: C( R
  55. #define STATIC_SHIFT                3
    % V* J2 \8 Y% @- P: ?& Y( ]
  56. #define TCINTEN_SHIFT               20  F6 Z/ c/ U9 X, G8 ?" W
  57. #define ITCINTEN_SHIFT              21
    1 k" K3 M$ |3 [7 }, t
  58. #define TCCHEN_SHIFT                22
    : L5 o4 l1 @2 m$ C5 i" N+ b  M
  59. #define ITCCHEN_SHIFT               23; i( F# B  K$ v0 T

  60. 1 T/ `# H8 ^& ~4 V* G; `
  61. static volatile int irqraised1 = 0;
    ' n3 f5 M% w. y5 d% `3 F3 D- T
  62. static volatile int irqraised2 = 0;3 v& Q2 N0 \; q: t, P* V

  63. ' o6 \$ o+ T' a& T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 g3 x. u; j5 B# p! `' D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 I- w0 x( ]6 f" ^% w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 }4 j, q1 S' F# K! t1 v% e: u

  67. * ?; p5 B, Z' u6 x# F: ~4 H$ Q
  68. dma_addr_t dmaphyssrc1 = 0;
    ! q* [1 V5 B4 z% u* t. U
  69. dma_addr_t dmaphyssrc2 = 0;0 T9 s# L& R$ S
  70. dma_addr_t dmaphysdest1 = 0;( D* |# ?8 E5 ]/ J  v
  71. dma_addr_t dmaphysdest2 = 0;
    ) o% U; H' c3 ~# m' @" r) t

  72. 9 J, v/ _3 R! e* C* f: Z
  73. char *dmabufsrc1 = NULL;
    5 P4 ^. @& f1 e' [$ ?  ]
  74. char *dmabufsrc2 = NULL;
    ( i: d1 y  Y" Z0 Z
  75. char *dmabufdest1 = NULL;" e* w- A0 Y& g
  76. char *dmabufdest2 = NULL;+ `' F, [7 G. R4 Q
  77. , F6 I; B) u/ v4 K' M+ N2 T* E
  78. static int acnt = 512;4 _) {: A( Y9 p0 C6 n
  79. static int bcnt = 8;+ B- s+ ]0 y8 W) Z9 D- z( \1 T7 U' ~
  80. static int ccnt = 8;) e- k! F# b4 Y

  81. 1 w3 ]: S( \, }# J
  82. module_param(acnt, int, S_IRUGO);
      T: B3 X9 \, B& W: J. `& C# p
  83. module_param(bcnt, int, S_IRUGO);) {( b7 ?7 f2 X+ s& ?, ~, ^) i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" @: I+ [2 u) }2 Z3 K0 g
9 }; S/ M! j) J( n6 o7 s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ b; ]  w' x* H( \: T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 Q8 |. y- M) i' g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' G! X. I8 o: g4 Z

! \' O7 S: j& Z+ W) A- v& p8 G; L! v% H) }8 A1 A, S0 k1 y. G8 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-28 07:58 , Processed in 0.037892 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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