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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " {: {) j7 p- ~1 K+ n( J
  1. [code]EDMA sample test application
    1 N1 V% L1 r, X2 L3 }
  2. /*  N% E4 l% C: U2 `
  3. * edma_test.c
    3 K# T9 Y, [7 Y% T3 t
  4. *. Q1 q2 `  [! K# M% W4 M
  5. * brief  EDMA3 Test Application
    / k3 _- p$ j( n# B; z( W) {7 d, y1 _
  6. *6 s  s- z9 @: h% _
  7. *   This file contains EDMA3 Test code.4 x: o  {' Q2 c1 A2 h8 ^- q
  8. *: g, c& J% y4 ]2 _7 ~  K- }  t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* q7 G6 W% \& a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 R/ \! n% v- _8 r( s0 ]9 n4 s
  11. *         TO CHANGE.( J( V( p/ U# b5 [7 J4 Y
  12. *! _& g! g2 W7 r0 E- ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ c' H7 P; X4 f: f( z
  14. *# n: w1 v% Y. u3 d7 `
  15. * This program is free software; you can redistribute it and/or+ X' u, a: E6 J2 U
  16. * modify it under the terms of the GNU General Public License as% u( F+ B$ z( D- s% ?
  17. * published by the Free Software Foundation version 2.
    . f" p6 D6 l% i% I! G
  18. *+ Y0 ^% N* \! D5 A  A' [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" g, V# W, X; q! {% l; C" T
  20. * kind, whether express or implied; without even the implied warranty2 M  B) E1 i" a+ \/ o1 M0 h6 ~# v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; e0 S" V3 Z' A. q8 ]0 }; d1 T
  22. * GNU General Public License for more details.
    ' d- j0 K9 U. V; V
  23. */
    6 H, K3 j* ~0 C9 r( N3 `' `

  24. & s6 L) z) g' Z" ^# S  @' _
  25. #include <linux/module.h>2 f8 b6 n5 M/ t2 N: u
  26. #include <linux/init.h>
    0 U+ f' F9 N9 A. ?1 T
  27. #include <linux/errno.h>2 R2 A$ q$ t' [# F2 `
  28. #include <linux/types.h>
    2 d( N9 n$ B% L/ c+ C4 x1 |% ^
  29. #include <linux/interrupt.h>
    6 ?! B* i  y) Q# X& j
  30. #include <asm/io.h>
    - O$ J) n: L# n8 E
  31. #include <linux/moduleparam.h>
      `4 N2 ^2 H, W1 J2 w
  32. #include <linux/sysctl.h>
    ( h; p* s5 _; S2 z) E" p
  33. #include <linux/mm.h>
    % q  q, N7 j' B7 X6 p+ v: m
  34. #include <linux/dma-mapping.h>
    6 O& R" E3 Y- x% ?7 c
  35. & F# N; \) j% p& P% L( {$ U
  36. #include <mach/memory.h>
    & v* ~! q* o. y; _  b% c
  37. #include <mach/hardware.h>( @6 b' y4 _6 n3 {4 ^/ w& @
  38. #include <mach/irqs.h>
    3 X* U9 L5 R% T% c( _! |
  39. #include <asm/hardware/edma.h>
    6 [# o/ U8 V1 e  b1 c7 Y8 V
  40. : H' {' b4 y) S% b$ d8 s8 S; k( x
  41. #undef EDMA3_DEBUG
    , K* Z8 v" d8 ]+ T; Z0 }0 T* L3 v
  42. /*#define EDMA3_DEBUG*/* R3 I/ L0 y. h1 S, i# M
  43. ' H$ b& r" N' y) X' U0 r
  44. #ifdef EDMA3_DEBUG
    # A1 h0 o  l; C- {$ d. f/ P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ z+ T6 W# y7 d& K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ V4 l0 u% g2 S* V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* D& O4 ^0 O4 t  r; T$ |" U1 \3 k7 M
  48. #else
    8 {' R& a# T. |6 U- t' O) B
  49. #define DMA_PRINTK( x... )
    9 [( K, @2 R" ~" m! R, {
  50. #define DMA_FN_IN
    6 P: _$ H; m' d
  51. #define DMA_FN_OUT
    9 C) `: N+ P& {" y* q: K
  52. #endif7 r# N- s# e3 X9 L& R
  53. % {  P, o: O2 b7 z! a4 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 W9 I) {6 w6 p
  55. #define STATIC_SHIFT                3- Y% p; [$ \1 J) G# T
  56. #define TCINTEN_SHIFT               20
    3 N- J, o- o) `( d2 r7 r
  57. #define ITCINTEN_SHIFT              21
    3 f! D! ?6 J/ B9 U, m
  58. #define TCCHEN_SHIFT                22% i+ H1 ]3 i" E1 L
  59. #define ITCCHEN_SHIFT               23
    ) K9 C6 V2 N$ j8 I$ e2 z5 g

  60. ! d6 o; ?# E# h; ~2 U
  61. static volatile int irqraised1 = 0;
    ! R/ X+ M( `: M2 e, s+ H8 b
  62. static volatile int irqraised2 = 0;
    : c; A( z! x5 f! P. t! D' t* V9 g
  63. 2 `" {0 s0 h; l. C0 K$ p) v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; h3 u; ^0 Y. C+ V* i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 _) y8 e  |$ i& s$ t3 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 S0 J9 f# `: n  n

  67. 6 K5 g1 \9 K% `
  68. dma_addr_t dmaphyssrc1 = 0;
    . \$ c2 F# O8 M
  69. dma_addr_t dmaphyssrc2 = 0;
    ! H4 X. b7 |, ~' m0 c3 Z
  70. dma_addr_t dmaphysdest1 = 0;' h0 X( z) A8 y# ~! \9 I
  71. dma_addr_t dmaphysdest2 = 0;9 Q4 m* r# c! E# w# F/ f2 H' Y% _* ~
  72. % j9 o! @0 c6 B4 b; M# P
  73. char *dmabufsrc1 = NULL;* J5 W% ?/ y* |8 e, o
  74. char *dmabufsrc2 = NULL;
    / c1 R* R0 ~6 ?! j9 o0 G) x
  75. char *dmabufdest1 = NULL;
    0 F+ S& C( G3 {/ W
  76. char *dmabufdest2 = NULL;
    & ]+ i3 [" ]8 v. b7 |; Z
  77. : ~2 s6 n, c% k* S7 }
  78. static int acnt = 512;' T  @, k1 W, `% U0 |& c9 A- Q
  79. static int bcnt = 8;1 i# i! x1 t) p; L
  80. static int ccnt = 8;
    , s  h# I: y/ k4 `5 H- }+ H

  81. " {4 K# ?6 I; V( B4 Z
  82. module_param(acnt, int, S_IRUGO);. a3 U/ f4 Y# t% {) B
  83. module_param(bcnt, int, S_IRUGO);0 F! w! C3 \; i6 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  ^) v9 B0 I" ]+ v. D, O% a3 S( l5 p: B9 P7 k2 b( J+ ]. ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) G- A) x) u# I2 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* N* v5 }. }, s* ^8 a) a$ h; p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* x7 q+ @4 k' ?# }& d& i9 V4 _7 |$ x1 \  ^% w% `: t

! H  ?, l4 M6 d, ^' \3 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 07:09 , Processed in 0.043481 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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