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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - p8 I9 d5 N' |. b; i" \  Y" l
  1. [code]EDMA sample test application* T7 e9 H7 M0 }+ `/ D; o
  2. /*
    4 c& q. w# `0 ~' C: }- b: U2 ?% P
  3. * edma_test.c
    2 S: _% Y2 R- H9 P0 H
  4. *
    4 W! B9 A3 Q; _) q+ N; N+ A
  5. * brief  EDMA3 Test Application$ P2 b5 ?* ?) p. ?/ o$ p- a4 }
  6. *$ l- @4 f* ]8 a" ]7 V: d2 S7 {
  7. *   This file contains EDMA3 Test code.
    8 I9 b$ B6 C) {9 T2 N
  8. *0 t7 K- D+ t7 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 P  c% c5 f" H" |. T0 n4 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & e: P# m+ p  i
  11. *         TO CHANGE.6 Q2 m" H+ |1 B3 y3 ^
  12. *) }2 m/ \$ R6 L  u5 q" f+ @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * f9 ^/ Q4 _; y+ x7 z9 ~1 P
  14. *
    5 O( _3 ~3 r/ t6 v4 l9 h
  15. * This program is free software; you can redistribute it and/or$ |0 M% h( F' p* e; z* n
  16. * modify it under the terms of the GNU General Public License as% u% B) V5 o! e' {& X
  17. * published by the Free Software Foundation version 2.% }$ k( |% h8 e3 e4 C
  18. *( {6 h, |$ d( [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * x# Z& N( R) m# E
  20. * kind, whether express or implied; without even the implied warranty7 V2 x$ i$ G4 F; K  a" p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# Z$ h$ y0 a; l9 @
  22. * GNU General Public License for more details.8 L1 a- k% Y- v- M& f
  23. */
    : r5 F$ A: y( n7 n" ]" u( ]" k9 g

  24. 7 j. S+ Y# d' y# z7 c4 _
  25. #include <linux/module.h>
    - V/ s/ O9 Z9 R4 }
  26. #include <linux/init.h>7 n/ P$ |6 J& v
  27. #include <linux/errno.h>" I$ \) _% w! ~
  28. #include <linux/types.h>
    * p) g) v5 q" Q/ f/ e: ~) U! s
  29. #include <linux/interrupt.h>+ ?% A* |! e; \
  30. #include <asm/io.h>! L) [$ k: \2 _2 E" Y* c
  31. #include <linux/moduleparam.h>
    ( s! s" i( ?  y3 X4 q" e' ]
  32. #include <linux/sysctl.h>
    4 L. J' n% R2 U% Y
  33. #include <linux/mm.h>
    . n% ^( P! L. W: Q3 t: X
  34. #include <linux/dma-mapping.h>
    . \+ O6 M0 L2 a" [6 i

  35. + ^( t( s1 ]( V5 g; a
  36. #include <mach/memory.h>3 ~: q) K) W, l2 ^+ A
  37. #include <mach/hardware.h>
    $ R5 e/ g1 u- m+ u; Q9 X3 L, P, k
  38. #include <mach/irqs.h>( n5 J; h4 u- \% }9 F
  39. #include <asm/hardware/edma.h>! k2 ]) a& v2 `: m3 K( u1 Y
  40. " g& ]- u0 W$ A. {" g
  41. #undef EDMA3_DEBUG8 T, c' w: Z2 Z' h
  42. /*#define EDMA3_DEBUG*/: ?3 \; O+ s0 `) Z+ Q! J% C
  43. - Z4 }# f3 t6 z- d; D
  44. #ifdef EDMA3_DEBUG
    ! o/ W0 x* G0 X1 Z# E* P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! @% W8 j. _4 o- g, X9 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  U0 |3 S/ ~: X8 O; P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 s$ @7 L# X; C- \, g5 l
  48. #else
    6 E4 F  i4 Q- i& v
  49. #define DMA_PRINTK( x... ), s" p: q; L  w# O) S' _3 |  r$ ]
  50. #define DMA_FN_IN: A0 s* s5 y  f. q
  51. #define DMA_FN_OUT
    ( J& U. G$ a+ B# N0 _" B4 x
  52. #endif' n/ k3 ?3 L% a' b- g

  53. . g1 C" i2 X; n  J" K1 J6 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 Y8 H* Q6 O7 |2 W, x$ g- |# m
  55. #define STATIC_SHIFT                3
    ( G1 c5 X9 h5 u/ J. {! h
  56. #define TCINTEN_SHIFT               20- S$ g' d+ M; H7 b" u" c. r7 e% _
  57. #define ITCINTEN_SHIFT              21
    0 B1 E* t# `' F; m8 ~9 z2 Y
  58. #define TCCHEN_SHIFT                22
    ! r+ O; I4 S9 v, A' _% f
  59. #define ITCCHEN_SHIFT               23, t# J* z. q( X
  60. 9 F0 h' M1 k5 z& P6 @! [7 [  [/ v
  61. static volatile int irqraised1 = 0;* I1 _# ^( y( j3 e& p% E4 T
  62. static volatile int irqraised2 = 0;7 W4 t: p1 q# `
  63. . n2 U, P' p5 y- r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , t- i& h$ v& h; [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: M3 O) U# c) o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ]* \) I- H1 Z) b: `1 H' r; T

  67. % y/ u# W$ W$ j- h
  68. dma_addr_t dmaphyssrc1 = 0;
    % t4 X  i; o, y/ M% u; |  D6 ?
  69. dma_addr_t dmaphyssrc2 = 0;1 v! o/ u6 j: n& i
  70. dma_addr_t dmaphysdest1 = 0;  |, Z% N! c; C7 m% _6 W; g2 x
  71. dma_addr_t dmaphysdest2 = 0;
    , z& r5 I4 h( E( [1 y! j0 Q
  72. 0 m# ^7 s5 l1 e
  73. char *dmabufsrc1 = NULL;
    ! i1 G  }/ `  I& \  w+ ]
  74. char *dmabufsrc2 = NULL;
    & x% |0 V4 V  o7 M7 f6 q8 d9 |3 @
  75. char *dmabufdest1 = NULL;( Q  ^+ u# D& Z0 I2 k3 b* C4 O. V
  76. char *dmabufdest2 = NULL;, [5 d  J' ?% ^/ D
  77. 4 ~/ a: l% J; M* M6 ^  x
  78. static int acnt = 512;6 l: w& d/ f+ u( U: ~# I
  79. static int bcnt = 8;
    ' g( X$ s; ?# o- u- T+ r3 Y
  80. static int ccnt = 8;
    # h! M- _* a6 [1 V! O" `

  81. - k+ a5 s- _/ y5 c
  82. module_param(acnt, int, S_IRUGO);  ^8 L9 H$ H3 U& O+ k  N5 P# E
  83. module_param(bcnt, int, S_IRUGO);6 Y$ t- m! ?1 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 h& w& C" H6 v& l
( i8 |" \! f) H8 m) P% P4 S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 g* M. C& l0 T" \& u+ f( b4 Iarm-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 ]) k* U" j( l2 i; f+ `% ^& L7 i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. B$ x+ R5 \, C% L7 B5 x) X* Y: m& J
4 G) Q) i& I4 ^  i
6 [% |3 k: K( f* P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-25 22:20 , Processed in 0.044476 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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