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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- o1 V! m. ]# N  E8 ~
  1. [code]EDMA sample test application
    , W. `( v! x% U3 ?+ [
  2. /*
    3 R+ X- |$ M1 L1 M
  3. * edma_test.c
    ! m$ ^8 J5 S# V8 Z7 w2 E
  4. *
    / r: ]* Z2 W  f0 D0 p
  5. * brief  EDMA3 Test Application3 g2 p$ l( U  B; l; V/ R
  6. *) |5 L3 C3 w, F8 w4 j# E! \
  7. *   This file contains EDMA3 Test code.6 B  P+ [2 M' _
  8. *
    " R& F3 g# V# A: O/ a  b$ k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : J! Z  x$ d  X, j/ U4 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  r% L2 b! k' w! s" z: R5 Y. O
  11. *         TO CHANGE.7 T) h% e3 i. o  }
  12. *( B' I1 R! F3 ?9 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// ^. h: X9 x- r" q7 e  w' d
  14. *7 U2 ?  a- `# L1 Q( x! `& W
  15. * This program is free software; you can redistribute it and/or
    6 H3 r0 d& _: D% ?* l/ }9 f8 O
  16. * modify it under the terms of the GNU General Public License as' ]+ U: H. ^2 E, l
  17. * published by the Free Software Foundation version 2.
    $ W) T, \% h. X: K) ^% s4 P
  18. */ Q  |1 T! w) r6 Y. S* u. W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 A' _+ T) U' w) j% O) e
  20. * kind, whether express or implied; without even the implied warranty& D0 S" g9 O1 U7 c' W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / y) Y. l6 P. j2 C2 W
  22. * GNU General Public License for more details.: f, x% H0 Y/ M) r9 r/ j5 w
  23. */
    & V& l$ a! L, u* U. J! M
  24. & N: Q' E- r4 _* [# ~- g2 A3 Q
  25. #include <linux/module.h>
    : R2 A: N( p- m2 B  k9 B
  26. #include <linux/init.h>2 H9 k2 g3 u! d1 w5 ^, }  @
  27. #include <linux/errno.h>2 U$ s  N3 H. C0 t* _' D
  28. #include <linux/types.h>
    + V3 @9 e. f, n/ R& N
  29. #include <linux/interrupt.h>! E. _' E% p! m7 L  N, t6 v
  30. #include <asm/io.h>
    8 e  n& b' @4 ^: ?1 b5 m# H2 G
  31. #include <linux/moduleparam.h>
    4 {! h  b2 v3 ]: v1 `, [" \
  32. #include <linux/sysctl.h>4 ^  d& P$ {( Q, r  J' ?
  33. #include <linux/mm.h>& Y# n" U& t2 c3 }. x
  34. #include <linux/dma-mapping.h>
    & |& o- y1 M$ R' ^2 e6 V

  35. 7 o- s! V1 j$ }, N& Q) C6 `7 l
  36. #include <mach/memory.h>
    , b" Y  R8 T" V% o! {' t
  37. #include <mach/hardware.h>
    / q6 ~2 l( U1 ~6 \0 `: s
  38. #include <mach/irqs.h>' p& p+ x5 p* e1 ~3 t: [9 d. c
  39. #include <asm/hardware/edma.h>
    & g1 I: d4 S9 [8 N. }/ m

  40. / o2 j5 P" ?2 D8 k5 t3 m) o+ \
  41. #undef EDMA3_DEBUG
    8 S0 a: J  _5 c. E( @" s
  42. /*#define EDMA3_DEBUG*/
    4 Z2 ~0 L7 o& j( Q5 f5 z3 \! y
  43. 8 r7 V, ^( a4 d5 g: O
  44. #ifdef EDMA3_DEBUG3 ]3 o. `6 P9 g+ G! A/ r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! {7 m% I; E3 k$ b3 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 O9 e% |, i9 B/ n/ i2 P& v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % ]* z) n. _4 Z" P- X) U
  48. #else
    3 n" f6 d  q1 Z$ q9 V( U
  49. #define DMA_PRINTK( x... )
    % F4 f# [$ _5 I0 T5 l) j/ c0 y* w! R
  50. #define DMA_FN_IN! N1 `4 A) J1 {* ^3 C  Y
  51. #define DMA_FN_OUT
    ) J* R* c9 v) I4 }5 O3 u* E
  52. #endif" S2 J! j8 a$ ?6 e2 |* Z0 G" P' Q
  53. ; O% [& o. i$ \( ?9 z9 f' L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 j+ p! h7 d0 ~8 J) R  V
  55. #define STATIC_SHIFT                3
    ) }0 R5 l% Q# s: N
  56. #define TCINTEN_SHIFT               20
    , R0 y$ W7 g, Y8 C; J8 H# o; W
  57. #define ITCINTEN_SHIFT              21
    7 ^- X0 e5 a/ p+ n+ \
  58. #define TCCHEN_SHIFT                22
    2 _0 n( Z( o0 ?5 G& e$ H3 q) q
  59. #define ITCCHEN_SHIFT               23& Z7 A; p1 ]' f& T4 m

  60. 4 W2 ~( T9 m! t' S0 t/ |
  61. static volatile int irqraised1 = 0;
    ( _' g! `, {7 m/ R' _
  62. static volatile int irqraised2 = 0;$ H3 }- d9 f1 G) V
  63. 2 _) W9 v# x9 p- y8 D$ `1 ~* i/ c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. d$ `3 ^. b! O8 y  d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 p. e0 D$ i9 t) n" Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # f' Q+ s6 b9 W, y' c- k, w/ n

  67. 5 @1 e) n7 _0 Z+ x6 a+ i& J7 ^$ }
  68. dma_addr_t dmaphyssrc1 = 0;
    ; U9 {8 U, {, P2 Y0 Q
  69. dma_addr_t dmaphyssrc2 = 0;
    , j& N8 g, X+ w# k& @9 U; y
  70. dma_addr_t dmaphysdest1 = 0;: i5 D5 e! [  \3 m  B; x
  71. dma_addr_t dmaphysdest2 = 0;5 w6 u# e3 S' v* x

  72. 5 |* _$ {- _+ i1 M- Y$ K: S
  73. char *dmabufsrc1 = NULL;
    6 q3 n- J; Y  \! y
  74. char *dmabufsrc2 = NULL;% O$ h* F9 o8 K& S: B- K1 t
  75. char *dmabufdest1 = NULL;
    8 S7 w, t7 |5 P) X9 w3 Z2 V- c
  76. char *dmabufdest2 = NULL;  Q7 T' {0 y, J5 |

  77. % e! ?% X, P! f( Q0 S1 D
  78. static int acnt = 512;
    " W, q& T" S: Z! q
  79. static int bcnt = 8;8 o) [( t9 |1 n$ e6 x
  80. static int ccnt = 8;
    : [, h3 W& N+ A! I/ o# I4 s0 ]: P
  81. , E6 ~# I% B( L" C1 u$ e! j
  82. module_param(acnt, int, S_IRUGO);
    . z0 f% Q4 A8 \  G! ]
  83. module_param(bcnt, int, S_IRUGO);/ b0 [2 l% ]) r7 F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; s/ e/ T% D4 E7 ?1 j" V- C" S% l
) j9 p# N9 h; o1 Y. L) u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 e6 l! W5 _! I# D. V6 O7 X# Barm-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 O5 C' c5 j1 x- D' R! V3 l& U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* [" e5 @, V9 Y: u% m0 z. K" z' Z
, P  \( D2 ]9 T0 f' ^- w. M  p7 W% l1 {

, `  |3 b* X; ^  E" D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 12:25 , Processed in 0.036334 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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