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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % _' L6 a; d! T' J' U. [
  1. [code]EDMA sample test application
    & J, @0 s5 C( }  Q; l
  2. /*! I, c% c8 l5 E3 @) Z
  3. * edma_test.c' q& F. A+ T% U
  4. *# \) r2 v; t' }7 a1 Z! W0 ?
  5. * brief  EDMA3 Test Application
    ' n+ I7 H% W; N8 ]1 B4 ?3 H
  6. *; Y/ @! L+ X$ j( T9 v  t, T0 W
  7. *   This file contains EDMA3 Test code.5 T, {# a5 N- q3 B1 _# K) M+ s( N
  8. *
    4 [+ c3 u% N* P) B6 V( y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 s: }5 i& E3 c; S, J1 ]; x; M$ j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: w  \$ w. Z% B! ~& N" c8 S# ^
  11. *         TO CHANGE.
    . M+ o# r+ W: X3 a2 U$ U
  12. *: Y7 z# b+ t+ f; j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 a6 g/ U) P( h' I6 Z
  14. *. h5 W+ D8 d( n& O
  15. * This program is free software; you can redistribute it and/or
    & @4 D- J1 n: F# h
  16. * modify it under the terms of the GNU General Public License as7 s. v1 q/ z: u* Z' j' ]; _( g9 j
  17. * published by the Free Software Foundation version 2.' e) V+ e4 w. U1 l
  18. *
    + H, ^( N; j! l0 v- ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , t5 j4 ~& x7 Y) J2 l
  20. * kind, whether express or implied; without even the implied warranty
    , f; ^. z9 H) h& I$ I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 V4 N' I) x, n2 H; ?2 S& Y/ S5 G
  22. * GNU General Public License for more details.6 ]& e5 Y: n) I" i5 _
  23. */
    ) j7 i* s0 f. t3 P) d9 Q: b& ?$ z

  24.   X) \) Z$ G- e/ e: X$ a5 s
  25. #include <linux/module.h>7 N1 U, \# J4 b  `
  26. #include <linux/init.h>
    , ~$ J6 s( ?" f: P! E0 Z
  27. #include <linux/errno.h>
    + n1 V: H- R, H! ~+ V! f4 F$ s* Q
  28. #include <linux/types.h>9 ~! v; y0 l( X# G5 p: o( _
  29. #include <linux/interrupt.h>& C# L" J* D. j5 R& e
  30. #include <asm/io.h>6 j! C3 X8 q' i/ Q0 d  i' F
  31. #include <linux/moduleparam.h>
    ( \2 m( C( Q4 J- J3 m
  32. #include <linux/sysctl.h>
    ) o2 X' q$ j* k
  33. #include <linux/mm.h>
    4 z: Y- E; {8 v9 R" s6 R  c6 P% B
  34. #include <linux/dma-mapping.h>
    2 l2 ^: v" M2 A& f9 s

  35. $ x; O2 x+ o. o! j' o8 Q. \
  36. #include <mach/memory.h>
    , M* I6 s9 p1 b5 n
  37. #include <mach/hardware.h>( L1 J( L2 m' p( p
  38. #include <mach/irqs.h>
    : |! y+ H- D# ?8 b0 t# y; @; @
  39. #include <asm/hardware/edma.h>
    ( ~  L+ G7 Z) W6 M1 b  M  G$ @- M3 I
  40.   n8 x! R+ D$ n) [2 h5 b7 ?
  41. #undef EDMA3_DEBUG
    ) T5 R0 n+ B9 v' q) v
  42. /*#define EDMA3_DEBUG*/. a" f0 ]5 W2 R; T3 g' j$ g
  43. ; E2 m& n+ v+ J$ h- j% P, G1 }
  44. #ifdef EDMA3_DEBUG
    3 `# ?# t2 x% R: W" g. d4 ]% W4 d+ Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 J* r: @9 f" g" Y  ~3 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% ?$ \1 m- r$ E, V! q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), \% _1 o$ {7 Y! H: L+ A4 Q+ I
  48. #else
    : J0 y) f; R4 S+ e$ M' g: \; ]; C
  49. #define DMA_PRINTK( x... )7 s3 E  P; R! u' i" k$ `7 s' O+ ^
  50. #define DMA_FN_IN
    * n" l. b) j8 t2 [
  51. #define DMA_FN_OUT
    9 v, d' O. r. G  J8 \) p( `& g+ m# i
  52. #endif5 @# S! T: j8 L. j& |+ p9 t" h- ?

  53.   {: k+ I- Q; T6 i7 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ X/ f  b" p) i  _% F9 F
  55. #define STATIC_SHIFT                3, a7 \. z4 C/ B( g0 w0 x5 |0 `
  56. #define TCINTEN_SHIFT               20" p% |0 t: [* @9 b! }4 y) H7 C& D
  57. #define ITCINTEN_SHIFT              21
    0 a# Z4 @5 x5 J
  58. #define TCCHEN_SHIFT                226 P% Z+ a$ a8 m. B+ i7 {
  59. #define ITCCHEN_SHIFT               23
    / c5 a- ^0 Z1 ?  ?8 x3 K

  60. * A/ d* l# w) C
  61. static volatile int irqraised1 = 0;
    6 L% K& X5 A) d5 m3 e6 r2 B3 L; ~
  62. static volatile int irqraised2 = 0;
    7 s, f9 v$ s2 Y9 U0 C) K
  63. 2 K7 d' M% ^( D; W0 u  p  a, C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % q6 d/ y! C9 m7 [( r$ D& I6 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * w4 ]& C# |3 ~5 A' ]3 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; [# K* l5 m$ @# }% R
  67. / c1 O3 e+ b8 F/ a# h
  68. dma_addr_t dmaphyssrc1 = 0;
    & B( Y5 O/ J- ^, t+ r9 h( {6 S2 z
  69. dma_addr_t dmaphyssrc2 = 0;
    ! I. M, X0 g, E$ Y5 h' j
  70. dma_addr_t dmaphysdest1 = 0;7 l  `- O* ^9 X3 U) Z2 f
  71. dma_addr_t dmaphysdest2 = 0;
    / z+ y6 [! k0 y9 K: d* W

  72. 5 q# Q5 a5 R6 O- @0 q
  73. char *dmabufsrc1 = NULL;
    ; _0 B0 w: ]: |2 V0 e* T! d
  74. char *dmabufsrc2 = NULL;
    $ M% p, V" J8 N, P; X
  75. char *dmabufdest1 = NULL;
    4 w' F5 t2 F- s- u% S4 _
  76. char *dmabufdest2 = NULL;
      \  ]3 t; Q3 c! P$ D* q5 g" d

  77. 7 _. z2 N  @7 Z, Z: n* ~
  78. static int acnt = 512;
    8 B# u9 B1 Z; e& F/ p# c# [3 l2 w
  79. static int bcnt = 8;
    6 Y: K. W/ C) {; k
  80. static int ccnt = 8;4 o$ A! ~- b$ Y1 o; n

  81. * E% O) b+ I' s8 P& \) `. l
  82. module_param(acnt, int, S_IRUGO);" {& `6 P+ L5 J8 K0 N
  83. module_param(bcnt, int, S_IRUGO);
    , z0 H, f+ m& {, d% R9 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 [. d9 j6 k! Y6 r( p& Z# s

3 k9 w+ G9 |  P' }* k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) ^, M  [. T* ^+ v+ `( y/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ C# @, f7 U* K) ^7 f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 x* U1 M- Z8 d$ b! |
2 V3 X2 s6 R0 {
! e( W: e& q. _- k7 p% Q7 T, m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 22:28 , Processed in 0.040680 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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