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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / D" `9 i* }0 ]8 Y1 o; L# V
  1. [code]EDMA sample test application( _! I, Z9 T, H" z
  2. /*
    : j' O. N$ S, |$ s* }
  3. * edma_test.c
    % O. G3 A) B  {  @; Q. i
  4. *
    7 ~( u3 s, t2 y* j8 {
  5. * brief  EDMA3 Test Application! ]" S/ b7 D- J! S, ?1 j0 s4 P
  6. *1 I% R( X& r( b5 n1 H9 t; E
  7. *   This file contains EDMA3 Test code.: q" T2 i, Z7 `9 q' F1 B9 z
  8. *! c6 e% q# A; H+ o; H+ P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ n5 P# |- L" V8 y6 h! U2 `6 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 v: s$ F' t7 y
  11. *         TO CHANGE.+ R$ x& ~3 ]% Q; [) A) w
  12. *. [1 x" j% Z) M9 R* `, {- h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; @1 ~" n5 I; l0 l. U) p3 \
  14. *
    6 ^. R, Z( i, X  p9 C% d
  15. * This program is free software; you can redistribute it and/or* \8 F1 ~) F: s+ g" ]
  16. * modify it under the terms of the GNU General Public License as
    ' R+ |) X9 ]" g+ v! m$ S' R
  17. * published by the Free Software Foundation version 2.' v. N$ C4 j; k& Y8 d9 x! |8 {
  18. *
    ) O: p$ N; t+ `. q/ p/ f$ f$ g6 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( P4 h9 s' T! W& `: m5 C4 l0 L' T0 k
  20. * kind, whether express or implied; without even the implied warranty6 t5 w8 l( ?" K  A# @! h* o' \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 h. c& ~  U5 {# }1 P
  22. * GNU General Public License for more details.6 q5 n/ d6 S; @6 p+ _! T$ b5 V
  23. */
    ) C& z4 L+ M1 Z. K) A4 |  l

  24. . [  r" O0 |: v$ f5 a& U* f
  25. #include <linux/module.h>
    ; P2 q8 R# `: _
  26. #include <linux/init.h>
    2 @, V: n4 C9 o% K) Z; n
  27. #include <linux/errno.h>
    # W3 K0 g: _5 `
  28. #include <linux/types.h>- \+ t+ P; B# j  Y( H5 e- g
  29. #include <linux/interrupt.h>  @6 k* h' J; }- W+ K9 G7 D
  30. #include <asm/io.h>/ R  q; q! X) u: {4 U
  31. #include <linux/moduleparam.h>2 b7 F# X" g& J8 e# ~
  32. #include <linux/sysctl.h>
    , p. [, h; q4 ~# R
  33. #include <linux/mm.h>5 K* X1 [* g+ ~
  34. #include <linux/dma-mapping.h>
    " o  T2 e9 [* Y1 `
  35. * `/ M, i; |& O: l
  36. #include <mach/memory.h>
    ( F4 K/ w! q: H/ g' h( D
  37. #include <mach/hardware.h>* A' m) ]4 ~$ X- P# ]1 }
  38. #include <mach/irqs.h>
    $ [0 z" ^' e) i& w7 g3 @: v
  39. #include <asm/hardware/edma.h>
    4 q  G, S9 y  d0 M& T- p- X0 n
  40. ; N9 P+ I1 N& L9 d4 H5 O* L6 i$ b
  41. #undef EDMA3_DEBUG( B& o$ ?4 L1 S7 h" \- z) M  r
  42. /*#define EDMA3_DEBUG*/( b3 ~: d/ {# V4 |

  43. 7 u+ Z' Y; b- Y0 E+ F+ L
  44. #ifdef EDMA3_DEBUG9 E5 w' B# N- z" `2 E* m: p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 H; g6 r; w: p8 |& r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" I% E  u) }0 p9 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , A3 W/ e3 h7 n% ?  I. y' z4 F
  48. #else5 [$ D! t. w$ F
  49. #define DMA_PRINTK( x... )
    * L: v1 J% Y- b* `: e5 A  u7 A
  50. #define DMA_FN_IN+ p8 u  U; n+ D; E- r. w" `( T
  51. #define DMA_FN_OUT( S8 \/ s; V9 y4 S! N' H& `
  52. #endif
    + h% @$ |- A$ j) ]1 A
  53. % o; |- Y/ o# Z% l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 N  \+ r, y. Z- T- s
  55. #define STATIC_SHIFT                3
    % z  Z5 j! Q. [; N
  56. #define TCINTEN_SHIFT               205 Z% X' h- i2 ^- D2 E6 ?
  57. #define ITCINTEN_SHIFT              21/ \8 W& X9 \! g9 m! f- a: G, a& S
  58. #define TCCHEN_SHIFT                22
    $ Q" b2 [& S( d1 B
  59. #define ITCCHEN_SHIFT               23) |0 L. p! [$ x% e7 G* \+ U

  60. . f! b' y: F& S5 i* A1 n- H# w. ?( C
  61. static volatile int irqraised1 = 0;7 o9 k/ B3 X5 ?* ]# L* w; A0 x
  62. static volatile int irqraised2 = 0;
    4 L, ~: q& Y! y: F

  63. 4 V  T  i5 w/ r( f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* K6 d. \; _/ Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . `) ~  I9 O" a# C3 C! ^! n% U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 `- f$ V) S! [) V" K9 i
  67. 3 c( K+ c0 _, f0 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    + g) T6 B- j: L8 l  i0 o! b9 |9 y
  69. dma_addr_t dmaphyssrc2 = 0;1 G4 m0 m3 D4 s  q
  70. dma_addr_t dmaphysdest1 = 0;; b  W3 n: G7 j& h5 m
  71. dma_addr_t dmaphysdest2 = 0;0 T9 ^9 N9 K) N) D2 G  j
  72. ; ]. W4 c' o' i+ T0 V3 a" A
  73. char *dmabufsrc1 = NULL;
    7 F: l" |9 q& u6 p& b
  74. char *dmabufsrc2 = NULL;* ]- X' x5 i1 v7 `$ w" X9 V# A
  75. char *dmabufdest1 = NULL;! O: M8 G; V/ h5 M* _0 g+ _
  76. char *dmabufdest2 = NULL;
    + ^% ~: M9 y' r, m; _- u8 u- A- a
  77. * \. {( w% z3 c; H+ u
  78. static int acnt = 512;
    ; p0 h5 h/ n% e7 v$ v! {
  79. static int bcnt = 8;, g8 \* U+ h3 l, B. }  N( |3 d: @
  80. static int ccnt = 8;6 z% R, b! b3 k" @

  81. ( E: K- g& u- h% N$ o
  82. module_param(acnt, int, S_IRUGO);7 M5 E9 k. M# r# g4 N% y4 t3 v0 L
  83. module_param(bcnt, int, S_IRUGO);* p1 C  L% s! U! B/ j9 h) {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% ~. ?7 {! P* v
5 T. F$ A0 a! V# ~$ t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. V* ?7 a2 u3 C. W6 `& n, iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ k  T/ j5 \- |; y" Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: N. m4 t  z/ O8 D

) A2 }% d" m; k- S# i% p: v, @3 D3 b3 d& r- B( P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 20:31 , Processed in 0.038444 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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