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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; R5 v( Z* V0 j) z! u; a
  1. [code]EDMA sample test application: T+ U( E3 w8 H9 Q3 y2 B
  2. /*4 Z& M: V4 ~/ H& H) F: C  \7 n
  3. * edma_test.c
    " E0 {8 }8 Q; a
  4. *
    - t) I  l: B7 S$ D( n$ S
  5. * brief  EDMA3 Test Application% u. I$ d( y* l0 r' k  J7 V- s
  6. *
    ( M% M, z4 ?; n/ C
  7. *   This file contains EDMA3 Test code.
    2 f/ p" I9 K- g0 j
  8. *: D" h+ E6 N& o/ b" E: A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " r8 R3 @6 U  f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # U. b3 _' d- F3 A! T
  11. *         TO CHANGE.
    7 h% w9 d, N  _: T! Z, Z
  12. *7 u/ G+ S8 ], y) C! x  O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 o3 o6 K+ U( y1 e' g, M4 K% F
  14. *& F4 p0 T4 d5 @0 G* F
  15. * This program is free software; you can redistribute it and/or4 B9 i$ E% c% h: d! o0 Z, F
  16. * modify it under the terms of the GNU General Public License as
    ) ]! D$ b5 ~7 V
  17. * published by the Free Software Foundation version 2.6 R- I* q1 A# ~7 {' l
  18. *9 g) s) G0 n+ [" O- A8 N& t1 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 y0 \5 ~3 h( @  I2 {
  20. * kind, whether express or implied; without even the implied warranty3 v4 x! m7 j5 b5 ]2 }. @' K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 U5 v. J4 }$ p+ u, ^
  22. * GNU General Public License for more details.
    3 y6 [. {7 R" T- p" y1 F2 D
  23. */
    . U! U, N2 V# V; ~8 ~2 _  {6 n

  24. $ L9 P& h1 [4 m% i/ t5 p! d; d
  25. #include <linux/module.h>
    ; G# \$ c3 T' J9 a2 M0 R
  26. #include <linux/init.h>9 E: N# o4 B1 T" R( y
  27. #include <linux/errno.h>
    & r2 }3 Q4 d! m3 g! B2 n* R
  28. #include <linux/types.h>; F! Q- o% `, \8 U8 g5 \" e
  29. #include <linux/interrupt.h>
    , I' F. J# p4 S4 Q: q: B. T3 t
  30. #include <asm/io.h>
    , Q1 N5 w/ u% [5 n2 n
  31. #include <linux/moduleparam.h>* V& E: d6 v6 f
  32. #include <linux/sysctl.h>: d$ m  }8 w! U  l" e/ c
  33. #include <linux/mm.h>- B& V9 ?" `3 W- z3 ~) C4 K6 W' l4 n
  34. #include <linux/dma-mapping.h>
    , `+ H: b3 f1 X( D
  35. - O, o) f! h" \- Q, M
  36. #include <mach/memory.h>! ?9 v. l* g# b  @. {' @: H
  37. #include <mach/hardware.h>
    / x& q" L2 t. ]
  38. #include <mach/irqs.h>) [. Y6 X# V/ o1 s# `
  39. #include <asm/hardware/edma.h>, ~! j+ C; @9 a; H) O; f. y

  40. ' ?2 J0 t6 y1 c% V9 N7 N! x) m
  41. #undef EDMA3_DEBUG
    ' d+ N1 l* u+ v2 w3 C
  42. /*#define EDMA3_DEBUG*/
    + _: J2 q3 o; c

  43. 6 [1 I, _8 }1 |0 |. ~& j1 ?
  44. #ifdef EDMA3_DEBUG
    # Q9 g% V. P/ M! K  J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - R( p4 \: [$ _* U: T; d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): t% S) }* L! m% w6 H1 u0 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 n: c9 n3 D: P0 r
  48. #else
    1 c8 \3 o( H) P
  49. #define DMA_PRINTK( x... )- ~7 X# M9 I) d# N7 D
  50. #define DMA_FN_IN
    1 |0 U5 j9 b, _+ n: ~  z8 ]
  51. #define DMA_FN_OUT
    - r5 K* N: q) ^' t$ c9 r! y
  52. #endif
    1 Y0 S1 m" X0 s, V7 |& G3 E. |* W
  53. ) Z) Y: x4 i& p- w( C3 M7 Q# |4 N* l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) X3 ?, }: E& O& q& r4 q
  55. #define STATIC_SHIFT                3
    ' r7 x  H3 g1 c6 S  T
  56. #define TCINTEN_SHIFT               20
    9 m: K' k3 X! Y/ ]: Q1 L1 h6 v
  57. #define ITCINTEN_SHIFT              21
    ) f* Q+ _: t. s  A* Q" b
  58. #define TCCHEN_SHIFT                22" C7 `, P' \: F- u- W  I
  59. #define ITCCHEN_SHIFT               23) [, D2 k' C# b
  60. : y1 Q5 P$ ?" ~+ m3 c
  61. static volatile int irqraised1 = 0;& g1 ~9 `1 h/ Z6 ]
  62. static volatile int irqraised2 = 0;" }' R2 C7 D- D" `1 n  [
  63. : l( X$ E( N; u% o( T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ~' ~  ~# H$ E7 w- J6 \0 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - F* R: e6 ^/ H0 y2 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 D& s6 m) r5 @

  67. * Y  Q# x* A6 u; P. l# G3 X
  68. dma_addr_t dmaphyssrc1 = 0;" p5 R9 C& Y0 ?) {
  69. dma_addr_t dmaphyssrc2 = 0;3 o) ~8 c; `$ S/ A% b; S: H" F+ z
  70. dma_addr_t dmaphysdest1 = 0;
    / f% m1 P+ {. f. B! Y. F0 W: x
  71. dma_addr_t dmaphysdest2 = 0;
    * {, c4 h; F4 Y  T% ~  ~1 S$ B0 l
  72. . D$ P" S8 T8 @& ?
  73. char *dmabufsrc1 = NULL;
    4 }) U& o7 V: o1 p9 q
  74. char *dmabufsrc2 = NULL;9 t7 U% s# F5 ?) l
  75. char *dmabufdest1 = NULL;- }$ f* B! n& p4 X$ C& d5 K
  76. char *dmabufdest2 = NULL;2 R7 [# y( z. W+ ?7 V

  77. 1 g" X0 N3 S* T/ w  v; R
  78. static int acnt = 512;6 {* k% O# q- b( x( m
  79. static int bcnt = 8;
    - X* a5 m5 J- w5 h$ X/ {# S+ W
  80. static int ccnt = 8;
    / |0 X3 g- n/ N

  81. : R* w9 F# }; b0 z/ C
  82. module_param(acnt, int, S_IRUGO);
    3 V) G& m! u& d8 \8 \
  83. module_param(bcnt, int, S_IRUGO);
    , ^3 H# ^4 Q% U* o3 g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 p9 q9 Q# y. ?" G& u
# Q3 G; n) a' Q  s" k/ @6 k% ^" Z; E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- r; Q! a) M. {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 C' W: y  Q3 a7 e5 ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ R5 v9 Y6 O+ p: L2 [9 ^0 B/ z% n
" \/ @; Q3 f+ R, _+ Q- M+ V) t

, |: F7 w9 w9 x/ Y: g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-24 18:08 , Processed in 0.039523 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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