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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 Z4 b3 K' z: v$ ]1 c
  1. [code]EDMA sample test application
    % b9 ]% _5 D: w5 b5 F! k6 G% p$ U
  2. /*( g% h8 l4 f8 l/ a
  3. * edma_test.c
    & x: ^+ }4 S' \3 i& Q
  4. *
      F6 ]8 y6 b$ W! w' |+ Z2 V! X
  5. * brief  EDMA3 Test Application
    0 \9 f- x4 {$ t' j7 I5 j+ n7 x6 r
  6. *+ ~6 {- @1 a: [; R2 c3 \: T: s
  7. *   This file contains EDMA3 Test code.8 U5 \3 y7 f" e' T
  8. *7 I" h! _/ O3 l6 K/ D" w4 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( N8 Q" i) b- z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 A0 k$ ]( M; L$ t: W
  11. *         TO CHANGE.
    " V: s( E2 `* f, h( \
  12. *
    + ?( A' O  E- H1 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * V7 Y$ F7 |% t$ _5 n
  14. *
    % |4 A- f. W2 G/ n  C$ e
  15. * This program is free software; you can redistribute it and/or; v( U1 v* S, M- s- C0 t
  16. * modify it under the terms of the GNU General Public License as
    9 D& ?3 b& {  w  c8 E
  17. * published by the Free Software Foundation version 2.
    ( m8 h$ R8 \" U$ l% [9 m, h
  18. *
    1 ~# o& b# m4 t, R! a& f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! |/ E9 M+ B+ }+ E
  20. * kind, whether express or implied; without even the implied warranty& x& i! N  q5 W. d) w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      O) B% L/ j) a
  22. * GNU General Public License for more details.
    & H3 n# i( T: A" Y8 E- {
  23. */
    3 s5 ~3 d% f5 Z6 F6 x# X" h
  24. - d" E* x% Z2 z9 E5 T& |1 \
  25. #include <linux/module.h>! J5 {" U  ?# P: J% l1 d6 F
  26. #include <linux/init.h>
    + n' \$ G; j& R+ }+ ?. o
  27. #include <linux/errno.h>
    & h/ [( @% w# X. j
  28. #include <linux/types.h>
    ' g6 u2 ?7 e) g- k- [* t4 A
  29. #include <linux/interrupt.h>8 Z3 T3 p4 W9 v7 ?! U8 o
  30. #include <asm/io.h>  K2 {& T* A4 |# K8 `/ V
  31. #include <linux/moduleparam.h>, a+ X1 W! I( |+ A. U1 b
  32. #include <linux/sysctl.h>% m+ N) S1 i2 `2 C1 R# M8 T
  33. #include <linux/mm.h>6 p$ K9 v0 d8 M. v9 W- S7 X
  34. #include <linux/dma-mapping.h>( i. o" P+ K) B$ x. J

  35. & m* i% c! |2 g4 l$ u/ j. p: r" d
  36. #include <mach/memory.h>( y/ b/ H7 H% U) s* ~# t
  37. #include <mach/hardware.h>
    9 ]. n& s9 k9 \4 Y, ?  c: N
  38. #include <mach/irqs.h>1 Z  `& V: H8 U- y8 l: C' Z8 e' v
  39. #include <asm/hardware/edma.h>
    # C! U" O' f9 ?1 w$ v/ \+ N
  40. ' M) Z  b0 v' b
  41. #undef EDMA3_DEBUG
      w% d8 {- l, _$ F2 J! O  h1 ^+ p
  42. /*#define EDMA3_DEBUG*/
    ( x/ D/ L% I' h
  43. : x8 t6 Q6 l9 B, A! N2 x
  44. #ifdef EDMA3_DEBUG1 o+ {. O/ X: X# r( h' D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 y& `: r/ r3 l  Q) }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' A3 u9 n; z* j2 r: \- v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 L! J- N; @# x8 Z" K$ }7 ?+ Y6 d
  48. #else
    1 V, X3 ^5 g5 N8 {
  49. #define DMA_PRINTK( x... )
    + \# @, L+ V8 u9 B( l" g% y
  50. #define DMA_FN_IN
      I; ?* I9 p% }" d# U/ _3 v
  51. #define DMA_FN_OUT
    ) Y. F; `; o! l& S# k4 d# C! [8 z- ?
  52. #endif
    & s: |7 P1 H( d/ W

  53. 2 g. g# x, M1 k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 t, S- Y9 K% ~; L% ]' q3 ]; ?$ u
  55. #define STATIC_SHIFT                3
    , z# Z; U2 n! G' d" @) z
  56. #define TCINTEN_SHIFT               20
      p) U& M5 @  S$ k' R+ R0 x3 ]
  57. #define ITCINTEN_SHIFT              21
      x# w+ s& v5 u4 v
  58. #define TCCHEN_SHIFT                22) X  s4 ^" L( T0 w2 L
  59. #define ITCCHEN_SHIFT               232 k4 `) @5 C( n, [' u6 Z; a# O

  60. 0 g. E! j) J7 l5 z* ]
  61. static volatile int irqraised1 = 0;" _2 Q# z# w; V% j
  62. static volatile int irqraised2 = 0;
    % I" L. F+ Q: Y) H' `2 H  y! x

  63. " z8 }$ r: S) ?3 i/ `( e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- g1 h5 y. A" U. s+ i) z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 H& P8 a, Q' D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; b7 b7 _% j# u* D
  67. 1 w+ ]1 B" t; R/ h/ w
  68. dma_addr_t dmaphyssrc1 = 0;
    5 k) d* l$ p7 i4 X& y: e
  69. dma_addr_t dmaphyssrc2 = 0;
    ' n2 f6 y% t& q
  70. dma_addr_t dmaphysdest1 = 0;
    # k5 A0 e( Z' j% `) _5 ^
  71. dma_addr_t dmaphysdest2 = 0;
    7 j* A+ M$ M5 j7 s! D: h

  72. , U6 O5 M) r. C) Y
  73. char *dmabufsrc1 = NULL;
    * H, P4 k8 {5 M
  74. char *dmabufsrc2 = NULL;
    + S# u4 K5 h" f4 }0 u
  75. char *dmabufdest1 = NULL;
    4 T6 W; Y. p5 n
  76. char *dmabufdest2 = NULL;. W1 r2 ^' c8 C& M

  77. " S! M+ U6 s! N
  78. static int acnt = 512;) d1 s% B9 k- A) U5 n+ j3 Z# u
  79. static int bcnt = 8;
    ( W- f( k5 \9 Y$ c+ r) |
  80. static int ccnt = 8;
    , Z. y8 U& U6 \( P% y( t4 U

  81. ( E/ U' ~5 ?( J5 I2 H6 y
  82. module_param(acnt, int, S_IRUGO);
    : |) m8 V; }, k; l" J+ ^5 M
  83. module_param(bcnt, int, S_IRUGO);
    , N/ V. y7 m! \- |  E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) P3 f  J. d  m6 I+ I; @

4 v# r( F3 c! Z  L! [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! l9 h2 c% @" ]  i3 ~+ Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ D9 S, q/ I5 ~) z" H) u  ?& V" S5 p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 y0 J# [. h7 A; f7 D" ]
1 y3 T0 x  v4 V0 ~; f  p+ e1 Y: Z- ]8 o# c7 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-23 14:26 , Processed in 0.042260 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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