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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 U; |, ]2 w0 ^1 u1 p) x, Y: m: a  [7 D
  1. [code]EDMA sample test application
    , S; F6 V. l2 |# O
  2. /*
    " e# Q: d% x3 c1 h6 b- s
  3. * edma_test.c0 j) O2 V! A8 \, p* s& x* c0 r) L
  4. *7 b+ g' s( O/ g8 Z0 x
  5. * brief  EDMA3 Test Application. `9 E8 t8 S9 y# ~& F# g) U' w
  6. *
    . x$ m9 {7 y3 u% }7 _
  7. *   This file contains EDMA3 Test code., E2 r) S+ ~/ q/ ~. ^2 G' Y, g
  8. *: j  m. ^4 J, ~2 \* Y2 C, Z% B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 w$ J: u" h0 b7 j) t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ s$ c6 _) u( f3 [
  11. *         TO CHANGE.
    , w5 O7 k0 {$ ?/ i' l; i1 |
  12. *3 y# ^: A" I! ]) H+ d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 }: E9 _4 n9 g0 K
  14. *
    9 w. O( S2 @- ]
  15. * This program is free software; you can redistribute it and/or
    8 H/ {5 H- F; }
  16. * modify it under the terms of the GNU General Public License as
    # k9 Y' r) m4 |
  17. * published by the Free Software Foundation version 2./ u+ Y1 p$ C" I3 D
  18. *
    4 d' W8 E! z: M- ^. q6 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; t. x; b, a( P6 z7 i+ |
  20. * kind, whether express or implied; without even the implied warranty- U+ f+ G2 l$ O& d9 M- y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( K! o" }& @1 p; p4 k  i
  22. * GNU General Public License for more details.
    7 w1 V1 u/ Y0 `/ b& ]
  23. */
    6 t# p* ?4 [) r$ b
  24. : ], g9 x3 c5 w3 r
  25. #include <linux/module.h>8 s0 w2 u3 o/ Q! @0 Q7 j
  26. #include <linux/init.h>" s1 z# E5 I; U0 t' L
  27. #include <linux/errno.h>. ?8 S6 [# l2 S4 X+ p- Y
  28. #include <linux/types.h>
    % _0 u( O1 m% \  Z) W
  29. #include <linux/interrupt.h>8 L7 d& N( {7 l' b9 N  K
  30. #include <asm/io.h>
    9 y0 L8 f, K! _3 Q
  31. #include <linux/moduleparam.h>
    0 \1 ^5 _! ^! _5 E! i2 @6 I
  32. #include <linux/sysctl.h>
    ! I: A7 ^8 H* U  d3 L- X: Y9 E
  33. #include <linux/mm.h># a9 }2 U" r0 X4 ~& _: Y# Q
  34. #include <linux/dma-mapping.h>) m% i  ^. k$ r8 l3 u; N# B- D  b

  35. / _: O! t6 i& |# Q1 |( _( S
  36. #include <mach/memory.h>
    / J  `( \% y3 _" x" f
  37. #include <mach/hardware.h>4 V2 A  |& z' Z# H9 l
  38. #include <mach/irqs.h>
    9 B' Z5 ?/ ?" k/ s- `# [
  39. #include <asm/hardware/edma.h>& \/ j5 L, z/ }* P, }

  40. ! \9 ~- i+ ]0 g% L6 R" A
  41. #undef EDMA3_DEBUG
    # `  ]$ m6 L5 G+ }* A
  42. /*#define EDMA3_DEBUG*/
    / ]' q/ T% J1 ?) R& K. _
  43.   d) ?/ \; Q' }( b( Z+ ~
  44. #ifdef EDMA3_DEBUG
    5 q7 |+ ]. Y: }& x7 m- _" G" r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 l' F' s0 b6 p$ d$ J  {4 w: A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 o) r0 G. {  F: Y  Z0 a. u. h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 Q* [4 k+ H( w2 E
  48. #else, q( c! P8 M, M4 f! l) e! ]* G! w! c
  49. #define DMA_PRINTK( x... )2 d- F$ G0 s1 M3 h
  50. #define DMA_FN_IN& A, N% C, }# O9 o# t" X2 V
  51. #define DMA_FN_OUT
    % ?8 d( p, s7 O$ ^
  52. #endif# r" a% b% G2 t  Y5 \
  53. : s" s7 E1 _. ]) L8 V4 R2 ]' n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) Y# Y, \; {  t- f( D  X
  55. #define STATIC_SHIFT                3
    9 K; X9 T8 n6 |- g, f
  56. #define TCINTEN_SHIFT               20( W; ^6 e5 I+ `5 @. F
  57. #define ITCINTEN_SHIFT              21
    & E9 `. D4 X( r) I) D; H" j8 W. E7 X  }
  58. #define TCCHEN_SHIFT                22
    . H( J$ ~1 b# k! G- ?) h
  59. #define ITCCHEN_SHIFT               23" N0 z" P; A0 k+ l7 r" O/ D& ]( y/ ?4 j
  60. ! C; _$ V% E6 D1 Z
  61. static volatile int irqraised1 = 0;
    8 a3 I6 j* D0 D
  62. static volatile int irqraised2 = 0;" s* J% ]/ Z* e& N; U& v- {

  63. ) b& l. H! B, x, p1 W& ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! o9 t1 g8 m/ Y6 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 [! {. a% A$ v7 l! T6 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! h, c5 p" H; P5 i( U$ I' |$ \

  67. 6 i$ k/ y6 Y# x* E9 a
  68. dma_addr_t dmaphyssrc1 = 0;* H# l3 }* Q4 Q1 _
  69. dma_addr_t dmaphyssrc2 = 0;# A% ]8 B0 _: f9 y
  70. dma_addr_t dmaphysdest1 = 0;
    $ h3 x% s9 t: ?- |! t
  71. dma_addr_t dmaphysdest2 = 0;
    ! K) G6 C% h1 G9 u
  72. 7 w) w' k9 _" S& g5 c" e# U# q
  73. char *dmabufsrc1 = NULL;
    8 M9 b3 \' E- W# O# M* B# L, j
  74. char *dmabufsrc2 = NULL;
    ! Y* U2 ?3 [1 ]
  75. char *dmabufdest1 = NULL;
    ' v+ O: B; ?; o1 R
  76. char *dmabufdest2 = NULL;9 O- C# w# ]8 T! @" B& R

  77. 5 C" h8 E% {) s; j6 }
  78. static int acnt = 512;8 y1 T* W3 n8 t. K2 a
  79. static int bcnt = 8;
    0 Y; j' f" B& F# F6 O' y
  80. static int ccnt = 8;( b" H) c9 n( K5 O. ]; ^7 B7 `

  81. : Y1 t; z% ^: P+ P
  82. module_param(acnt, int, S_IRUGO);6 [5 v2 F! ^) T. K% u
  83. module_param(bcnt, int, S_IRUGO);0 L. X  i4 z' t3 V" i# ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, k1 E1 e' Z" h! R6 r: B! c
5 [7 x) j* r0 m- y8 K+ P  d6 c5 I& v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 ]$ S+ i% o" G$ {3 K% ^$ Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 k+ Z! ^6 m, ?  y/ t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! M3 Z) ^* s4 V. h; N) S! b2 ]
7 D7 \/ n6 g8 s4 i% r
+ G2 w5 }3 ^: q& h/ w! N2 h' f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-9 03:34 , Processed in 0.040970 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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