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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ J6 ~) D0 u2 p" q
  1. [code]EDMA sample test application
    ! a- T+ u3 F' F' a: Y5 r
  2. /*1 p( W& |9 k, A& S
  3. * edma_test.c
    . L& u8 \% R6 v: H+ [
  4. *: x: B8 ^& O4 i8 z) H7 d& L
  5. * brief  EDMA3 Test Application
    0 K+ l3 c5 W. M. J  c& x
  6. *
    9 j2 j' \: @( i; p
  7. *   This file contains EDMA3 Test code.
    # ]* E# @: a4 c2 E+ ^# l
  8. *
    % Z1 ~# c5 E8 Z; h; {. D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" B5 @3 i5 R3 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 N5 @1 f" Q8 D, p' j; L
  11. *         TO CHANGE.
    - j7 E& f! A/ o0 u1 ]
  12. *# @7 X0 U! ?& g: d" z8 n. B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + W/ O5 }1 y/ l7 D: {" C
  14. *
    1 k( K. c" ?, T3 k1 W
  15. * This program is free software; you can redistribute it and/or) Q' e9 W  l# p! f* I- w
  16. * modify it under the terms of the GNU General Public License as& L, p. ~6 A+ T' T$ K! M
  17. * published by the Free Software Foundation version 2.
    0 o! ?: s$ I, {9 p9 p: X) F
  18. *: M' m/ D$ k9 j9 i# P0 |% t0 p& N# f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  e0 Z+ E, o2 O, @
  20. * kind, whether express or implied; without even the implied warranty7 ?/ h( D' m0 ]& W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 H3 [; {2 c& l' G. E
  22. * GNU General Public License for more details.( C" h% {) ~' Y  K
  23. */: y% M# e" O# l5 ^
  24. 8 t! g0 A) Q; ^# X, D3 F) L
  25. #include <linux/module.h>& v5 L7 u) h: Z
  26. #include <linux/init.h>
    3 ^+ p1 X. O+ M& n5 u- T
  27. #include <linux/errno.h>
    7 z4 M* J: a. l9 L- z
  28. #include <linux/types.h>4 h% y) j7 @& m- p1 W, [$ L  `, K
  29. #include <linux/interrupt.h>, _/ c: I4 J+ k- h! b
  30. #include <asm/io.h>
      r/ p/ `. l; p" V: }0 ~* G  I* a- a
  31. #include <linux/moduleparam.h>
      Q7 Z1 M8 y4 p7 {
  32. #include <linux/sysctl.h>
    ' G, O- _, s1 ^& Q8 c0 k& l5 Y
  33. #include <linux/mm.h>
    9 U1 w0 U2 f0 W
  34. #include <linux/dma-mapping.h>
    " x1 ^; S( u- h) z' `8 B; n4 ?
  35. 7 l# U5 a% O, Q9 X0 O
  36. #include <mach/memory.h>
    0 x. v/ O4 q2 k
  37. #include <mach/hardware.h>
    + o* X  H) X* V* O2 d% Z% N' u
  38. #include <mach/irqs.h>. V  u9 ~" Y! u0 Y& e8 M9 g
  39. #include <asm/hardware/edma.h>' }& w# ]/ Q, A+ s# N1 Z2 k0 `
  40. 5 q. [/ c& E0 F, z
  41. #undef EDMA3_DEBUG
    2 D% G' ^2 F# F: `
  42. /*#define EDMA3_DEBUG*/' D* X: t4 r5 I5 L. \+ J& D

  43. 1 i' _, B9 {* A* j& V% g3 M
  44. #ifdef EDMA3_DEBUG) q$ u9 e" i9 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! W' H& L( b* t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * E' R3 B7 K7 N( v" D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 l0 I0 B: Z5 q. R
  48. #else& A2 y5 \& H& b( y1 M
  49. #define DMA_PRINTK( x... )+ `$ h1 ]( O5 p/ i
  50. #define DMA_FN_IN
    8 W/ m1 z8 Y7 k
  51. #define DMA_FN_OUT. Q: A* ^* ^2 `6 C/ u
  52. #endif
    - O0 J6 n2 \) \) ?+ n
  53. : v1 {3 w: g2 k) Z) K2 Z: a; L. T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( s4 p: Z* F& q: o
  55. #define STATIC_SHIFT                3
    : Y( k- s% s. Q" S( r+ i
  56. #define TCINTEN_SHIFT               20, O- x# \0 y8 X" u# g
  57. #define ITCINTEN_SHIFT              213 O2 W& q9 L. a
  58. #define TCCHEN_SHIFT                22$ d/ j+ ]2 \5 d0 t  R+ B
  59. #define ITCCHEN_SHIFT               23! q" U/ Q+ J+ {3 O& h

  60. ; O) j+ u# `5 f+ o
  61. static volatile int irqraised1 = 0;# o- ?. I4 k) |) p$ }9 I* `
  62. static volatile int irqraised2 = 0;2 n: P* V7 k3 q
  63. ) w* o5 H& [; S. V! |5 V% \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      I% I0 D' V# ~" Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 P6 Y; W7 H# T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; o, P, f* g! S' m0 I' ]5 X# x8 h
  67. 9 U. h! y8 T7 l4 N- o3 X! L
  68. dma_addr_t dmaphyssrc1 = 0;
    ) N" }( u' p. B  C  H8 Y3 t
  69. dma_addr_t dmaphyssrc2 = 0;) B5 R5 c! s( ]" J
  70. dma_addr_t dmaphysdest1 = 0;" d$ [' P# x7 b( r/ `  k0 s
  71. dma_addr_t dmaphysdest2 = 0;0 Z5 l2 J7 Y9 Q7 L! c) P1 L3 a; W' V1 U1 Y
  72. ) N+ F3 {+ N; b$ W2 |2 x' M
  73. char *dmabufsrc1 = NULL;
    : R1 ]6 x" L8 b- X
  74. char *dmabufsrc2 = NULL;
    . X6 P+ C: t  t/ x
  75. char *dmabufdest1 = NULL;
    & p2 i% u! p' I2 [! Q% s
  76. char *dmabufdest2 = NULL;2 P8 `9 |- D8 a* n

  77. 9 o8 D9 T+ d' P# a2 |
  78. static int acnt = 512;% j. h. {% `9 m
  79. static int bcnt = 8;: g8 H5 V# R. w
  80. static int ccnt = 8;
    / ?8 ]6 B& x, w4 H( [5 x

  81. 7 A) N' J/ |5 @$ L  p- B! o2 I
  82. module_param(acnt, int, S_IRUGO);
    0 `& q: o8 n$ K4 R5 P* l4 o
  83. module_param(bcnt, int, S_IRUGO);
    * K9 |( S, w5 s' g& z! b" }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, M) J% v3 F$ K, K
. ?8 N6 I" c0 w& }+ ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( S; k8 |4 Y) s3 H4 Y, Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% a4 v5 N7 m+ d4 J% I6 R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  u: T* d6 a7 L  Q: l! N

  d5 r5 u/ b% g" t+ D" l: ^, T1 @4 T/ S2 g& }" M( K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 00:00 , Processed in 0.040003 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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