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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 Y# V5 K6 X1 i# k* Y$ _; u
  1. [code]EDMA sample test application
    # i2 Q* _, d1 m* z/ G% C" [
  2. /*3 ]* o1 P2 t) d( ~! P
  3. * edma_test.c  v$ X: Z: h4 f% j2 V) P& c8 K
  4. *
    1 |0 g. A& r: P
  5. * brief  EDMA3 Test Application1 b' `  r0 E# s
  6. *
    ! |; q% P& e& t  `$ `- e
  7. *   This file contains EDMA3 Test code.
    3 w, X' F; Y' w) j
  8. *% N, L$ K% X$ Y% N# D- u# }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 @( d! `0 I. m2 W: @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / V* S+ H/ T: ~6 R; n1 V
  11. *         TO CHANGE.
    : d2 A6 t+ @1 k9 H1 N
  12. *
    3 h- L* X% c' C, T4 E+ B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 n" x4 Q" c, y
  14. *
    * v4 J" y# R& j+ v5 j
  15. * This program is free software; you can redistribute it and/or
    & n) h# f/ K& A- M
  16. * modify it under the terms of the GNU General Public License as
    1 Z' a0 r5 j% A1 {  y
  17. * published by the Free Software Foundation version 2.. E* R& n# L% ~/ j
  18. *' P1 D) I* o$ W# S% J9 k! y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& o- D( L$ K3 c1 p; j, @
  20. * kind, whether express or implied; without even the implied warranty
    3 g+ e8 F8 o/ b/ H; D. f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 |2 ?2 C1 x% ]+ a
  22. * GNU General Public License for more details.
    . W: B" Q0 K9 d: l
  23. */% F! o: z8 l6 t  q; ~& f/ v8 V
  24. ' I6 _1 D5 x# ~  k1 s$ y" v
  25. #include <linux/module.h>
    6 R9 U5 q' f/ }2 i. g
  26. #include <linux/init.h>
    2 A; N' a( z5 L- F
  27. #include <linux/errno.h>
    . ^+ F' Y; G2 J4 L& H
  28. #include <linux/types.h>' H2 |! L; L4 C& c
  29. #include <linux/interrupt.h>. b; n+ p2 s# y3 ~. Q
  30. #include <asm/io.h>
    / l* x5 `  A. j- J1 I9 P5 E
  31. #include <linux/moduleparam.h>& ^& d( E9 k5 K
  32. #include <linux/sysctl.h>2 x. Z. \( l1 ]7 P9 w4 R
  33. #include <linux/mm.h>
      q" Y& @; o& `6 f
  34. #include <linux/dma-mapping.h>
    + w7 I) o+ H, q& t

  35. 5 |! _& O% g. q7 a2 n! i
  36. #include <mach/memory.h>: r! @4 X$ x! D3 ]0 Y7 E7 l
  37. #include <mach/hardware.h>
    ( \. L1 ?$ [( p, w$ D
  38. #include <mach/irqs.h>  F+ s0 T+ Q9 R( S9 w3 d8 I
  39. #include <asm/hardware/edma.h>) z/ J$ a6 ?6 s, q& B

  40. * U, Y9 v- E& W  Y: m4 i
  41. #undef EDMA3_DEBUG: i8 f* \5 y- E* Q' w( Y) s
  42. /*#define EDMA3_DEBUG*/
    3 M) ^% ~- _3 D% l$ i6 v. L

  43. : K8 a4 z6 o4 ?" ?) O
  44. #ifdef EDMA3_DEBUG
    . ?* l! {, e$ J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / ^0 G9 `1 `% Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' K) q/ F5 Z0 G- U8 @. U0 S7 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& K* z, N/ a$ w! P. w) U
  48. #else$ G- X  u7 E  g& I- z* ]
  49. #define DMA_PRINTK( x... )
    * w2 G" @) E1 D/ b2 }/ i
  50. #define DMA_FN_IN
    + T) G$ i" d! a6 ], r" l( i
  51. #define DMA_FN_OUT
    3 b( A& L) ^7 P8 {; \
  52. #endif
    4 m5 o, b4 p! q* n' ~1 o  n
  53. 3 V+ Z3 y+ `) C" |! i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 @2 L4 `6 w5 r1 N- _
  55. #define STATIC_SHIFT                3& m$ }. y" B; K, k
  56. #define TCINTEN_SHIFT               20
    8 ^6 _, Z8 m* o$ T7 J' R
  57. #define ITCINTEN_SHIFT              21
      P( T5 y. r' P
  58. #define TCCHEN_SHIFT                22
    ! Z2 G7 ?0 M. X( t: I
  59. #define ITCCHEN_SHIFT               23% Q  P% [. ?2 ?3 l5 X0 Y
  60. % b2 z7 O5 P1 A, V) q; z* R& j
  61. static volatile int irqraised1 = 0;- B" X* b! K0 G/ H6 N: L6 j
  62. static volatile int irqraised2 = 0;
    " g% f0 I/ L' @' k$ v1 M+ `
  63. $ Z2 p- X3 m# p- H' z( }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! H2 l" g% O2 f& O3 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " ^3 F6 f& ^+ `1 P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! {' R. y' L; v" g0 h
  67. 2 ~- d3 V: O& {5 x& I
  68. dma_addr_t dmaphyssrc1 = 0;) e3 Z; y1 |5 \; B/ u
  69. dma_addr_t dmaphyssrc2 = 0;* m8 Q7 N: i8 o  l' J
  70. dma_addr_t dmaphysdest1 = 0;3 [+ [( P* I. c) S3 ^  `
  71. dma_addr_t dmaphysdest2 = 0;  q9 ]/ j1 j  o% l

  72.   ]( A3 q  g! ~
  73. char *dmabufsrc1 = NULL;, G8 n, r4 P6 `
  74. char *dmabufsrc2 = NULL;
    4 Q; L- U1 Z) t- w/ P- J7 r
  75. char *dmabufdest1 = NULL;+ j) l) }+ r# W$ b( J2 E! w, I" N
  76. char *dmabufdest2 = NULL;7 I6 Q2 E: n: b* a
  77. . L4 i  A) Q+ f9 \/ O" P6 q
  78. static int acnt = 512;
    7 f6 ?. T1 {0 L& p
  79. static int bcnt = 8;  L  B6 O. M/ u
  80. static int ccnt = 8;
    + q2 e; j, {2 O6 ^) p* T
  81. $ q. E. K7 c+ L9 _" a
  82. module_param(acnt, int, S_IRUGO);
    " ^2 i6 h" T! j# m3 ~6 z5 C
  83. module_param(bcnt, int, S_IRUGO);( l, B3 R" _; L1 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 m! T; |- K0 N0 R1 C2 y! R! J

- ^2 {: ~+ V  z: w& _9 w& [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* R5 Z# H3 n" K+ M, P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; h' D  [9 @8 z6 `3 C' J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ E" e8 ]0 s, K! P
- s' Y) l4 p( a$ ]7 Y+ e0 s

1 T' v5 u2 E0 G" h" H" t' ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 04:11 , Processed in 0.039717 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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