OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " P& _1 Z; e. T2 f1 W
  1. [code]EDMA sample test application
    0 v- P7 a. ^+ v
  2. /*
    ( U/ A! z9 |: t' A) }" F
  3. * edma_test.c
    2 }) _) y0 }, t2 E
  4. *
    * S" D! a) X! X. ]0 Q/ l
  5. * brief  EDMA3 Test Application
    * e$ A0 b. V& q
  6. *) ]4 o1 S; ?& X6 D2 ]/ j( T4 E
  7. *   This file contains EDMA3 Test code.
    4 ^3 a+ n% Q) c# T( Z: i, t+ p" ^
  8. *3 M5 I. T, i! o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + g2 [4 _& u) Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " W5 Z8 C$ a5 m" P
  11. *         TO CHANGE., m( g6 b8 `( C) J. U+ Y
  12. *
    4 e' Z; \: u/ g# ~! }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 s" q# A! ~3 j- P, ^8 w
  14. *5 D* y9 N: ^. ^4 f' ]/ N! f9 L
  15. * This program is free software; you can redistribute it and/or
    : }$ C, E" Q2 q  f9 s' K
  16. * modify it under the terms of the GNU General Public License as! z6 Y3 L4 K6 ?6 {" F
  17. * published by the Free Software Foundation version 2.
    2 }) H/ v- U- p, [7 W
  18. *3 f8 O0 |( t" p4 @3 [1 L8 r9 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 Z, n" {! B! c% [
  20. * kind, whether express or implied; without even the implied warranty
    7 v+ p. F  r$ l* B) {6 Z* \, r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 D/ r$ F7 k8 X# g9 \
  22. * GNU General Public License for more details.
    & a# X! n0 M( k* a/ J
  23. */
    ' F9 x" h( a1 {5 B
  24. $ g) N4 \9 p2 k& P3 W0 n
  25. #include <linux/module.h>
    ' X. V3 U6 ?- x# v
  26. #include <linux/init.h>! l" h% @4 u7 N, r
  27. #include <linux/errno.h># i+ W& W* }) n8 N6 Q1 _- m
  28. #include <linux/types.h>$ l! H' M; ]! P  `, x0 c
  29. #include <linux/interrupt.h>; m9 G# J6 t5 J& x# O! S- a% H5 ]
  30. #include <asm/io.h>
    . q% p2 L$ ?& c6 T# q
  31. #include <linux/moduleparam.h>$ C9 v/ s) s1 O) Y' |
  32. #include <linux/sysctl.h>
    6 @* b$ Q+ m7 Q" C( k. Y
  33. #include <linux/mm.h>
    ; @1 j- t* o# w* A7 C" D9 d8 o# B
  34. #include <linux/dma-mapping.h>) f( H9 M8 y( z! L1 L: u7 {

  35. 3 X0 r  A, s( V. b) R2 `( _
  36. #include <mach/memory.h>
    3 P1 t0 E, I( {! P& F' u$ [$ \
  37. #include <mach/hardware.h>
    + T+ V  [" I8 m' h# g
  38. #include <mach/irqs.h>  n' K( R6 U, [
  39. #include <asm/hardware/edma.h>  k. @2 ^) z7 y6 ?' \: {: o$ f
  40. / {; H- T3 R" h
  41. #undef EDMA3_DEBUG
    9 v9 p: u) C: E5 r9 T" O) z. ^
  42. /*#define EDMA3_DEBUG*/4 o) J) k# i7 N  r% Z
  43. 2 l% l. Z! q6 F" O# Z- L
  44. #ifdef EDMA3_DEBUG
    : k' K! R0 }6 V+ s# k' {1 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' N. i' P- A9 J1 d' S/ E$ P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ _$ w6 A, n' @; i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . y2 F6 G% ^  `; C
  48. #else3 f. M2 U! C4 [7 ~) G+ @" B5 @3 J9 w
  49. #define DMA_PRINTK( x... )2 e2 ^3 R6 x( \+ J$ Z" |8 C/ O
  50. #define DMA_FN_IN* w( i: s. f' V
  51. #define DMA_FN_OUT
    6 x) x6 c6 V6 c! B0 L% [+ Z/ r) o
  52. #endif
    1 `! ?0 O5 O/ {
  53. & G& E4 l& q- n' H0 {- _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % y7 t! J; C% _3 S
  55. #define STATIC_SHIFT                3
    0 r8 G. f" I  v. ]3 v$ Z
  56. #define TCINTEN_SHIFT               204 k2 ^( u/ G4 n7 d& h. {' v8 Y# W) ~. L
  57. #define ITCINTEN_SHIFT              213 x& X* e/ j6 B" c) q0 y7 V1 ~
  58. #define TCCHEN_SHIFT                22% w. F" L4 j  }5 ^1 Z1 {% w
  59. #define ITCCHEN_SHIFT               23
    # Q7 G! C# X( b* o- ~9 A( D" k0 }
  60. ; m( A- ?# }8 k# N; I  y% _
  61. static volatile int irqraised1 = 0;+ w' a+ B4 s4 G8 R
  62. static volatile int irqraised2 = 0;' N, e* b; M; j: r* F

  63. ) n0 b7 N: B0 u  y+ f! ^4 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 b  [6 d9 Z9 Z) t& `- w9 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( }# u' ?5 S7 L5 ^* C  ]$ X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 h! y+ ]6 a# m8 ^; O3 p
  67. 5 F; f$ y9 }9 z$ h
  68. dma_addr_t dmaphyssrc1 = 0;6 D5 _, F9 ?) j* a0 F7 E: e
  69. dma_addr_t dmaphyssrc2 = 0;, }% ~: Z% F1 h2 v+ B
  70. dma_addr_t dmaphysdest1 = 0;
    : R; V9 t/ \) s* C, O
  71. dma_addr_t dmaphysdest2 = 0;8 T6 u/ Q7 ^4 S( |& i$ Q# F' d4 E
  72. 6 }6 F9 g& i3 R+ p  k1 M
  73. char *dmabufsrc1 = NULL;
    4 I1 G8 i& z" n9 c  C0 a( V, I
  74. char *dmabufsrc2 = NULL;
    & \# ?! a( x9 R  w
  75. char *dmabufdest1 = NULL;
    / {" t. s" Q# b1 n7 ?4 ^
  76. char *dmabufdest2 = NULL;
    & ^/ [( l- M0 ]/ S1 J

  77. 8 y% p! ]  w# B/ Y5 c
  78. static int acnt = 512;
    . n! I' p" e  _7 U2 Z6 r
  79. static int bcnt = 8;% h/ Z$ V7 w; p1 I8 z& |
  80. static int ccnt = 8;
    , I. c! i8 R. ^9 b% b/ Y4 z

  81. 3 P' |$ G% P5 |4 N- b
  82. module_param(acnt, int, S_IRUGO);
    # k/ Y. N4 V! N6 [, s
  83. module_param(bcnt, int, S_IRUGO);
    9 k$ g3 I( g$ Q# ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, v# r3 }* W$ R: H8 h, e# e+ r+ J; I: v0 Y0 d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 m' D1 N6 N; T/ f" |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 j8 r# O* R$ K3 D! x9 s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- d  z3 Z, g& {1 y9 H9 i
  _* V" k' L) p$ [+ y4 e5 o

" a* h8 B! A& P/ l2 U5 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-12 15:11 , Processed in 0.038794 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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