OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( U3 H6 m. a9 ^- `% F/ p) }
  1. [code]EDMA sample test application7 l4 ^* a* q8 B. }/ f0 T2 }( c
  2. /*
    # G) e5 _0 Z8 _4 ?9 g. v4 }9 g
  3. * edma_test.c
    4 s: t7 c  y- X9 m7 e! [0 z- m4 C7 _
  4. *
    3 n# T# I: v+ j
  5. * brief  EDMA3 Test Application! m: a) T& c+ ^0 J0 k- K) g
  6. *
    5 g5 }) Y2 w/ a. h7 l
  7. *   This file contains EDMA3 Test code.* P) O. ?8 g$ }7 ^3 \" s- h! r
  8. *
    4 g+ k' |' n" W" f! i1 K) s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 }, z5 \0 }3 Z; Y, I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * w  k, J$ n* p* I3 v( B- l7 B9 E& V# {/ A
  11. *         TO CHANGE.6 B, A' i* i: G1 ?
  12. *
    & m% a8 N& b2 w0 v% N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + P  z1 ~2 ^' B5 `6 d& m
  14. *. S4 R; Q' k4 P- A
  15. * This program is free software; you can redistribute it and/or
    * g4 ~" u5 W/ Q$ h- X, L& K  o
  16. * modify it under the terms of the GNU General Public License as
    9 G: Q0 ~- |  K( p) _) R
  17. * published by the Free Software Foundation version 2.
    3 ~/ M+ d( l+ g, |
  18. *# V7 m3 H' R* `  B- P) N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / e  N" C* c1 y7 t$ |
  20. * kind, whether express or implied; without even the implied warranty
    4 O2 f# Q1 }1 m6 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # @. I9 b( Q  I
  22. * GNU General Public License for more details.( `& h6 S/ U# Y$ @, M7 \! w
  23. */
    * F# d  K% m2 W, A' w7 o

  24. % k2 {) ]( C. F/ L+ s' T" P
  25. #include <linux/module.h>
    ( i. v4 Z, u- S% P& v
  26. #include <linux/init.h>1 G2 Y$ k3 J* m4 H- E2 w4 a0 b( x
  27. #include <linux/errno.h>
    # v& x6 H! K( W; p. K
  28. #include <linux/types.h>. n" T6 `5 e8 x/ ?+ E- t  R) \& f
  29. #include <linux/interrupt.h>6 D  ?' Y* x0 k2 w+ q' K+ ]
  30. #include <asm/io.h>
    ; R2 d0 x  m0 r
  31. #include <linux/moduleparam.h>( x0 {; `9 H2 R& C
  32. #include <linux/sysctl.h>1 Y# [# l' Y2 u  @8 w) @
  33. #include <linux/mm.h>2 x( B( ?. ~- K8 z. l
  34. #include <linux/dma-mapping.h>
    & r  A& {* C9 \; _  u

  35. ' R* [4 L6 i5 c; r) C
  36. #include <mach/memory.h>. ^6 [: [% L9 O; V( o7 \9 i
  37. #include <mach/hardware.h>% g6 X) M: O1 C7 C7 |% l
  38. #include <mach/irqs.h>/ @- P; B1 h2 u5 J2 s
  39. #include <asm/hardware/edma.h>2 N- P& _! F% J$ ^/ h/ L

  40. % u! ?4 |  d/ G- E/ x
  41. #undef EDMA3_DEBUG2 ^+ m; W# i1 t# \
  42. /*#define EDMA3_DEBUG*/
    1 _+ [+ M" f. a' _
  43. * P2 S* R& O( a
  44. #ifdef EDMA3_DEBUG1 Q) ]% `# t+ l9 G- \/ Q6 ]2 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) l% P& Q+ c0 ]( a4 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - q7 A; l# [0 `, x1 z3 ?% f# U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 [) _) T8 d' f" m8 k0 r
  48. #else, a5 S( ^8 {, L/ J! F" ?
  49. #define DMA_PRINTK( x... )! V$ x' G+ E5 L& ]
  50. #define DMA_FN_IN. S2 ]. X, r% P3 @
  51. #define DMA_FN_OUT
    9 o( o0 V( }4 t( C: w4 U
  52. #endif
    4 b  x5 g& w. C# U' ~: N2 A2 Q
  53. 2 T. W$ W. Z" M5 b4 S; z" q, z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( `# Z; P. x4 }; _) E
  55. #define STATIC_SHIFT                3- A: i" K6 ]) P& I2 ~% h
  56. #define TCINTEN_SHIFT               202 e' u/ D8 q( H: O4 ?
  57. #define ITCINTEN_SHIFT              21: I+ x7 O0 @0 i" T- T6 j( Z: C! o
  58. #define TCCHEN_SHIFT                229 t1 N7 t$ z5 X4 z, y: P; `+ J
  59. #define ITCCHEN_SHIFT               23
    . O; y$ F  c! @& f7 b2 l# s9 h
  60. ' s' x% Q$ w7 B1 S- _- I: L
  61. static volatile int irqraised1 = 0;
    / `  Q: u/ w- C" Q: [
  62. static volatile int irqraised2 = 0;& ~; {; T) ^! {" V7 j$ @

  63. 0 Y2 l+ d$ m# G4 k/ e! h5 F4 i" J# g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # }9 q9 ~: [) w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 [3 {% T# h9 s2 D- k' y) z- W4 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( p" k# e- S' S' D

  67. $ l+ L  L/ O9 x3 U/ g9 Y3 E
  68. dma_addr_t dmaphyssrc1 = 0;
    8 r/ A4 e5 \/ \1 b; }
  69. dma_addr_t dmaphyssrc2 = 0;# \2 T2 H" _, y7 Q/ s- A; o+ x% g
  70. dma_addr_t dmaphysdest1 = 0;
    + M6 W! t9 B# K$ t4 U
  71. dma_addr_t dmaphysdest2 = 0;! R" G, y$ B1 l" ]' \- m& I' Z

  72. . g, m. s' o5 x9 @& _  x1 K1 N0 D+ T
  73. char *dmabufsrc1 = NULL;
    % X3 t! K2 _8 @7 U. D
  74. char *dmabufsrc2 = NULL;
    7 }. q; [0 @" T% w6 N* U" X. y
  75. char *dmabufdest1 = NULL;
    ' U( ]" g7 s' N7 d: t
  76. char *dmabufdest2 = NULL;5 ^* v( L# `8 v! F9 T% E  Q( r+ X6 Y
  77. & Y! N# I! K* D( b8 ^, E
  78. static int acnt = 512;' Q" X, C: ]" I  `4 p
  79. static int bcnt = 8;
      T: L! l4 q* E
  80. static int ccnt = 8;! c) I7 n, ]; ~

  81. 2 b8 Z# \4 D: H: I- S2 c
  82. module_param(acnt, int, S_IRUGO);
    4 N4 \# h2 y+ g0 I, n- E5 P
  83. module_param(bcnt, int, S_IRUGO);
    7 o; ]" b1 {/ Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 V3 J- b1 b+ |8 @

5 o- I) J9 s1 v  ~# p0 C% e1 v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 P# W# W7 J! e# B$ R/ Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; ]& \) n, Y! G; ^9 p* f# y$ Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 ^0 }- d& N" \# f/ x$ y, q

3 J* u5 d0 \  X5 |
9 X! `1 m" z) t9 x# c) @# k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-7-5 09:45 , Processed in 0.039994 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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