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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 X+ w2 k7 x8 U) \
  1. [code]EDMA sample test application
    3 s" E8 L9 n$ _2 j# u  ^0 T7 |
  2. /*
    ' s( `: c+ r- {( `+ L5 g
  3. * edma_test.c: V1 g- o) o3 W3 S7 l
  4. *
    6 V' T2 ~5 P; r7 g
  5. * brief  EDMA3 Test Application
    $ R8 b" N" b- M: y
  6. *: U2 U2 a' D5 G4 |5 G/ K) h
  7. *   This file contains EDMA3 Test code.- I/ L9 B" o& ?3 g
  8. *
      p8 j7 ?/ h8 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 M) I, Y! Y8 O& {. l( o! j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' B- @4 G: g7 h; o( ?0 o
  11. *         TO CHANGE.
    * B% B- `; o! @3 M# @1 u. K4 q4 R
  12. *
    ! S: X' O8 }) K6 D% f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 z6 ?0 h" A# g4 V' E, p
  14. *& f6 w2 B! _! V% O
  15. * This program is free software; you can redistribute it and/or# o8 f& G, \) N
  16. * modify it under the terms of the GNU General Public License as" |1 ^6 }4 V( T( T; T7 k0 L/ V
  17. * published by the Free Software Foundation version 2.
      Z9 `. _6 Y8 G* n8 H
  18. *% j9 H5 R9 o  b. C9 p  b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 G  l# _) V  G: K" b
  20. * kind, whether express or implied; without even the implied warranty; Y) d! m; G: G) S0 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 E" @6 J1 N( W% G+ u
  22. * GNU General Public License for more details.
      L- _5 d* f" }+ S
  23. */, k9 Z/ t1 J) b* I" s6 j

  24. - Z* b  c8 L- b& P
  25. #include <linux/module.h>
    ' l4 K" z- I9 `6 B/ c
  26. #include <linux/init.h>
    4 B% r7 Y$ l" Z
  27. #include <linux/errno.h>9 o) f2 h: I( O% y3 y) g. n: f( I& V
  28. #include <linux/types.h>
    ( ?1 n/ o/ I/ }- K. Y) x
  29. #include <linux/interrupt.h>
    1 t! o$ w' Y3 m) S) [6 c6 b+ {% k; E8 [
  30. #include <asm/io.h>9 N$ V/ l4 T, S2 G% o
  31. #include <linux/moduleparam.h>
    ; R0 `" `- a3 w2 a/ v( N# Z
  32. #include <linux/sysctl.h>& v4 U" B% @* [) j! w
  33. #include <linux/mm.h>& q- m1 Q1 G0 d3 t0 o
  34. #include <linux/dma-mapping.h>
    ) z9 S3 ~' |- o, V  s. q
  35. + c+ B" x, _# y) B  \; P
  36. #include <mach/memory.h>% g5 e* ^4 b) t( S
  37. #include <mach/hardware.h>
    5 C, F% H4 _$ K( `
  38. #include <mach/irqs.h>% o* ?& T7 n/ m/ B' f& j
  39. #include <asm/hardware/edma.h>, V$ f- E/ R2 g0 k

  40. / i- I* G' m8 X( [
  41. #undef EDMA3_DEBUG
    3 ~) q0 R, X' f8 n/ A6 q
  42. /*#define EDMA3_DEBUG*/) q2 E+ t) @2 C! U- q$ ?: r

  43. * U" O7 A, A3 E/ J$ [
  44. #ifdef EDMA3_DEBUG& d* w8 z; |$ i0 I1 n* W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' \* W* G3 p$ {" j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 n, i+ f$ |6 W5 g* M( W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ ~! v$ d3 X4 s4 e) ?" g  ?
  48. #else' G- T9 j2 @* Z% u; l0 K& ?
  49. #define DMA_PRINTK( x... )
    # X- Q3 y. M5 ~$ I: A
  50. #define DMA_FN_IN' W6 f0 Y- u- G& C
  51. #define DMA_FN_OUT
    . `% S. F, Y( V
  52. #endif
    $ S* X8 x- K: S
  53. 6 }7 ~+ h1 ?5 F+ v  @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % |- J7 g5 W$ H7 ]7 J# g0 \
  55. #define STATIC_SHIFT                3) g4 R  l$ m! e3 a# `
  56. #define TCINTEN_SHIFT               20
    0 W" g2 _/ D$ B, K: r- e4 v+ \( V
  57. #define ITCINTEN_SHIFT              210 b( Y, d' M; b2 w0 P2 x
  58. #define TCCHEN_SHIFT                22* \5 W- d* }* P! s) i+ A; Y
  59. #define ITCCHEN_SHIFT               23
    " O% }( x3 Y2 s

  60. * q9 Z6 o' i4 d& G7 S* d
  61. static volatile int irqraised1 = 0;
    : W5 u+ w' v/ f2 J2 o8 O" Z
  62. static volatile int irqraised2 = 0;
    9 q; T% ^+ g8 \, X

  63. , X* ~% G( V; @) i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 l. r! k, o% X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; P& C6 s. d: ^9 ?" Q* L+ n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 |2 E" f  @7 S

  67. 8 o7 C- {; Q3 X4 r. N! t  @
  68. dma_addr_t dmaphyssrc1 = 0;' t9 @& N  [1 o: Q0 s* q
  69. dma_addr_t dmaphyssrc2 = 0;0 C$ Y$ z* ~+ Z6 r3 d1 O% U
  70. dma_addr_t dmaphysdest1 = 0;; c- @( z+ g, |& }
  71. dma_addr_t dmaphysdest2 = 0;
    & Q2 a+ b3 L7 p% W6 w
  72. 3 I7 C; G9 k7 a: Q- X
  73. char *dmabufsrc1 = NULL;
    ( G& R$ N  U8 `1 o) c5 w
  74. char *dmabufsrc2 = NULL;8 C5 v7 L1 u$ e. S
  75. char *dmabufdest1 = NULL;0 W8 A% K" `! c1 v8 d
  76. char *dmabufdest2 = NULL;% O+ s  h' t- b' x& a
  77. ! Y% N$ M' o. A! z7 {' \$ M
  78. static int acnt = 512;. p9 H1 ?. L& D* v( C, i
  79. static int bcnt = 8;
    $ k3 ]& C9 M% t* S; \
  80. static int ccnt = 8;
    1 i& x. h: _% K5 j+ l8 H
  81. 3 U6 R$ D* G  z1 J/ T' {
  82. module_param(acnt, int, S_IRUGO);2 X" i- g7 f: g  F
  83. module_param(bcnt, int, S_IRUGO);9 {# }9 y- Z0 V) J2 q5 R/ T' ?" q4 L+ O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" v, p. k) g6 _8 W6 M7 h8 c6 ^

; V- m# {" f3 e% ^. m+ @5 i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 `  {$ V! R3 Z, o& p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 D4 y3 m! o+ {# q6 C5 Z1 s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 @2 K% _- _" p+ H5 m* A
* Z+ K- p; f  [3 O+ J8 h( D7 h/ Q! ~4 i* ?) b5 ]9 q, n0 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-1 23:02 , Processed in 0.037395 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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