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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # O3 v8 @' _) J0 c: P0 {' `
  1. [code]EDMA sample test application8 [/ ~9 a) ~1 \  ]. P6 }8 W( _
  2. /** o. b, i7 U, B2 ~$ X5 o  F/ H
  3. * edma_test.c3 }' V3 A5 u* K4 w+ _5 }; R" W
  4. *( Y, W2 p6 n6 v3 @( f; S
  5. * brief  EDMA3 Test Application! u, c  D0 h& o" ?$ D& X* I
  6. *1 d: }! J( ~- J) T
  7. *   This file contains EDMA3 Test code.3 r. U7 ?& _0 M3 H
  8. *
    ( w$ k% j1 F, x; E. z0 ]' Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 d6 d8 e- o3 t- i, G5 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ z- m+ N" L6 p7 T3 ]
  11. *         TO CHANGE.8 s+ d+ N9 L8 J$ |# }
  12. *8 d, k$ e& V/ C) E! j4 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " Z* J9 X  f( B- `- W
  14. *2 d1 {! @' V9 R1 `5 ?
  15. * This program is free software; you can redistribute it and/or
    7 F% f4 ^$ I  B2 I
  16. * modify it under the terms of the GNU General Public License as; Q: H+ b0 [: L& @1 F" S9 A
  17. * published by the Free Software Foundation version 2.
    ; o. F( v$ R2 W5 @! y! q
  18. *4 k& ?+ ]6 _2 C* P1 p- B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, C! h% J/ F4 `: Q5 q" I
  20. * kind, whether express or implied; without even the implied warranty
    ' A& ^" |& C% D" @* A  p$ |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' A8 n) y6 F: m8 q8 e  \7 ^, i
  22. * GNU General Public License for more details.
    9 F, O( q/ M) k. @/ _- x( R, ?
  23. */0 @( F+ @" Z4 d: a" J0 F* @% M! A

  24. # y" q; A8 l$ D( A( n& V' O/ x
  25. #include <linux/module.h>5 X6 P% Q" ~8 O# |( U
  26. #include <linux/init.h>
    4 c+ P5 d% p; D' }
  27. #include <linux/errno.h>
    + g" @$ N3 j* X9 l5 f
  28. #include <linux/types.h>( @4 D; q. I( A9 q8 h6 Q$ S+ Y2 i
  29. #include <linux/interrupt.h>
    9 d' V- T0 X2 A: \% C1 U! g& R
  30. #include <asm/io.h>
    + Y" \6 H# k7 X4 `
  31. #include <linux/moduleparam.h>! n6 G( y5 S( M& N! y* y2 y, m
  32. #include <linux/sysctl.h>  Z, Z: g/ O7 o4 b
  33. #include <linux/mm.h>' x0 U0 U1 I, y
  34. #include <linux/dma-mapping.h>6 B. D, f9 A7 j, c: U" _- G; U
  35. 2 ^, G" T/ @# @& Q3 z3 ~0 @% p1 j
  36. #include <mach/memory.h>* {) v! Z5 T  V4 v$ e. n
  37. #include <mach/hardware.h>
    " d, c, x9 f6 G) m+ U$ M: x' f. W
  38. #include <mach/irqs.h>1 w; n: {# {9 W* r
  39. #include <asm/hardware/edma.h>
    8 M8 j( X$ _: u9 t  v  m

  40. * ?7 A/ L7 r: }+ z1 d  \
  41. #undef EDMA3_DEBUG. O1 Y9 T- r0 U: c- n
  42. /*#define EDMA3_DEBUG*/
    ' c2 _& v- [! E0 `' Q5 _

  43. 7 n+ j3 }4 `) c1 U
  44. #ifdef EDMA3_DEBUG* b+ A6 P/ Y% ?% Y' v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 S- x% Z2 P4 g* s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): q7 O+ z  H, T1 d; G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 X) T. T0 Z# h# `% i% c4 H2 f
  48. #else- b9 e1 a) p; b$ y9 \
  49. #define DMA_PRINTK( x... )
    $ M# k+ Q+ ^2 I; ]$ X3 o; L
  50. #define DMA_FN_IN
    ' `8 N6 \7 F0 I$ |
  51. #define DMA_FN_OUT
    ; `' }% g0 m# u
  52. #endif- J  i% \) H, @4 v

  53. 2 h3 v( |. D6 J2 k6 A& _4 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 |+ ^" U' f( @. C3 r- r3 c
  55. #define STATIC_SHIFT                3  \. H) @1 O: h8 Y$ q( j3 j
  56. #define TCINTEN_SHIFT               20
    ' |7 R. J: s3 T4 W6 L+ ~+ x
  57. #define ITCINTEN_SHIFT              21+ \: p  R4 d1 U  Q& }3 ]
  58. #define TCCHEN_SHIFT                22, U5 B  p$ c: j0 ~: |+ i9 c
  59. #define ITCCHEN_SHIFT               23
    & r! {5 Q3 x% K
  60. " @6 N$ D1 X) \) K  B  f
  61. static volatile int irqraised1 = 0;3 T) i# B$ f* `9 X
  62. static volatile int irqraised2 = 0;6 n( D2 E( m. }  G4 m
  63. 9 K3 Q, L4 n  D+ u9 S2 ^+ y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : P& M% X4 M1 o' Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! U! u( [" ?. \  _. u* }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- M, }$ t3 C& u2 Y

  67. * p% }! P  q. y5 r. ?! n
  68. dma_addr_t dmaphyssrc1 = 0;
    , i2 h1 a/ {2 }4 _& G$ X/ a
  69. dma_addr_t dmaphyssrc2 = 0;
    $ G3 R! H  L8 L5 C& F- X/ o
  70. dma_addr_t dmaphysdest1 = 0;
    2 s% l) T/ ^2 M( @( q7 M
  71. dma_addr_t dmaphysdest2 = 0;' y2 G1 ~7 \# V, E* _8 [9 n
  72. # z% C, F2 w2 E1 @' V
  73. char *dmabufsrc1 = NULL;
      Q1 `- S& M: \# z9 u$ Y
  74. char *dmabufsrc2 = NULL;7 c  |; K" ]8 |9 r# ~/ ~
  75. char *dmabufdest1 = NULL;! [, X6 b* b2 S+ T2 Z( u  q% S" L
  76. char *dmabufdest2 = NULL;) n" x: X" X0 z) M7 o+ ?

  77. & B3 J. M$ z- Z- }8 w
  78. static int acnt = 512;
    " ~; S% U$ G9 j
  79. static int bcnt = 8;5 i! q4 j, c9 A9 M, n) A
  80. static int ccnt = 8;0 Y7 d. |; P8 G5 g
  81. ) }2 m. L- E$ i2 g8 O* F
  82. module_param(acnt, int, S_IRUGO);
    2 V2 u" ~% y- a4 z) |* m# g5 p$ e
  83. module_param(bcnt, int, S_IRUGO);) I- d# T% L& Z$ _% o! M" |. K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. c; K' Y( g1 S! T" h/ }
8 P9 K  \- n1 f6 Y6 f2 W* a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 N* d& S/ d/ n" x6 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ P9 p4 K5 C0 ^8 r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& T+ z3 k! w2 B4 Z" P
5 ?; r; |/ j4 |. y: P: ?5 e' L+ U& a- N& |  `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 08:32 , Processed in 0.042963 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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