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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 A- F' v! |/ w, K
  1. [code]EDMA sample test application0 u. f9 ?2 p+ _, d6 |7 o; i
  2. /*
    . }. r: o2 u) ]; K6 a( P' w' v
  3. * edma_test.c
    0 S0 y+ p6 I* U- B# l5 g; h
  4. *3 h* p, _  B: c
  5. * brief  EDMA3 Test Application
    # z& _4 m; F" W8 B# q6 R+ O
  6. *0 w0 _5 X( D) x! O* y# {3 V
  7. *   This file contains EDMA3 Test code.
      H6 J" d+ D# \: O
  8. *
    ; J( v' y+ u& o4 N, \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; ?% M; n5 y5 o" {' B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 [/ c2 T# p; U/ S
  11. *         TO CHANGE.
    , ?& H% r( W6 r! L  G; ^% j; W
  12. *$ z( A) |7 R+ k  o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 w. L; Q- v2 c4 h9 |+ Q# p" E4 }
  14. *
    9 u3 E5 b7 i# K4 l+ c+ L
  15. * This program is free software; you can redistribute it and/or8 m* Q! k6 ]" M8 l$ W
  16. * modify it under the terms of the GNU General Public License as8 e! i0 L  X# Z) l+ D
  17. * published by the Free Software Foundation version 2.; T! ], z4 l' ]# k) N  V
  18. *+ |  C* r) r: L+ L; K& k* @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      }' r- U  Z! w
  20. * kind, whether express or implied; without even the implied warranty  c: ~0 y) W( ^# d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) n, P- S; y4 J( b
  22. * GNU General Public License for more details.
    5 z8 d. B/ g/ L5 s! H, t
  23. */. a( X7 r+ P5 |7 B0 K
  24. 4 q  O: l9 ]5 V! @8 l
  25. #include <linux/module.h>& c1 E% p0 ]9 \( _! ^$ V$ A4 V5 E
  26. #include <linux/init.h>, b2 I/ e/ O+ V* f0 }' D
  27. #include <linux/errno.h>7 k* t0 w: l" m
  28. #include <linux/types.h>: ]3 |* `6 W2 R. c  ^+ }! h1 W
  29. #include <linux/interrupt.h>
    8 D5 p. ^3 `& j' @- K4 K3 E# h
  30. #include <asm/io.h>
    , a, R) y/ l% N) M( o# W; }
  31. #include <linux/moduleparam.h>
    $ N" D7 [' o2 \3 ~( K5 D
  32. #include <linux/sysctl.h>) [% O! a( S1 e
  33. #include <linux/mm.h>/ T7 q9 @3 |; v! i8 y4 Y; Y, C) i
  34. #include <linux/dma-mapping.h>/ x) o8 {. k. M) P/ Y
  35. $ _5 V  u( V5 D6 {1 i
  36. #include <mach/memory.h>
    ) e# x) b: K2 e& o: ]% J0 V% w0 [
  37. #include <mach/hardware.h>2 m4 g# K% b# N. }! W
  38. #include <mach/irqs.h>9 n0 d5 t4 d5 N. z$ b& ?
  39. #include <asm/hardware/edma.h>" e# K& p; a( K9 ?( x/ P& z

  40.   A  z; H* X, I5 V1 ?/ M: f
  41. #undef EDMA3_DEBUG* |+ e* _$ R* L2 K$ K- m
  42. /*#define EDMA3_DEBUG*/
    ' R" S/ x/ K! j: s, J1 K

  43. * g# R) d  A, n: f6 M( V* \
  44. #ifdef EDMA3_DEBUG
    9 V& H0 G- w9 v" V0 C) [% Y, _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" E- I5 z! \. w" q4 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 N' k6 {" D, t0 G& O; E8 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): X  I9 i, y. b  l! e. b
  48. #else
    ( {2 d' V1 h1 N8 C
  49. #define DMA_PRINTK( x... )! h7 [' H  u$ f* j( R
  50. #define DMA_FN_IN' |" H* T: _  B1 |
  51. #define DMA_FN_OUT
    ' b8 ^! w- f- L+ @9 b- H
  52. #endif
    8 S- C$ k7 O) `- D, Q4 X0 T3 s* |% k3 @
  53. " c! r; s, d( A0 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! \( ~4 Y1 n+ ^/ }7 T8 O( v
  55. #define STATIC_SHIFT                3
    5 ?# v2 R0 v: J2 x
  56. #define TCINTEN_SHIFT               20
    ) L4 q7 `3 O* g( |& D+ y& Q
  57. #define ITCINTEN_SHIFT              21
    " k- v! W* L7 U" O( T
  58. #define TCCHEN_SHIFT                22
    - X( D1 D1 m9 _  z
  59. #define ITCCHEN_SHIFT               23. U' m; {6 O0 o' i! [& A

  60. * U5 ~0 Y5 L2 b6 |0 G/ o# Z
  61. static volatile int irqraised1 = 0;2 e5 H7 o" H9 ?
  62. static volatile int irqraised2 = 0;4 S5 d9 O7 C' I5 p8 H
  63. + p) w- v& |6 u5 P! T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ S& N/ A9 p: }9 c, H8 _/ S( D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ W, U' E3 }# F" R' M( q. F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) A1 M5 T; W# B
  67. 0 M4 t6 ]8 [( O6 a+ S8 p
  68. dma_addr_t dmaphyssrc1 = 0;. @3 |0 [* N8 p  l5 I2 ?$ r
  69. dma_addr_t dmaphyssrc2 = 0;1 \9 a, m! k- O1 x- C" W
  70. dma_addr_t dmaphysdest1 = 0;- t+ e! S$ t* y3 O* q' i
  71. dma_addr_t dmaphysdest2 = 0;
    & P5 F" T! h# \5 i6 L4 @$ r; @6 S

  72. : G3 |0 R! e9 U* S& {) W+ l2 J
  73. char *dmabufsrc1 = NULL;
    5 r: H7 y& o9 p9 F
  74. char *dmabufsrc2 = NULL;
    $ E' F/ D7 a' R+ w5 H6 @
  75. char *dmabufdest1 = NULL;9 W4 g8 X# R, ?1 w; b3 H8 u/ D- w
  76. char *dmabufdest2 = NULL;8 W# Q" t! u5 H7 B# h  `* b7 A

  77. 1 k2 q8 A9 C4 \0 S9 m* l$ _
  78. static int acnt = 512;& \5 f& x4 Z/ s. X0 _* N, ?& E' \
  79. static int bcnt = 8;
    3 d* K* Y; u9 }6 F4 d3 S7 r& U" S$ H# n
  80. static int ccnt = 8;  H% \$ h$ ~7 @; v5 @# N! C/ j

  81. + A- M# g7 c0 U, {  f, M1 E* \
  82. module_param(acnt, int, S_IRUGO);
    : @7 ?  o) O  Q( b+ c9 |
  83. module_param(bcnt, int, S_IRUGO);
    4 x9 w3 V9 g8 n0 b) Z0 y2 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% U$ d0 M) F1 l2 p- }6 B/ d" S+ `9 a! l0 }$ D4 X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  t6 {( o  R7 O# ?/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 ^4 I# w" L) s* n: A1 r2 S) C9 C6 h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% _* M" P- f" F- |0 a" s

* u# I( d, K4 I+ c4 a; j- b
. w) X" @2 P% @# \# X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-24 10:32 , Processed in 0.038767 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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