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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- F- z) F! Y! ~' x- f0 i! C
  1. [code]EDMA sample test application
    0 r0 h$ s$ ~2 x
  2. /*% Q& B5 v- H3 U- D" i) u
  3. * edma_test.c. I; @& C6 y; K6 S1 @- |5 w
  4. *
    ' ?3 p9 u% ]  p, R. w
  5. * brief  EDMA3 Test Application
    / i& A( E, G( @& k
  6. *
    & u7 y5 p" `% B8 b
  7. *   This file contains EDMA3 Test code.
    # f& {! c6 r4 G) S! b+ P5 T
  8. *0 y+ a* A# J; s) O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! X- e7 ]+ w7 u4 G2 e) D" g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 m# Q7 i) i, I, F
  11. *         TO CHANGE.
    9 L( R0 _) @. P- l! h% V( C
  12. *6 N" @7 m6 P7 O: Z% f! g* H2 y- ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + ^5 K7 F5 \+ J3 c" \
  14. *
    1 X$ |' q) J8 g9 N9 I/ g
  15. * This program is free software; you can redistribute it and/or, L  i$ }9 [4 j; p  T! ?) u
  16. * modify it under the terms of the GNU General Public License as
    6 p' v  x0 d) Q, C0 I
  17. * published by the Free Software Foundation version 2.% j# {) A1 j1 ~' Z. D3 w0 E/ I* E( r
  18. *: K3 W! H- u. x: H& Q" n+ l( A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + l2 \# W! ]: @2 Y/ o) t# z
  20. * kind, whether express or implied; without even the implied warranty
    - m( l" M# k# O  O  C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % ?) I: N: a% D( c. a) V: _3 d( k
  22. * GNU General Public License for more details.4 F( O  M9 n& Y7 y& a
  23. */
    / T0 P% b4 _6 g

  24. 8 K5 A" A: n6 D' v/ H' k# w
  25. #include <linux/module.h>
    ! A; {$ X# J! M- P7 f
  26. #include <linux/init.h>
    + E! z: w# Z8 L( C! W( v% F
  27. #include <linux/errno.h>
    ) X4 P8 I4 J: T2 m
  28. #include <linux/types.h>
    3 Z4 S. z+ V# [; ^  V4 ?
  29. #include <linux/interrupt.h>
    + |1 A8 x2 D! f. ]& n+ |
  30. #include <asm/io.h>
    ( g& N& K  X+ A- ?1 G
  31. #include <linux/moduleparam.h>
    7 I$ f8 s  }7 ^( K  L
  32. #include <linux/sysctl.h>8 k; r: e/ B( j; |  M. F) V" X" Y! [/ P
  33. #include <linux/mm.h>( L0 D" Q1 I! i5 e
  34. #include <linux/dma-mapping.h>
    . A" I3 j/ c- U* o

  35. 9 E/ t4 K2 i! H5 t) z
  36. #include <mach/memory.h>
    8 }& E+ x# w3 S5 E9 }/ d+ p
  37. #include <mach/hardware.h>
    / T' R: G# o9 z0 \0 Q0 H" O( x  a
  38. #include <mach/irqs.h>
    % X1 u: {5 [0 ]+ R/ g& w
  39. #include <asm/hardware/edma.h>. ~% h* b: ], }8 y

  40. 4 T0 A5 x" F% I0 R& S( ^
  41. #undef EDMA3_DEBUG! L' f( L- f. v7 p& H7 T4 L* A
  42. /*#define EDMA3_DEBUG*/
    1 P, G& \, S9 s" c6 e& s, \
  43. - J8 q8 z/ E5 _+ v: w
  44. #ifdef EDMA3_DEBUG
    & p% B5 y5 [- M% L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 ?3 n; ?. U1 ]; {- `* I5 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 F8 y- m" x) q- t; H. e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - F1 `* z7 V# J/ g. ~* X+ z4 N
  48. #else2 `. w) i& W. C! ~
  49. #define DMA_PRINTK( x... )
    + ?: X6 G! X( y  b; H
  50. #define DMA_FN_IN
    4 u( O7 v% A9 `( t% L5 K9 Q
  51. #define DMA_FN_OUT( T6 L% \, f2 C' N  Y
  52. #endif
    , a7 i" I- L2 e1 O6 l: j: p

  53. ; r3 m/ z& \* P( w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % i( ^2 a9 X* |- |; o' _' _! {
  55. #define STATIC_SHIFT                37 g' V$ P" ]7 t& b  P
  56. #define TCINTEN_SHIFT               20
    6 H1 }8 j" r( ?) \' I2 C0 r; Q/ @9 u
  57. #define ITCINTEN_SHIFT              214 t( y$ T0 u7 S# ^# F+ `' o
  58. #define TCCHEN_SHIFT                22: I1 Z' F" k# g! K" }
  59. #define ITCCHEN_SHIFT               23
    ! c/ a/ W8 P2 r; k; y2 |
  60. # x) D! l% q, d  \' [
  61. static volatile int irqraised1 = 0;, R, V" H' t( h- f" l
  62. static volatile int irqraised2 = 0;7 y4 r3 J, r" j6 u- K" E
  63. 5 b/ z: i  B: N  [' \- {! v% @. w% f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( C* s/ e7 y& V5 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ s" a4 I) x; y; b+ b) y7 S" w- F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 c4 k; H% I4 |

  67. 2 j- f3 w5 Z  B9 J, a+ A
  68. dma_addr_t dmaphyssrc1 = 0;
    & Y# A$ R7 h. q$ C
  69. dma_addr_t dmaphyssrc2 = 0;1 J9 ^' h1 A1 r( z/ T, @1 y
  70. dma_addr_t dmaphysdest1 = 0;; ]1 _) _, ?; h' f: i! p7 D
  71. dma_addr_t dmaphysdest2 = 0;! M- l7 m- m6 v' a

  72. % @4 Z# z. Q6 z: ]1 L' S
  73. char *dmabufsrc1 = NULL;
    6 L2 z9 |' M9 @; b2 k# w; L
  74. char *dmabufsrc2 = NULL;
      }2 R- _! B2 }# c4 ~! u8 ^- j
  75. char *dmabufdest1 = NULL;
    2 g3 N2 p0 f: p
  76. char *dmabufdest2 = NULL;- c: f6 L' F  l, {

  77. / R' t) b& D6 Z$ |
  78. static int acnt = 512;
    " }6 @% E1 @9 _# d# q
  79. static int bcnt = 8;
    . _6 M+ n6 [  H+ E) l
  80. static int ccnt = 8;
    5 f( k' X7 _2 u+ k9 c/ Z
  81. + x7 Y, g; B' G1 V1 v. ]/ @
  82. module_param(acnt, int, S_IRUGO);
    " K6 m& ]; h1 Q& ~% e
  83. module_param(bcnt, int, S_IRUGO);
    8 l% u3 @+ V* `  ^4 q/ Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 t0 }9 U: o. m$ S

0 ^7 s* L2 m6 H2 x( ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* D  g4 R+ N; T6 M8 ]( @
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& b1 ?7 s0 `; R3 {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 s+ I2 v3 S6 }" u

) L  }, h% `& L! E
( c( @8 B* v. W) z; O- `# v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-1 21:49 , Processed in 0.038472 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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