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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, ~# ?/ U' L- v5 e
  1. [code]EDMA sample test application
    / g& |  D% d4 X/ j4 U$ d, g3 h
  2. /*
    , F- J' c8 C$ b, F( n
  3. * edma_test.c; F& e* i4 q. x9 |3 G; v  e/ Z
  4. *
    ; _$ ~1 d  ~" v
  5. * brief  EDMA3 Test Application
    ) g; @$ b& N! m2 R$ E( r
  6. *) {3 Z# A( b& o; Z
  7. *   This file contains EDMA3 Test code.
    4 K* H4 b' r% s: f# V' y! ~, j0 t
  8. *
    6 ]# L2 r$ q+ E7 v$ R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 A% [5 t3 o3 w6 D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 t6 Y% I- U# V0 I* e) a7 s8 O
  11. *         TO CHANGE.
    & Y8 O1 Y1 f+ a2 h
  12. *
    * ]0 {6 H1 k1 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # v; }; g: y$ {& k1 t! c
  14. *6 F/ p4 L. ~$ R1 [2 x
  15. * This program is free software; you can redistribute it and/or, U0 g& G% B8 f
  16. * modify it under the terms of the GNU General Public License as
    / b3 {- L0 p1 p4 \6 Y
  17. * published by the Free Software Foundation version 2.; b8 S6 }+ ~* r& o' A5 A* a' d- l% F
  18. *, J; [7 w$ m& R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 F9 V1 V4 E; m0 B' Q
  20. * kind, whether express or implied; without even the implied warranty+ C# h0 v' P. _! D% y* c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 Q5 r) H5 h0 l! p' c( r# |
  22. * GNU General Public License for more details.
    & j0 s5 J8 \! `0 k/ E
  23. */
    9 c/ i) _, \% K

  24. 1 r+ p& n5 X; _' z- S2 y6 s6 \; [
  25. #include <linux/module.h>
    1 n# }/ t. w, l1 E7 y
  26. #include <linux/init.h>; P& G4 f+ P8 c
  27. #include <linux/errno.h>& Q! q2 ?) W: f- N. h
  28. #include <linux/types.h>
    ( Z8 Q! Y5 e' b: |, K7 S2 A
  29. #include <linux/interrupt.h>
    * \, j3 h7 w$ {$ f, ^
  30. #include <asm/io.h>. a. T- W" Q8 E+ ]6 G
  31. #include <linux/moduleparam.h>. B5 \% F0 d$ {- c5 R6 N2 C8 F
  32. #include <linux/sysctl.h>' n0 e& m  f  i' \
  33. #include <linux/mm.h>
    $ L0 \: p7 L1 R& z+ o. J8 P1 v3 q
  34. #include <linux/dma-mapping.h>2 O4 a# \! e" M
  35. : A2 T/ @5 k2 [7 R# X* _" F3 ]
  36. #include <mach/memory.h>
    % p6 a- y/ G% [* R
  37. #include <mach/hardware.h>
    5 K1 E6 D- Z% k7 S
  38. #include <mach/irqs.h>
      R, v+ _, J9 |. b& o0 ~7 p8 w% w
  39. #include <asm/hardware/edma.h>4 c- D+ J% e: Q! e) _& Q

  40. % x5 M+ @8 |2 i1 n& Z/ u- @
  41. #undef EDMA3_DEBUG
    % I, \# o7 O# y2 h+ o0 }
  42. /*#define EDMA3_DEBUG*/& \: y( j- \3 j  @' k/ |. l9 X

  43. ( ^( D& ^8 r1 z- F3 U. U7 E
  44. #ifdef EDMA3_DEBUG6 X) B4 S& [$ |$ U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 J( Z3 T; {: J9 H, D  O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ L7 }. j! G9 F  U) t6 V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 }: u) g1 X, h4 \; g# _* F8 j; ~
  48. #else
    * c6 H7 Q  I' G$ M9 [  X
  49. #define DMA_PRINTK( x... )  _. r/ _! F, l
  50. #define DMA_FN_IN
    6 Q; `# M+ ?1 G; g
  51. #define DMA_FN_OUT* g  `9 A# `* D* p( B
  52. #endif0 `6 T& U* q) I* e3 p$ H
  53. 5 R; D. N; m. m+ ~0 Q8 [6 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 v5 I. R5 t" ]9 I; k3 T+ A9 E
  55. #define STATIC_SHIFT                3# V0 I  z' n, ?: `" y/ e4 Q4 k
  56. #define TCINTEN_SHIFT               20
    6 e; T/ _( M# f3 }
  57. #define ITCINTEN_SHIFT              21
    1 g3 M+ n: j$ d& l6 e' u
  58. #define TCCHEN_SHIFT                22
    + C' V0 [3 M* g
  59. #define ITCCHEN_SHIFT               23
    6 b# n& ^; P7 K/ d# `$ s
  60. % m# H; r( K+ D1 E3 @
  61. static volatile int irqraised1 = 0;
    / v: n: i. K4 i4 u3 q. @% q
  62. static volatile int irqraised2 = 0;  x7 _9 _6 e) r, b/ r
  63. ' O/ I' ?9 b) I- g- t" e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! [4 d2 i. N2 o* j2 y6 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) w. H, M" T- r& E  L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ @8 F. s, J! p) J

  67. 2 F- M! E+ {1 Z: ]
  68. dma_addr_t dmaphyssrc1 = 0;
    5 P& t2 \3 W# \+ N! j
  69. dma_addr_t dmaphyssrc2 = 0;. k. j: f8 _. U- R# ^( c1 n
  70. dma_addr_t dmaphysdest1 = 0;
    3 c1 I' j1 n- ~- A* P# @
  71. dma_addr_t dmaphysdest2 = 0;
    - @0 s/ a6 R% b8 J2 ~

  72. 8 _0 Z2 @" a9 j" r3 k; |4 Q
  73. char *dmabufsrc1 = NULL;
    4 Y5 d# |. R5 M8 N% _" T* o
  74. char *dmabufsrc2 = NULL;! k$ u- t8 Y8 Y( Z9 F! ]
  75. char *dmabufdest1 = NULL;
    ) f9 w& k1 T8 [# ^7 A! m
  76. char *dmabufdest2 = NULL;
    9 m  f* H) e1 q7 G

  77. ( Q: j9 l+ m8 V+ e# q. x
  78. static int acnt = 512;
    3 P: h7 q8 c6 M' J! j" M
  79. static int bcnt = 8;
    ' ]) {" Z. |3 c8 f( f: R" Z% U) O
  80. static int ccnt = 8;! ]9 f& P; ^8 Q6 @

  81. / U" F, o; m# r4 C0 j
  82. module_param(acnt, int, S_IRUGO);/ I' a6 H9 s- p( M
  83. module_param(bcnt, int, S_IRUGO);
    / D% _9 t, J& @/ ?; B0 u  L. }; j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) L0 k% ?4 K# \

( _" r- n+ i7 h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. m! U2 [8 {/ d, A1 X( p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 ^: ?% q! n% ]) i6 q! Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; ?/ R( W! a3 C' L+ b- ~0 N' M2 a& o9 B, r, y- ^1 P" }

3 Z3 c5 {9 p- W. j; M9 a0 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 00:42 , Processed in 0.039725 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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