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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 {8 d' f: l& v; V5 o, M
  1. [code]EDMA sample test application
    4 X% e+ Q7 S1 L
  2. /*
    ) \5 F) e/ Q6 r+ M; t  j
  3. * edma_test.c
    ) }  n0 T' q0 W' Q: A/ |
  4. *
    4 O, v+ d: x( r2 w' p0 n
  5. * brief  EDMA3 Test Application' [3 w! d7 I/ e! V) ~9 K! R2 @. k$ E# Y
  6. *
    $ Y7 H- h8 d4 ~. H) Y
  7. *   This file contains EDMA3 Test code.) a) r- c* z" F; o$ _, k
  8. *. N2 f6 u5 J+ |( j  P" K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % ?% q/ F- |" A2 m! k) [2 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 Y- d6 E% x8 ?/ {; W  H* T
  11. *         TO CHANGE.6 e+ o/ N; j* N& ?3 U8 T
  12. *& M+ K' Q) E7 D2 i" P/ B+ h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 g+ J  q' r& A' C! h
  14. *) {  d6 l: f; i  Y
  15. * This program is free software; you can redistribute it and/or  E+ e$ U" a! F  ^7 F0 @' _% i
  16. * modify it under the terms of the GNU General Public License as
    , h+ l2 @- W3 Z9 `* ~
  17. * published by the Free Software Foundation version 2.
    ! @' T1 ]6 T4 p8 u* ]3 c0 u8 C& }
  18. ** o3 z, Z, A0 F7 m: X, ~6 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" p  B) x/ u, P4 [, f/ E5 b
  20. * kind, whether express or implied; without even the implied warranty# R, Z7 k7 x& I6 W( e: S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! z% R% f* [  V; n
  22. * GNU General Public License for more details.# U6 b6 i  s3 {4 b; L
  23. */
    1 |7 `! c6 j4 R- v9 W6 Z6 i

  24. ( v2 u6 x3 F$ Y  [6 E& I: y
  25. #include <linux/module.h>8 S! Y! j! |6 A% v. e4 @
  26. #include <linux/init.h>4 E, Y# }2 _- G; H
  27. #include <linux/errno.h>+ B! M/ A: m- H9 Z' d5 P
  28. #include <linux/types.h>
    2 r8 A* e% B' I) A/ ~* L
  29. #include <linux/interrupt.h>
    & F! R4 l4 E0 `0 k4 V$ E4 I  H
  30. #include <asm/io.h>/ A  q$ `3 _2 X* l; s
  31. #include <linux/moduleparam.h>; H5 z4 W* s9 R4 y: i
  32. #include <linux/sysctl.h>
    1 @/ J4 t$ ~; N* f1 S% n
  33. #include <linux/mm.h>) n% e3 H2 R* x/ u! Y; C: K$ u, t
  34. #include <linux/dma-mapping.h>
    9 g  V# t  Y% J* }; R- n% h" S
  35.   Z# s$ b0 b% x, `5 g5 D% b
  36. #include <mach/memory.h>
    . V6 u' C) r1 O/ r* b. D
  37. #include <mach/hardware.h>8 l& F/ {: S7 y: w
  38. #include <mach/irqs.h>: X, j/ W1 s9 N7 x. K% I7 d
  39. #include <asm/hardware/edma.h>
    : M4 ?- x( \! D

  40. + y& c5 e6 [( G6 O$ ^: w
  41. #undef EDMA3_DEBUG/ M  ]4 |8 X( @9 Z/ s$ G( ]5 j7 r
  42. /*#define EDMA3_DEBUG*/
    * d' ]( ^8 L8 X1 ~

  43. # Z. n& U5 v! H* H
  44. #ifdef EDMA3_DEBUG$ p, D6 P. T9 u! g! o! r! [+ O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& ]% v$ A' Z( _0 E. }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " `& s5 M$ l/ X( Q# h/ y; ~+ _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 q3 l( \1 }4 S# h. E
  48. #else% l) P) b4 O" C
  49. #define DMA_PRINTK( x... )
    8 d* M% k; M3 X& ~$ Y
  50. #define DMA_FN_IN
    ) H, H# I, Q! g$ S
  51. #define DMA_FN_OUT
      f1 [* n/ p7 A
  52. #endif
    + u* f% }' m, t) G0 N: |

  53. 2 z0 i4 l1 d& x2 |) U0 W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 w- h3 u5 x' a9 }
  55. #define STATIC_SHIFT                3
    9 ]7 a. m9 q. H9 h1 }
  56. #define TCINTEN_SHIFT               20) P0 c1 K% G& V
  57. #define ITCINTEN_SHIFT              215 z0 `/ O4 B+ ]8 I3 O4 A# w
  58. #define TCCHEN_SHIFT                22, J: m( n2 O+ N* Z# E: k$ m- P
  59. #define ITCCHEN_SHIFT               23
    # H/ i% @; o" j& ^5 c6 s3 }

  60. 7 X+ ^0 M. K6 d" x, F9 Z+ j
  61. static volatile int irqraised1 = 0;
    3 `- ^' l0 j7 D1 ]8 }& t
  62. static volatile int irqraised2 = 0;9 H3 q* r1 q7 f. S% @
  63. ) t/ `  F* n: L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ G( h! D. S7 A% e" k' ?2 X" j3 {& U2 P+ l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) K5 [% D4 L+ h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ m/ S* k* r9 S5 Z
  67. 3 z; B6 A0 }; W$ {& b2 Y& L
  68. dma_addr_t dmaphyssrc1 = 0;7 }" |/ r" S5 n
  69. dma_addr_t dmaphyssrc2 = 0;& w0 ?5 ^# x& {. w  I
  70. dma_addr_t dmaphysdest1 = 0;
    7 Y& C4 \/ D, ?9 B/ e
  71. dma_addr_t dmaphysdest2 = 0;
    " h. c8 L7 O, v5 u6 X& x" s

  72. . y/ z6 P! r& c% S; g8 i4 R$ g" J
  73. char *dmabufsrc1 = NULL;
      q1 m! G' {( d7 S
  74. char *dmabufsrc2 = NULL;
    " c) G- P( D, {% r
  75. char *dmabufdest1 = NULL;6 x0 R: S: G* ?5 h
  76. char *dmabufdest2 = NULL;
    / K3 H4 A! q% m* y
  77. * ?0 O$ v4 {  @6 j5 \$ C( [
  78. static int acnt = 512;
    . u* k- X$ T, G, G8 X
  79. static int bcnt = 8;  H0 \4 Q0 E2 _4 i% a
  80. static int ccnt = 8;' x/ M9 \4 v. ~( h6 d% e8 S  }
  81. 4 e& @& J) |! i' k& |* [# ~
  82. module_param(acnt, int, S_IRUGO);
    # [' \! `7 b8 c
  83. module_param(bcnt, int, S_IRUGO);
    , x7 w& p* Y% B0 n0 v3 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& H% V2 t  ?6 T4 x5 U  ^! Z

  V- f, J; x6 V+ t2 T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 w# P5 y+ T; b. d* B9 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( O" f* x  N( b) `1 M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( j0 f; ~4 B% S
- X) n6 x  v6 y1 o: c0 C5 b% T0 h" Q" d6 {6 f- L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-26 13:11 , Processed in 0.039716 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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