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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' H5 H. N) ?& j/ c9 c. L% z
  1. [code]EDMA sample test application
    * a8 f5 q. V2 M" M  w
  2. /*
    * |, c- j2 s) h/ v
  3. * edma_test.c
    0 d6 J# ]' e$ l8 c9 T
  4. *6 M( [: W/ C0 g9 K6 _3 S
  5. * brief  EDMA3 Test Application
    ; Q) X4 I1 R6 Y2 `
  6. *
    ' K9 J; Y. |4 g- M) l
  7. *   This file contains EDMA3 Test code.' d; O  _( G! f" B
  8. *; z* a8 w8 @' H1 C$ P) N( [4 u! c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : j  }% W: Z  O6 b, r2 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; Q: O1 m) Z( {5 A; C# t7 s
  11. *         TO CHANGE.
    ! _- _1 ?' h+ `0 c6 N8 c" ]
  12. *
    , r+ L9 o3 Y, C. C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / l; ^  a9 @8 K! ]7 s$ H1 }
  14. *
    " b$ Z) R6 O& m$ O+ ~. s. Z7 M5 ?
  15. * This program is free software; you can redistribute it and/or
    0 _+ c% x, t, T
  16. * modify it under the terms of the GNU General Public License as
    ) e% g# K3 k+ d% [
  17. * published by the Free Software Foundation version 2.+ x" U' K& |# p* `5 G8 a
  18. *
    1 y1 n5 y- \) j% H( B0 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 n$ k/ I7 s8 P: c! s, y! k
  20. * kind, whether express or implied; without even the implied warranty
    " b& I6 ?! L, C$ B' n( a) v" J' C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ o* D/ R' r* |8 i
  22. * GNU General Public License for more details.
    : ~1 e3 F- a% W2 E2 V
  23. */
    9 Z- Q4 o4 t5 p- M! `
  24. : P9 {9 I% d1 _  P% g
  25. #include <linux/module.h>
    ( C1 G6 T2 {+ Q
  26. #include <linux/init.h>
    # e+ i& K7 v; ~6 L0 M
  27. #include <linux/errno.h>6 @; J! \$ L9 l& {, j, ~
  28. #include <linux/types.h>6 ^/ g3 O. L. a  W' Y
  29. #include <linux/interrupt.h>5 b3 D$ K0 J) N
  30. #include <asm/io.h>: Z7 F5 l6 A& P5 f
  31. #include <linux/moduleparam.h>
    ! W6 P( N! P1 D; Q) n
  32. #include <linux/sysctl.h>
    : r% g) g4 a0 Q* [* \$ q$ ?
  33. #include <linux/mm.h>
    $ A  l9 l5 {5 r
  34. #include <linux/dma-mapping.h>) Z, d/ p! s3 b% l! Q3 K/ S' Y

  35. 3 R3 V5 ]1 i7 X7 M- w
  36. #include <mach/memory.h>
    % ~5 v, T' w( r9 u3 i
  37. #include <mach/hardware.h>3 |& I+ s8 {8 \7 E" O
  38. #include <mach/irqs.h>+ N5 z+ u$ M3 \: `3 ~6 `
  39. #include <asm/hardware/edma.h>- d6 A! l; \8 l3 b- ]& c" `

  40. + s2 B9 c- D0 G# j' }. H
  41. #undef EDMA3_DEBUG
    " i, Q* A3 @, d1 K3 I  ~3 Y
  42. /*#define EDMA3_DEBUG*/% H( t( i  \5 o- q) i: t' G
  43. 7 ?6 B# h& T6 T4 a8 X. c& V
  44. #ifdef EDMA3_DEBUG
    6 y1 m0 \  h7 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 W5 }! e/ _  ]! t, D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), p( z9 [( ^1 H- Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! l9 e3 k4 D4 z6 t3 M4 p. j
  48. #else
    ' p' N$ x3 j3 T3 Q* r! a
  49. #define DMA_PRINTK( x... )
    . b" Y" c! Q; e7 t
  50. #define DMA_FN_IN
    . a1 v/ q/ }, k3 I& x6 K
  51. #define DMA_FN_OUT
    3 m# w) Z- _* [+ p1 l- V. X! k
  52. #endif
    1 I! E3 H( I) T0 \2 A

  53.   x! W0 Z8 u# |& A: U/ A6 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : |- d! A" r# h, W. p  _8 V
  55. #define STATIC_SHIFT                3
    + p( u+ c4 L4 Q: L& p( G- q% s; L
  56. #define TCINTEN_SHIFT               20, S  U$ g. J5 I
  57. #define ITCINTEN_SHIFT              217 R7 a+ ]. q  g$ e2 l1 _" X+ i
  58. #define TCCHEN_SHIFT                22
    . v, f' n5 s+ T" u) Z
  59. #define ITCCHEN_SHIFT               23
    2 x5 I! F) a( u5 V& D  _7 R% x

  60. ; G3 T/ U& B% a" Y
  61. static volatile int irqraised1 = 0;
    1 ?9 o5 A6 Y# q
  62. static volatile int irqraised2 = 0;) L' B; H3 L: m3 E

  63. ' H% q. M: D6 V. y4 f" a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 E4 x/ D- c2 f8 [& a" D- _! p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) a9 E3 K9 v; f( w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * n' d, r& J( Y$ |- E7 X  E$ u
  67. 7 |- t$ ~- L* v0 [, r# @2 C9 `: K
  68. dma_addr_t dmaphyssrc1 = 0;- d( m/ Z( f  ^) w
  69. dma_addr_t dmaphyssrc2 = 0;
    : d1 M- {1 z& f# a
  70. dma_addr_t dmaphysdest1 = 0;% L% _# u2 y2 x; }. k0 X3 ?$ Q( Y
  71. dma_addr_t dmaphysdest2 = 0;
    ; ]) `& U1 a! s
  72. + b' r5 ^- ?, g/ N' q$ w
  73. char *dmabufsrc1 = NULL;
    . k! ~# M" @  L. s1 |7 |3 Y
  74. char *dmabufsrc2 = NULL;
    7 \  z; O2 T6 ]! e/ G2 d* ]. k
  75. char *dmabufdest1 = NULL;; n0 \! o5 C' |; G8 H  r
  76. char *dmabufdest2 = NULL;
    . h) S* R" `+ L3 J

  77. . a2 v, E, Z) K* ?+ `
  78. static int acnt = 512;% f5 h7 W* {4 k" u, ~. v
  79. static int bcnt = 8;0 z* z5 r) g, k
  80. static int ccnt = 8;
    ! r5 k7 V. I$ q: ?% k* j

  81. / d( X) Y  W, _- S
  82. module_param(acnt, int, S_IRUGO);
    ) v" n: J$ t+ g+ T( b9 I
  83. module_param(bcnt, int, S_IRUGO);
      m8 ?/ w- b' U- s7 n" k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 r3 ]3 V* N. @1 P
; _) w. u* _" J4 O% {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% u3 O3 [: B1 u6 X# L! y- Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 A7 O/ U. T$ ?7 e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* W( t! T" `# E8 P6 o0 j3 X: H7 m3 @3 h( `6 D$ j  @) b% D
: ?# b: Z% M% M' M( t- k7 G  P9 j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 22:25 , Processed in 0.036877 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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