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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% _8 u, [" B) E7 q! a& i
  1. [code]EDMA sample test application; T: e( m0 _0 b1 ]% l: B% G# ?, `# l
  2. /*! A, c( e* x" I9 l: A
  3. * edma_test.c# O7 Z; {5 j( f, {
  4. *
    / W8 M4 o% \* r/ E$ _( W6 J8 p
  5. * brief  EDMA3 Test Application! P7 Y3 s: |+ E- K( B
  6. *
    : K  y! ?" c/ c  ^9 `- [
  7. *   This file contains EDMA3 Test code.
    * |$ C0 M1 i1 A% ?# @
  8. *0 }! T: Z3 l/ r' G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * p2 P8 l! \6 B' Z7 Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ z- C1 w5 k5 D
  11. *         TO CHANGE.
    ) c* n4 e5 [& P# ]# c
  12. *
    8 J5 J! N0 Z  s" @) i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 D7 ]  i+ _( X, u- B) L% c
  14. *
    0 a9 |4 j. d" }6 d/ ~* K
  15. * This program is free software; you can redistribute it and/or
    7 ?( y& P6 }1 T  V" T2 {) h8 v
  16. * modify it under the terms of the GNU General Public License as
    ! x) N: E. {( N
  17. * published by the Free Software Foundation version 2.
    ' S* U, l" }8 e9 v* p
  18. *8 W6 i0 ?, x) S) K* t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & x( r; r+ t7 K' p& X: ^* t
  20. * kind, whether express or implied; without even the implied warranty; j. V) e( @* o( o, Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% b. J# g1 k  O6 B. Y0 p' k0 ~: U" P
  22. * GNU General Public License for more details.
    + b) d9 d  v* j: {  \
  23. *// O" d/ X4 Y" ?9 S2 @
  24. ' w4 k, z+ k- ^- o2 @" L
  25. #include <linux/module.h>3 u8 F- ?' ]! q/ K" J
  26. #include <linux/init.h>5 g# }9 I2 A9 ]
  27. #include <linux/errno.h>9 M0 W- ?' t& A, z+ `
  28. #include <linux/types.h>
    # a! d2 E# D7 M; c
  29. #include <linux/interrupt.h>. L/ p  r& w6 ^( c( Q- g0 w
  30. #include <asm/io.h>5 l8 J( _: J5 ~6 u
  31. #include <linux/moduleparam.h>
    ! l5 @& B4 f/ t1 q
  32. #include <linux/sysctl.h>( R3 O, O) r' t2 n4 R
  33. #include <linux/mm.h>- f/ f: h4 U9 _# Z0 ?6 q
  34. #include <linux/dma-mapping.h>4 r* \# _8 D+ t, T% g# v( v- I9 b$ H

  35. ; ^* c' B. t8 ]0 w1 |5 o) i  p4 l! v
  36. #include <mach/memory.h>$ Z% Q+ K. X$ D/ m
  37. #include <mach/hardware.h>8 _( p1 Q- q9 s% V
  38. #include <mach/irqs.h>
    6 n8 ~  _1 u3 J8 S
  39. #include <asm/hardware/edma.h>$ Z* `2 c4 N! w3 c8 W$ Y& h

  40. " [  z0 ]: r: A
  41. #undef EDMA3_DEBUG
    : c  _, n4 g( I
  42. /*#define EDMA3_DEBUG*/' a2 i) f! ]: S- {0 h
  43. + H0 F: t. o% l9 x" b* n
  44. #ifdef EDMA3_DEBUG  S5 y1 `& `1 L" W. f& H# f  `" Q+ c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ t$ A, Z( H. x& d  t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ e5 i! J! p% ?2 p- X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % \$ {$ ]5 I/ T9 V! @' t: n( B
  48. #else
    2 t, s" ~) [- e- A- o
  49. #define DMA_PRINTK( x... ); `, h  K* U& [6 X  c- K! O
  50. #define DMA_FN_IN
    5 V" d* \. o7 K5 `$ [! C; F- Q! X
  51. #define DMA_FN_OUT
    7 _2 F, ^1 A* e' F' H7 c2 w' J
  52. #endif
    9 o' D* H; j2 S7 J6 f

  53. . V% k# @6 ]( x3 b# T4 d) H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + y) `6 o% |! C4 x) i5 a- h0 F6 ]
  55. #define STATIC_SHIFT                3
    * G+ `- C; }7 a6 r7 I
  56. #define TCINTEN_SHIFT               20
    2 h8 m$ W5 A. x. _: ~+ I6 k
  57. #define ITCINTEN_SHIFT              21& e" ~% _; [: b" T
  58. #define TCCHEN_SHIFT                22
    " c, H' d: @% S# y6 G, I1 o
  59. #define ITCCHEN_SHIFT               23* B6 w. X: D. G/ R- a3 \  C! U
  60. $ x  M, A$ T8 L* A
  61. static volatile int irqraised1 = 0;
    ) R' }: D9 s3 h$ Y" l& M# o
  62. static volatile int irqraised2 = 0;
    ) u# J/ g/ R; `* B' l9 _
  63. 8 ?% {$ d3 a8 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : V9 {  g+ b" r& t; [- A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; P2 c3 @$ v4 _+ S, H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& M! e, T8 x3 F8 z

  67. # p. Y, R- v9 B) {$ H$ T1 p+ Y
  68. dma_addr_t dmaphyssrc1 = 0;0 R- E3 v, F3 m' V0 Z! K  W% f8 c. s
  69. dma_addr_t dmaphyssrc2 = 0;5 V# s- @4 T7 j5 L% F# Q. s
  70. dma_addr_t dmaphysdest1 = 0;
    7 ]& S1 T! o9 _$ u3 ^
  71. dma_addr_t dmaphysdest2 = 0;# N& x' g/ V& y$ p9 D! g

  72. ) W  ^9 d0 J7 ^8 ~/ D) P% f& \7 p
  73. char *dmabufsrc1 = NULL;
    3 L; R& q& U4 t' |. u! b/ r
  74. char *dmabufsrc2 = NULL;
    % H2 t6 y4 D0 p7 _& ~  ^/ f
  75. char *dmabufdest1 = NULL;
    7 ~. H9 I! J3 ]
  76. char *dmabufdest2 = NULL;2 [( g1 s9 Q5 I  Y

  77. 0 \  n* x; b1 J0 Y9 T1 D+ P) L" u1 p
  78. static int acnt = 512;
    ! V7 |7 U* a3 S6 T7 @* y
  79. static int bcnt = 8;5 u; H: B! W$ J2 @
  80. static int ccnt = 8;) t% x! p, ?5 R4 D" p1 l
  81. + s& L6 o% B1 y& O; s$ V) u
  82. module_param(acnt, int, S_IRUGO);
    ! j9 G7 e4 ]& x' `
  83. module_param(bcnt, int, S_IRUGO);4 k& {" h$ f+ e- V- v6 p' l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 m0 b8 E& D- _5 a( Y( c/ c
  ?. \* B# q1 q: l* w7 K* l$ y" l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' B6 K9 x% u$ r9 T# @6 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- E5 I! _9 H% y- V7 {: n2 Q1 b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( V# Q. c0 p5 E+ k0 z2 L, l
2 c: ?& g# l: g/ c

1 {; a' l6 j+ F6 w- J0 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 14:49 , Processed in 0.056843 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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