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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 v7 R/ ~% H6 i& L- m" |
  1. [code]EDMA sample test application' P# c) `$ ~  k0 x1 n& O3 q
  2. /*5 l; }- u, n$ Y& `4 l6 M$ C1 u4 [0 h$ d
  3. * edma_test.c0 k2 n  ]+ r" z3 Q: T" }4 x+ |
  4. *
    % h2 r& m: Y0 R1 Z
  5. * brief  EDMA3 Test Application- T5 P$ O( w& v( v8 h4 t+ {
  6. *( |7 j- j7 Y# z  r! L2 i, z8 I) t
  7. *   This file contains EDMA3 Test code.
    " i+ M, c4 q! i4 P, ^
  8. *
    0 B4 a7 p* M7 D. j, [9 r! n/ q0 R3 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) e* x" f+ V: j$ Z; Q9 v. |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & L# f4 N$ W/ q0 d7 z& H6 k+ }
  11. *         TO CHANGE.* D5 D* q/ w/ z+ `& X3 ?) H
  12. *
    $ v/ A- H1 a& y# F# T/ [5 c4 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 z, T. C& ]. t1 B  F$ E, h
  14. *9 V2 |, q. `! h' q# m' e" Z
  15. * This program is free software; you can redistribute it and/or
    " `; K1 ]+ N- w; y: T
  16. * modify it under the terms of the GNU General Public License as
    / P+ P. r) K' i6 Z" Q) l/ q
  17. * published by the Free Software Foundation version 2.$ h# E: T) r5 D
  18. *
    0 \2 z8 e) ?+ z$ R0 ?8 C, j( Y! L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 t) f4 s$ E0 c; g) i
  20. * kind, whether express or implied; without even the implied warranty
    ! D" P$ o( I! \; `) s2 J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : j  j$ L( V1 d2 ~# Q' g
  22. * GNU General Public License for more details.
    ! u0 t9 L6 j4 ^8 [
  23. */
    & R% E+ J" z; y8 [4 B
  24. % H/ j4 W6 I" T! {' p; ]
  25. #include <linux/module.h>5 L) ]: v' k) b  y) e# o
  26. #include <linux/init.h>
    . V/ J2 o& x; Y: }2 O: E. t
  27. #include <linux/errno.h>
    9 D/ m" O# }" T& L
  28. #include <linux/types.h>& L* \+ q4 Y  [" o# L4 Q
  29. #include <linux/interrupt.h>( P* y5 P  \6 y# U& f, V
  30. #include <asm/io.h>4 n# y3 e* X1 p1 i# Y" n% E+ r
  31. #include <linux/moduleparam.h>
      z, ]1 L7 P1 s: C9 D  c' a$ j1 H
  32. #include <linux/sysctl.h>
    " X5 t( L' h6 C' Y- Q* ?0 a3 N
  33. #include <linux/mm.h>
    * r. A0 i5 b1 v- U6 A: m
  34. #include <linux/dma-mapping.h>0 f4 s2 Y$ A$ }- v+ H4 r& f" V

  35. 2 P- h" P: u* h$ S2 X  \: v3 J- w
  36. #include <mach/memory.h>
    7 F7 U1 \) z. V: g2 P- a
  37. #include <mach/hardware.h>
    6 S4 T- ]% E+ j0 O6 [8 ^
  38. #include <mach/irqs.h>5 E% n; D+ R. P6 J2 |% A
  39. #include <asm/hardware/edma.h>. b" e5 O$ N' K1 k' n) K
  40. & w* l; T7 M# I' T
  41. #undef EDMA3_DEBUG8 V5 |# _) ~8 Z
  42. /*#define EDMA3_DEBUG*/
    2 f* ?, K! |$ u- L" m2 e* c  \
  43. 9 j. H8 a& m& C
  44. #ifdef EDMA3_DEBUG8 b- |- O) U4 `, j3 h' D! c% t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 V, E/ b/ x9 P8 N2 S6 d+ k5 {$ I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : V! j% T- T, g8 Q! A  `5 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& K$ V3 H6 k% o' S/ Z
  48. #else7 R# Z0 r3 C2 P3 Q7 P* o
  49. #define DMA_PRINTK( x... )
    . E5 V+ b1 i5 l) H8 i
  50. #define DMA_FN_IN! C2 l" p: N) L6 ~" g' b( O& @
  51. #define DMA_FN_OUT
    1 ^/ g; e; {* X8 d5 ], S
  52. #endif
    0 A* ^+ g) [2 `! O

  53. ! A) J6 L1 }+ ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 }$ {; S7 B  ?
  55. #define STATIC_SHIFT                3; }( z6 d0 `3 m- C
  56. #define TCINTEN_SHIFT               20
    ; N' j$ \) L2 y( G  Y3 Q
  57. #define ITCINTEN_SHIFT              21
    % b* E2 C9 \' L. y1 j5 x# o1 B! p, R
  58. #define TCCHEN_SHIFT                222 G( i7 o' U5 A; B
  59. #define ITCCHEN_SHIFT               23( {9 t3 y: V# `5 I* d% f% W9 j

  60. ) i/ }  t" E& ~! w
  61. static volatile int irqraised1 = 0;* I7 @) x" M9 z0 [7 T
  62. static volatile int irqraised2 = 0;
    8 S: Z# J0 r0 m8 ]1 q  t
  63. 6 D" p7 x. y0 b' C) O  Z! P# n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% K+ z0 D: _; ^4 w( A. g& T7 p0 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' A3 V; v2 l% x; _/ Z. a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 j* h& a7 Q! s9 y

  67. & Z+ H+ V& ]" f; z- m
  68. dma_addr_t dmaphyssrc1 = 0;+ N/ T4 H1 G" w; X0 g: J2 W3 t4 l- {6 b
  69. dma_addr_t dmaphyssrc2 = 0;, Y1 c0 C/ b9 \1 h5 v. F
  70. dma_addr_t dmaphysdest1 = 0;' e" W: T) l; v) w- L
  71. dma_addr_t dmaphysdest2 = 0;2 ]) c7 g2 e, N* z7 i: r

  72. 5 u" M5 g1 z, f# W! y, @8 u1 b$ ^
  73. char *dmabufsrc1 = NULL;- W% C! ?: O: k1 M6 Q) M( [
  74. char *dmabufsrc2 = NULL;
    / e; ]7 L4 j4 E" R7 A0 e
  75. char *dmabufdest1 = NULL;* M! N7 B/ `* A% s
  76. char *dmabufdest2 = NULL;4 L. `" ]$ z# z$ A- g
  77. , l9 J4 h  P7 e! a! X. i
  78. static int acnt = 512;9 O4 G$ V! j  h) ^) m$ }
  79. static int bcnt = 8;
    7 [2 o- p1 l8 C- U3 Y3 u1 s6 K9 z5 E1 ~
  80. static int ccnt = 8;5 `1 m1 D6 j) [3 [0 F
  81. 8 x+ }* ]2 w/ x- T: o
  82. module_param(acnt, int, S_IRUGO);
    8 q' |+ e$ G: e6 ^/ H8 T
  83. module_param(bcnt, int, S_IRUGO);$ X! A) l* o: W# ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! C" p% |0 h0 U6 j. x

! x. P3 Z% d) e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 e. c# m: G5 ^9 h$ e2 u4 v& z* Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 N3 F* n6 n! h5 d9 t4 Q: d0 a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 J9 \/ x! `1 O, H6 n. j
6 |. T) }7 Q$ C4 w# z7 e8 e; ~
3 Q% K* l/ s! q& U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 21:33 , Processed in 0.039621 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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