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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # G% ~' ~/ M1 |& X* Z3 n
  1. [code]EDMA sample test application, U5 a" H! B% Q' F+ g
  2. /*, b2 X, \2 c8 `
  3. * edma_test.c8 i% S% d3 `& }
  4. *: s- t# c* C  t; O! H# t
  5. * brief  EDMA3 Test Application
    + l4 ?* Y; V: X$ l
  6. *9 s, _; b; E. {& m& t$ o( d
  7. *   This file contains EDMA3 Test code.
    $ X0 [" p, ^+ Z
  8. *
    0 [8 W# n; _' b2 i+ `: g( ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  i+ P5 E& x) L; O- s$ P1 Y4 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- n' v" C( B# ]
  11. *         TO CHANGE.
    - w; K- J8 g7 S" C3 O
  12. *
    # N6 y$ N3 |: I& k* M% d& F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( W) h  X) j/ w( p" `/ z9 |! }
  14. *5 W: A5 j1 e  A2 p5 c( U" Q
  15. * This program is free software; you can redistribute it and/or# j% C7 s! a0 g) R5 B3 Q6 F
  16. * modify it under the terms of the GNU General Public License as
    3 O7 L( m& t! ]1 g7 R( r- `* K
  17. * published by the Free Software Foundation version 2.
    ; D8 c! ]5 b# B  w  u
  18. *
    ; H* L2 D% Q1 n! q) ^, k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 [9 h+ `3 x( h2 S' A
  20. * kind, whether express or implied; without even the implied warranty) T8 y: ^) h0 i6 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 ]" p; L. M' y  e' i3 i
  22. * GNU General Public License for more details.4 E* g7 ^! h9 h4 e% O2 q+ ^
  23. */
    & L- x+ y  E5 r- q

  24. & d( @9 e6 E. |
  25. #include <linux/module.h>% E: @4 A, D* \
  26. #include <linux/init.h>
    - B  u. P5 ]- B; c6 N, a; H  ^
  27. #include <linux/errno.h>
    9 a% C  ]; i5 f7 o, c- ?' A
  28. #include <linux/types.h>
    $ |# P* J3 }/ I3 x5 A1 A  M1 x
  29. #include <linux/interrupt.h>
    0 C# g5 T  i9 M/ g2 r$ Y# a
  30. #include <asm/io.h>! d, _& n1 v9 C- u3 A5 L
  31. #include <linux/moduleparam.h>( C. Q2 @) }) }# K# L' x
  32. #include <linux/sysctl.h>
    ) u: Z' G0 U- O
  33. #include <linux/mm.h>8 {8 v: E* C/ W+ v
  34. #include <linux/dma-mapping.h>: F/ T1 G! q0 r
  35. 0 j- U$ e+ e8 p1 R
  36. #include <mach/memory.h>
    . W, N2 q+ @. C
  37. #include <mach/hardware.h>
    3 a. Y: e. R3 k2 v
  38. #include <mach/irqs.h>
    1 n& _* ]6 p5 Z) c% p! V! h
  39. #include <asm/hardware/edma.h>. D; O( @- ?9 Q) V. }. @- ]% T

  40. : r% H3 H$ w& G( l& [
  41. #undef EDMA3_DEBUG& L9 E* O3 D5 Y
  42. /*#define EDMA3_DEBUG*/: \) l9 S. |6 u5 N& ]3 N8 R2 e
  43. * U5 |8 p, ~4 I% z
  44. #ifdef EDMA3_DEBUG
    # q9 e& Q' h7 J- [: G* a0 |4 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 m( r2 H- l4 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) \( I9 m0 B+ m7 y7 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      N+ n) n$ E! Z  N  V- E8 P$ j
  48. #else3 C7 l5 p# P% h4 z/ J
  49. #define DMA_PRINTK( x... ), K( f; Y' |5 ^# f; Y" H3 K( a6 T/ H
  50. #define DMA_FN_IN7 i7 u& x: S" n7 i6 E( W4 X
  51. #define DMA_FN_OUT
    ' z6 c4 Y1 A: t3 V8 }! f. T
  52. #endif! N" _' V7 v2 B! r9 q6 L. j5 C
  53. * v7 o. w! P0 ^1 k/ l6 K& p0 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# P! L1 ~0 D  E
  55. #define STATIC_SHIFT                3) _9 o# ~2 a& [' T0 X- i( H: A  Z! D
  56. #define TCINTEN_SHIFT               20. e$ c/ h6 u, o% X5 I! I$ G% w% R$ D
  57. #define ITCINTEN_SHIFT              21
    4 d' G; ^8 X8 o2 _, |
  58. #define TCCHEN_SHIFT                22' a: c* X( {  b. g
  59. #define ITCCHEN_SHIFT               23
    - g  Z# F' r, }8 v/ u

  60. 2 V4 ?1 S! G- M: K1 ~! V, b) u
  61. static volatile int irqraised1 = 0;5 }6 R9 N; I' d1 T8 G
  62. static volatile int irqraised2 = 0;
    * g. U+ F/ x5 L, B

  63. 6 ]" v4 Y4 x" E  a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 Q4 W5 Z  n2 i9 ~) F( q0 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - e( D/ z% b7 {7 ]" [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 n# F2 l0 r. b9 q; @. \: x2 n
  67. - p' B: Q( L6 r# }8 M
  68. dma_addr_t dmaphyssrc1 = 0;0 O2 J) N/ R1 v. a+ q5 l
  69. dma_addr_t dmaphyssrc2 = 0;
    # c6 x5 a' ~  `* e; m( L- _, @  j7 z
  70. dma_addr_t dmaphysdest1 = 0;
    / r# A8 ]8 ~- _! w1 r. M. @4 \
  71. dma_addr_t dmaphysdest2 = 0;/ K' _0 F0 J* t9 M, X

  72. ! v5 [( ]! f. V% C5 V3 d: _1 \
  73. char *dmabufsrc1 = NULL;6 b7 Z9 p8 Y! C, {+ n: l
  74. char *dmabufsrc2 = NULL;
    5 L9 `: K; x) a. T* w
  75. char *dmabufdest1 = NULL;
    7 A: G. [; ?" x- s, j$ x* {1 k
  76. char *dmabufdest2 = NULL;
    ' x# T5 y9 t  V1 z8 V+ |( _
  77. * x  m  c& w, y3 x) i
  78. static int acnt = 512;
    ( M8 n6 \/ z9 c
  79. static int bcnt = 8;
    9 Q7 _% M/ f' u0 [/ G! Y" P; q5 F
  80. static int ccnt = 8;' K( C# B- X) C! @. ?8 j6 p) G

  81. * ^  h' r5 I* b2 o1 x
  82. module_param(acnt, int, S_IRUGO);
    3 |( I2 }( \8 r: I" F
  83. module_param(bcnt, int, S_IRUGO);
    2 W- j5 m' _: p& `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 P8 [7 V9 B+ H' e7 P$ ^( d9 z7 P+ j3 B& F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 D# j: @8 P0 I3 \+ l6 ~! {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 O' Q# U( d  @$ p6 E+ O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! z6 H7 ]1 D1 ~+ \' r1 P6 P. j1 e# j. Z

* t' y4 S9 }& q' `9 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 19:04 , Processed in 0.039363 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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