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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; s  v0 m+ I5 R7 o. p- H) M
  1. [code]EDMA sample test application
    2 E' b3 B3 F( w+ C' L
  2. /*7 `9 a- B; S# I6 f8 G; ^# p
  3. * edma_test.c
    1 _4 X" e6 k7 l
  4. *0 \/ O+ R3 {/ D4 f9 m7 R8 V1 [
  5. * brief  EDMA3 Test Application8 v5 c' f6 I6 N
  6. *" h& O4 h9 v- d" l9 z
  7. *   This file contains EDMA3 Test code.
    & K1 _) K( p3 z' A- d: Z% T
  8. *: R( l3 l9 N* _* H& z) a8 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ \2 l7 f" c8 q% t/ [# ?  c4 V% A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 _( ~3 T6 X3 p+ l; t+ F: x
  11. *         TO CHANGE.
    4 `) v' h/ V" T9 @/ L: G4 x
  12. *
    , h8 i4 a0 `% s9 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 C/ ?4 A$ D( x. z5 U/ A
  14. *# a7 \6 H8 P, q5 ~: N/ |9 [
  15. * This program is free software; you can redistribute it and/or
    * j/ I$ ~4 d: U% x; d% s- X# V
  16. * modify it under the terms of the GNU General Public License as
    / J* I1 U) F* V  J! C
  17. * published by the Free Software Foundation version 2.
    - c3 q9 R) \1 r! W8 I0 j
  18. *
    % l# C! T9 D4 c! m0 o1 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 O4 ]- w) ~6 k9 y# V* n; [% I0 m
  20. * kind, whether express or implied; without even the implied warranty
    2 O9 l& K% I1 b% Z; u' o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + N& h' t7 L8 z! @
  22. * GNU General Public License for more details.5 S0 G- s5 |7 I) n& X* D: g
  23. */
    9 U9 E" }3 M3 W- ?
  24. : L& a8 j% |, X
  25. #include <linux/module.h>
    # |) O% h8 O+ C" ^. V; V2 |
  26. #include <linux/init.h>8 d" c( W; w) y) X
  27. #include <linux/errno.h>/ N, X  {7 y4 o" g5 V  j4 F" U. u
  28. #include <linux/types.h>
    . f2 a3 T$ P  p; Q0 w4 T
  29. #include <linux/interrupt.h>
    5 {" U: \0 G/ m- E! o9 |# z5 a$ E+ M8 Z
  30. #include <asm/io.h>* Z: ~3 _+ V" Z* g5 a8 B
  31. #include <linux/moduleparam.h>
    % {7 P9 g+ `4 ?
  32. #include <linux/sysctl.h>4 t! I8 O  k2 x+ l6 ]5 u
  33. #include <linux/mm.h>: C# Y  h6 x& S  D  K8 f$ S- f
  34. #include <linux/dma-mapping.h>2 X& I* }" \- y6 m3 m- L6 ~* ~' [

  35. * s5 O5 ~7 K7 J) h" M
  36. #include <mach/memory.h>3 S0 `" D8 J6 i1 {3 p5 K- T
  37. #include <mach/hardware.h>) o& j9 W$ ?* c, r
  38. #include <mach/irqs.h>3 Y% q& e% E* b3 I
  39. #include <asm/hardware/edma.h>
    + d; P( i& U9 p. L* Q' v

  40. 5 e& v( T2 T$ Q8 j4 B- m
  41. #undef EDMA3_DEBUG
    9 l" J; r5 Z$ Y2 |+ u
  42. /*#define EDMA3_DEBUG*/
    . C$ ~( \* \8 |, h7 S3 c
  43. ; `8 Q6 R# [  r/ I7 }" ~
  44. #ifdef EDMA3_DEBUG' E5 h/ U  |) O" f3 ]% Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; K) r/ W) D2 M+ p! U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 A2 N; B- J0 l  M0 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& X" `9 C- S. @5 v. L; P6 l1 L
  48. #else
    ) L3 Q3 J/ z( g7 T) `  V' m
  49. #define DMA_PRINTK( x... )( R' D! i& {' t% a$ d9 M! R) {
  50. #define DMA_FN_IN
    ; `: f! f) D" D' K5 u: h
  51. #define DMA_FN_OUT9 `4 e8 g( q, u& w# T* u* A
  52. #endif8 y, c8 I- R" }! p, W

  53. ) I6 d1 l( N+ I) C, T: E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 D" A( _. X3 l' y3 Z; K/ r
  55. #define STATIC_SHIFT                3
    7 H  c) D5 O. G0 D( V& i1 b+ ]  N$ Y
  56. #define TCINTEN_SHIFT               20. H* e0 Z; z' _! \' V
  57. #define ITCINTEN_SHIFT              217 e! I1 _3 T* D  D' G$ @
  58. #define TCCHEN_SHIFT                22
    ) h4 D, k# i# o4 h0 t% I
  59. #define ITCCHEN_SHIFT               23
    # G: @3 c" o  J, ]+ c; u
  60. : Q2 b$ d# ?- G' S) \
  61. static volatile int irqraised1 = 0;$ |4 V9 H6 H( _. X
  62. static volatile int irqraised2 = 0;1 \6 S6 G$ J5 m6 a8 e

  63. / r! w; U+ a# m# ?/ q, |, d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 K- v' u2 Q. Q  N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) n9 Z5 Z) Q! O+ z! h" q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( r0 @* S. x, L; z# T0 L7 y

  67. 0 A' y! R/ f9 g4 D
  68. dma_addr_t dmaphyssrc1 = 0;
    2 T6 G* x& Q- o$ _9 N
  69. dma_addr_t dmaphyssrc2 = 0;1 |* ^, m6 b; `8 O; o7 p) q& Z
  70. dma_addr_t dmaphysdest1 = 0;
    & Q) P; b: q2 X2 Z5 {
  71. dma_addr_t dmaphysdest2 = 0;0 M6 j2 m1 C, ]. c, z0 }' a0 [
  72. ; l6 h3 ?/ I; D. p0 [! E5 X
  73. char *dmabufsrc1 = NULL;
    4 i1 s, ]7 h! C7 A
  74. char *dmabufsrc2 = NULL;  a; Q; M1 h/ b5 [9 ?& U% k
  75. char *dmabufdest1 = NULL;
    $ f& s7 h. p/ X1 J! ~. T1 _
  76. char *dmabufdest2 = NULL;
    6 K* `, o1 y0 l

  77.   n1 A0 p2 m) Y! _7 N+ y
  78. static int acnt = 512;; D# F5 O1 b$ Y: M. C
  79. static int bcnt = 8;7 K, R2 L: ?0 B& B6 O9 Y; S% v
  80. static int ccnt = 8;/ S8 X3 q1 R, l, k- v
  81. " _, e  v+ s7 B  F% w
  82. module_param(acnt, int, S_IRUGO);
    % r; O1 L% W  Z1 d
  83. module_param(bcnt, int, S_IRUGO);
    - }1 c% v- S0 N1 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: i+ R5 F0 w; i, G, \% z" j6 \3 F* R' V9 ~  ]. F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( a6 E# o4 ^; K4 x. l4 K. d( N# k6 @( d6 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* w: f5 t9 N; A  f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; W" ~4 _; n2 W
* t; Z" [; Q3 A  ^
1 D5 O0 x& f1 k' F& D! N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 15:04 , Processed in 0.040344 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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