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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 C, f5 g( n; c$ C! G
  1. [code]EDMA sample test application2 b- @3 e$ ?( [
  2. /*
    ! A, E" F5 n0 r/ @
  3. * edma_test.c" n: B) c0 ]+ c2 ~9 z% N: ~
  4. *! ]1 Q) S0 x- _; \0 f, e! ?- X& o) I
  5. * brief  EDMA3 Test Application7 Z8 |4 d0 {) i9 W  j7 }
  6. *( o& c8 R3 \; n: j
  7. *   This file contains EDMA3 Test code.$ s3 u  t: y8 @4 l1 A7 f" b- W
  8. *
    5 Y0 L3 ?% e# I5 c/ @, |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - k# g& s) p2 Y2 f  i' i; |0 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) I0 A6 Q* c, d+ }( P5 q. g
  11. *         TO CHANGE.  ]2 n$ m# ~) {, N+ @
  12. *
    9 p, E& w  g& T8 P& L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 ^9 g7 \8 M! y( z: ?
  14. *# b( g! I5 }5 ~- N2 n! R$ H
  15. * This program is free software; you can redistribute it and/or
    . j; Z2 q1 g: ^) z( B3 L/ b6 A( m5 K
  16. * modify it under the terms of the GNU General Public License as
    % N; V: Y, v( m) t8 @: Z' T6 ]
  17. * published by the Free Software Foundation version 2.
    : Q/ m" ^2 U1 l* I
  18. *
      a7 ]: A3 d4 Q7 {) V3 D% Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 D* I' ?0 p: x4 y+ I. Q9 K
  20. * kind, whether express or implied; without even the implied warranty: k# {( f6 x5 O* x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( p# z+ [. l. t, r% C2 o; ~
  22. * GNU General Public License for more details.
    ! _2 ~% }4 H& Q, y) R
  23. */
    8 {" }% O: x! N
  24. , D4 J8 Q/ [0 Z; o% W6 ^8 @
  25. #include <linux/module.h>
    : O% I- ?4 v+ ]
  26. #include <linux/init.h># Q  N0 S0 Y4 k
  27. #include <linux/errno.h>
    # f, ~" T9 C8 o/ B7 [, a+ N
  28. #include <linux/types.h>
    ! H; U% n# z# W% e! b
  29. #include <linux/interrupt.h>) s- o( A7 {' r) R% m7 s& c) Z
  30. #include <asm/io.h>
    & P- U& H$ H" [0 d8 N" P4 _
  31. #include <linux/moduleparam.h>
    ) k( ^3 h. {1 [9 p$ o
  32. #include <linux/sysctl.h>
    : [5 b- A' W0 E6 E- Z; X, V! D
  33. #include <linux/mm.h>; H+ i6 g/ f& w
  34. #include <linux/dma-mapping.h>7 L& l: X) K8 J0 s
  35. $ T0 D" j; h( F; N. `- n3 |
  36. #include <mach/memory.h>/ i' L% }8 S' ]4 T4 b6 J
  37. #include <mach/hardware.h>* Y7 Q. n6 G  d$ L5 n( I
  38. #include <mach/irqs.h>
    " X+ _/ Z# Q8 q6 J1 d
  39. #include <asm/hardware/edma.h>
    $ k9 A* M* g# y, j/ I
  40. 2 G' d2 K  S; |# a0 W6 M# o/ f9 x$ E; |6 O
  41. #undef EDMA3_DEBUG
    , E1 l: E' O6 B+ H6 f
  42. /*#define EDMA3_DEBUG*/. o/ t* @) p3 \% K7 U' t+ ~) H

  43. ) l3 g8 E+ T+ J# t( C5 [! a
  44. #ifdef EDMA3_DEBUG
    # T$ U. y7 l3 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( ^7 u" W. n' \) g# O, I0 r8 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- E" t1 @- \& l" U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 o7 L* K4 T% w( m
  48. #else; ]9 g  y* k0 i7 Y
  49. #define DMA_PRINTK( x... )/ C4 Y$ g; f6 I6 @
  50. #define DMA_FN_IN: e% U+ y. z* }9 ^+ B. P
  51. #define DMA_FN_OUT+ y6 o. ^) Q5 d/ ^; a) `
  52. #endif
    6 X/ v1 U1 `- z  S. b- j5 @
  53. ' U; o& W0 B* U1 t% x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # j7 H$ D  A; X3 k. X
  55. #define STATIC_SHIFT                3! h2 Q9 V2 @% s. v0 S
  56. #define TCINTEN_SHIFT               20
    $ |* l3 r7 _7 ]: l# L
  57. #define ITCINTEN_SHIFT              21
    : z4 Z! J& B* n& M, g
  58. #define TCCHEN_SHIFT                22: s% m7 W% f7 g  f  I! r3 l
  59. #define ITCCHEN_SHIFT               23
    5 c) W1 s. ^- B: N! P
  60. + ]; ?; \! D+ ^* n  b( D
  61. static volatile int irqraised1 = 0;3 K' u. P) i* J& H) }; D
  62. static volatile int irqraised2 = 0;4 s* \& A8 u3 d: c0 y

  63. 8 h* _0 ]4 N4 ]9 i+ V# S/ F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 }6 v4 [( e1 i  b, Z: l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Q, j9 \' Z% P1 b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& r! g# Y' s. w% K8 v% S
  67. , |% `4 r' ?% p2 q
  68. dma_addr_t dmaphyssrc1 = 0;
    ) e" l; H+ |1 v- D* k6 T2 r
  69. dma_addr_t dmaphyssrc2 = 0;+ @" P& H4 F0 Q" t/ t  P
  70. dma_addr_t dmaphysdest1 = 0;
    3 F+ m4 E& r/ J% g# w
  71. dma_addr_t dmaphysdest2 = 0;; W- Q5 y5 c7 ^) v0 d; ]
  72. & t4 M7 O7 P' {! a
  73. char *dmabufsrc1 = NULL;: N  |% j3 A: w2 H) _4 u, k5 B$ R: R
  74. char *dmabufsrc2 = NULL;
    ( x5 m, K0 ~& {. G
  75. char *dmabufdest1 = NULL;
    8 M" z9 F( }4 }& }4 F3 r
  76. char *dmabufdest2 = NULL;/ g2 A! e& a/ M6 U
  77. ) [1 r3 `. _6 ]% [4 K3 C8 F
  78. static int acnt = 512;& Q9 W3 Q9 n( t* j
  79. static int bcnt = 8;8 F: }5 ?; E8 L0 e' v$ @
  80. static int ccnt = 8;
    ) Y6 i, x2 U; F; W$ P. h. c8 d
  81. ; q' B$ y% a2 q' V$ g: l" r
  82. module_param(acnt, int, S_IRUGO);! [6 {( S3 {! `
  83. module_param(bcnt, int, S_IRUGO);" A2 o2 U0 X$ q  \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ w( W6 ?9 H- |1 s
2 d( E5 B9 m$ N: D0 O) E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. ]+ Z4 J6 I2 `' Z9 H9 q9 |( `2 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ Q+ X" Z: k! j% S1 O7 j7 L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 J: w) s- P. [- C; f# d! [

+ P8 k4 G+ h! j; d: C2 e" |& }6 A  O, i2 n" Q+ l) t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 18:42 , Processed in 0.039063 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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