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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / O1 X1 s$ C4 l% [/ k- ^' Y
  1. [code]EDMA sample test application7 B+ Z7 u3 N6 }  A. d
  2. /*! k: u( s- w( N0 P
  3. * edma_test.c$ r) t9 r9 [+ B4 n
  4. *
    - i2 m7 M! f2 R; }
  5. * brief  EDMA3 Test Application$ X& D4 C1 D4 }: L3 `5 O
  6. *- q  {, j1 j3 |1 V) u% [
  7. *   This file contains EDMA3 Test code.) S2 e! `, Z- {* @( N
  8. *
    5 K( O4 K5 T' k* B. r; A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % U+ V- [, ?9 Q3 [  w; Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . d( {, ?/ i% d6 [( {4 h" o
  11. *         TO CHANGE.
    * j5 t, G& |! T. E
  12. *( E8 P! z4 e# S+ f3 f8 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, Q3 m4 ~- q" P) A9 O) B4 \
  14. *
    # j" T; \6 y9 Y& z& d0 H0 i
  15. * This program is free software; you can redistribute it and/or; G  @6 W& a) Q9 G# I5 m
  16. * modify it under the terms of the GNU General Public License as
    7 L* L; [, L* R- f% m- A) p
  17. * published by the Free Software Foundation version 2.
    4 ]- l& @0 j& b
  18. *$ T& I0 S9 g+ Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" A2 X) R# ^# K7 W
  20. * kind, whether express or implied; without even the implied warranty
    * J; I0 X* H0 G* ?- T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 B3 L; @- p$ |- |7 p$ g
  22. * GNU General Public License for more details.8 l* c) z0 @  w6 L. |7 F; f
  23. */0 O7 G, }8 Q) s3 Z( l- \! E) f

  24. " K' n5 c5 o  L( X1 A: p2 f
  25. #include <linux/module.h>
    : C3 z6 j! O1 ~* e' c. H
  26. #include <linux/init.h>
    0 b- U9 w  b$ o
  27. #include <linux/errno.h>
    , T* h3 a- ]2 ?! ^8 x  E* D
  28. #include <linux/types.h>6 L" q  d; A) N& {5 n9 R
  29. #include <linux/interrupt.h>
    ! m3 U. u+ c3 p+ G
  30. #include <asm/io.h># z+ \( M6 J& Z6 f' A& _' p
  31. #include <linux/moduleparam.h>
    5 `' {/ S- K! Z8 a& P% s
  32. #include <linux/sysctl.h>0 O) J6 K- V: W& _% F( `# i( A  I
  33. #include <linux/mm.h>
    * S+ g8 G& H0 ^* |" L. E
  34. #include <linux/dma-mapping.h>
    3 V; e' c) b! U
  35. : K7 S+ s% T9 S1 k0 H$ Y8 M& w
  36. #include <mach/memory.h>
    5 \- N; ^# f* ~9 j' S
  37. #include <mach/hardware.h>8 H- a% f3 L0 n( f
  38. #include <mach/irqs.h>
    : N( E/ x3 y4 _% Y% u9 h
  39. #include <asm/hardware/edma.h>, t5 t; O  O2 z1 Y1 N4 }

  40. ) _  K0 Q8 E  Y9 S7 {
  41. #undef EDMA3_DEBUG. @! }$ ^5 {$ I' e9 f
  42. /*#define EDMA3_DEBUG*/
    : x  W4 {) t0 D) v; n& b
  43. ! j# |# I3 D0 P9 K. e4 b  N
  44. #ifdef EDMA3_DEBUG
    1 a7 l1 b  u" q$ h0 w+ C: a3 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 J6 E, l6 h# L! J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & Q0 @$ e- T7 J0 f$ A% o. n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , N9 m. w+ B, z! V- a) c
  48. #else
    , W+ N) N$ @+ {
  49. #define DMA_PRINTK( x... )  L; [: Z" ?/ \4 o6 p0 |+ e) C
  50. #define DMA_FN_IN. s! E2 r5 b  V
  51. #define DMA_FN_OUT: z1 H& x* E" U& R
  52. #endif$ o- ^; E$ l! X9 _' [3 @
  53. ; `! h, A' K8 G5 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* y. S1 o- j9 w4 ^/ ?1 M8 ^
  55. #define STATIC_SHIFT                3/ P) y) x+ h/ P  d, x- b
  56. #define TCINTEN_SHIFT               20% k" }7 B1 \% o% ]  h0 a( o
  57. #define ITCINTEN_SHIFT              21' W( C% f5 Q' c% C7 @
  58. #define TCCHEN_SHIFT                22
    + T7 ^2 D  t' l9 L3 b* _1 ?" L/ I! B
  59. #define ITCCHEN_SHIFT               23. n* R; R. W. }3 L- \% v0 \

  60. 7 b! B) N4 Q) d- j! g
  61. static volatile int irqraised1 = 0;
    ; O# s/ i5 Z% v  E  F# D+ I' s2 Z
  62. static volatile int irqraised2 = 0;
    * _' q2 X9 S, a+ ^5 m6 L/ \* G" V

  63. - w7 Z- ~" G4 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 L8 ^+ j( R0 N0 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + [' r$ q& G. c: q9 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* }, w+ k) i& E/ z- S9 O

  67. ' }: e; ]: _) N1 d6 m" P8 G- d
  68. dma_addr_t dmaphyssrc1 = 0;
    7 D. U- Q/ [7 d5 U. |
  69. dma_addr_t dmaphyssrc2 = 0;
    * V" F) |2 u0 Z4 [. N7 D  i3 j
  70. dma_addr_t dmaphysdest1 = 0;
    . y; Q8 ~4 u- l+ @! W' V4 w
  71. dma_addr_t dmaphysdest2 = 0;3 A$ x$ I5 k  f8 x- x2 Y3 c$ f1 a  L) c

  72. ( `* ~$ D* \5 B7 m$ ?) E
  73. char *dmabufsrc1 = NULL;$ F/ b: X( P( H& F% y  H
  74. char *dmabufsrc2 = NULL;2 r0 v( g% b! T: c, ]9 E+ v
  75. char *dmabufdest1 = NULL;7 Y5 B; v; _7 a& a
  76. char *dmabufdest2 = NULL;# H% q+ k* H3 j9 z* G
  77. 3 F" y1 c. h% F" L# D! o" H
  78. static int acnt = 512;
    : W1 a- \  |+ `& r
  79. static int bcnt = 8;. r/ i) }8 j  R  B
  80. static int ccnt = 8;8 w. H& h; r, h! f

  81. & f1 r; O  W: D7 P) d! ~& k; ]+ A
  82. module_param(acnt, int, S_IRUGO);
    ( u5 p, J+ U2 H; y" H0 I
  83. module_param(bcnt, int, S_IRUGO);
    9 z- d' ]( Q( p5 u5 K) \$ \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ X2 b  ^5 P5 d, Q# \# j" L' x* D, R
& d/ L/ n* B1 y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% |3 F8 `. D4 X3 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 [8 i/ K; x% I  N. |3 C) i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 l  z) t* t. x8 p7 p4 D. k0 y& s! j  o) z# w; V
! p: g2 j  r- Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 17:44 , Processed in 0.038565 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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