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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # W- d( M' Q  V9 y, _
  1. [code]EDMA sample test application
    $ n7 q. \: |* o/ y) T
  2. /*+ N. Y! I1 G8 Z6 ~3 M
  3. * edma_test.c
    9 o: U  ^7 L# ~& Y$ E
  4. *5 f  _9 h  w1 A4 l  y
  5. * brief  EDMA3 Test Application
    . T1 e! K6 v3 {
  6. *
      I4 \$ C* q: K' g0 j( `
  7. *   This file contains EDMA3 Test code.# a- O. x, m. p( @
  8. *' o$ b3 \" I3 X+ D0 X; N" g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' b8 z, P; B8 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' W$ |; C1 R8 {* L  U; H) {
  11. *         TO CHANGE.
    ! T! L) W6 z' f
  12. *+ ~9 Y8 b; o2 M- ^' @0 m( g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + h' j/ |# `9 ?% T6 U8 v9 ]: {/ [. v
  14. *3 r0 {+ |4 t4 n! x% w' j& k; w
  15. * This program is free software; you can redistribute it and/or7 O# ]4 Q; w* E+ O
  16. * modify it under the terms of the GNU General Public License as2 {& p) [1 b: R4 b# x' ?
  17. * published by the Free Software Foundation version 2.
    3 s5 \# {* f' A. h" F' I, E
  18. *7 H4 ~- S& X3 P4 L' s- W4 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 x/ D, V: s# c. b9 k
  20. * kind, whether express or implied; without even the implied warranty7 X9 j8 Y$ O: ?' z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 f  k% y  A! D4 I9 C$ r
  22. * GNU General Public License for more details.2 Y) }" z- x6 A' R) U% l
  23. */2 x4 P; f- I. Q, q# f, z; T
  24. 5 N7 X* h4 I1 S, D
  25. #include <linux/module.h>
    , x7 Z) W% G/ n6 S( m1 I8 p
  26. #include <linux/init.h>' ]6 _  o" e, F
  27. #include <linux/errno.h>. I; F+ a! N  L) [3 Z) R
  28. #include <linux/types.h>
    ( P5 K4 _) Y) L! ?$ e
  29. #include <linux/interrupt.h>
    # T, Z0 h8 Z" n1 N( L  d) q" U
  30. #include <asm/io.h>2 d) y8 y9 o" C: g" |$ ~* G
  31. #include <linux/moduleparam.h>4 ?4 f6 M1 H8 J. G" _* A
  32. #include <linux/sysctl.h>
    8 |! ^% M# N3 `0 o9 U
  33. #include <linux/mm.h>& `+ O& x/ R, t' M! ]4 |
  34. #include <linux/dma-mapping.h>
    % _0 M, N9 H$ H6 b" _- b2 X
  35.   f9 Z7 O" [2 _
  36. #include <mach/memory.h>6 ?: M5 P: q  h& ~
  37. #include <mach/hardware.h>+ c, B8 H6 w& c3 P2 y
  38. #include <mach/irqs.h>
    6 g/ |  a% w% Z$ z8 B
  39. #include <asm/hardware/edma.h>
    ) s8 |0 `8 R# a5 Z% x& I* S+ `
  40. * \4 q$ S. I/ ~& K7 r# Q* H7 y
  41. #undef EDMA3_DEBUG
    ) o. d5 x9 @2 a0 @4 y9 |! ^5 X
  42. /*#define EDMA3_DEBUG*/
    ( `4 \' E, ]  @

  43. ! V' v6 Q5 b: G% r. c6 h3 g  G
  44. #ifdef EDMA3_DEBUG7 i0 p: \( g! b6 \. u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      n3 F$ Y" ]" q1 P7 g9 N3 i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 q9 X( q8 ?+ A% }3 `' k4 ]+ {* H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ O! ?; H4 f' ?, R; n
  48. #else: ]6 {! \# E  p/ M- Y/ L' x; l
  49. #define DMA_PRINTK( x... )
    : S+ Q' R9 V( `$ w  d! q
  50. #define DMA_FN_IN6 T/ K! X2 M/ b9 F5 j
  51. #define DMA_FN_OUT( B, W$ H1 R  }' d: W: a: u' S
  52. #endif
    # J  x9 Q4 ?4 G" k" U9 E# ^2 J
  53. 4 M# a. h6 ^; y6 @6 J: e: A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! ^) o2 e; D# n# I4 t
  55. #define STATIC_SHIFT                3
    6 L  Z) E( q% k
  56. #define TCINTEN_SHIFT               20
    / r* P1 ?. [' \& k9 R$ H% a/ S
  57. #define ITCINTEN_SHIFT              21
    ' ~  u2 c3 W% ^4 }
  58. #define TCCHEN_SHIFT                22* w8 e9 e% Z: o9 W6 @% ]' R9 ^
  59. #define ITCCHEN_SHIFT               233 h8 M5 P/ `4 ~

  60. % J1 h  A: ^4 H9 O; d5 ]
  61. static volatile int irqraised1 = 0;
    & L% {4 y' y3 C& K: H% ]
  62. static volatile int irqraised2 = 0;
    + n' y! r" t. i( R% c. }0 G  y

  63. 3 x  G. G# H# i; L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Q$ R# d$ _/ Z7 B+ ?; o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 m* P3 S2 D5 k. k3 ?) j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # w6 r( a2 v/ A) x. W

  67. + C# ?, H! F- J) `0 }6 |; V) K
  68. dma_addr_t dmaphyssrc1 = 0;
    7 K8 ^* ^! d# ]3 k) m; y% ]
  69. dma_addr_t dmaphyssrc2 = 0;0 L, V# R: a0 x5 _) {5 C) B6 i/ i! N
  70. dma_addr_t dmaphysdest1 = 0;+ I) k! B8 l% n9 w, U" a
  71. dma_addr_t dmaphysdest2 = 0;
    $ R5 x# ?/ _9 z; i  h5 p8 h

  72.   |5 }" i3 K+ c) `7 z9 i3 g" B
  73. char *dmabufsrc1 = NULL;; h& M/ C  y1 _! G- S+ a
  74. char *dmabufsrc2 = NULL;- z! @- s+ [( R5 n, T6 m( v; W
  75. char *dmabufdest1 = NULL;$ w+ y* l! n/ S+ [# o& q
  76. char *dmabufdest2 = NULL;0 p! \5 l' P1 {6 Z! ]
  77. # a  z, m  M0 x5 o; }( Z
  78. static int acnt = 512;
    * V& e1 e0 n9 S0 D
  79. static int bcnt = 8;. E4 i& J( v5 K  N
  80. static int ccnt = 8;6 U$ l& `* q; o1 u, A
  81. ' _7 t& V& F# \5 [* m
  82. module_param(acnt, int, S_IRUGO);
    5 [, o; Z1 s* V" O( t2 z9 ?# n
  83. module_param(bcnt, int, S_IRUGO);
    ( _6 S) Y, r: W6 f; Y- s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, N" Z$ G! s8 i# Z

7 v% b% K; \; `' N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 B' H' \% U6 u4 d; B
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 G3 X& z% O3 ]( u5 H6 R: r+ u7 T1 P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 j6 U4 o; q9 t6 Z
: ?, u* p9 ^; a& U7 S+ ]
) F1 f& P0 ~1 }$ h( y( o9 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-22 20:17 , Processed in 0.045464 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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