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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ C7 {0 |1 x9 ]3 U$ A7 O4 d3 n4 I
  1. [code]EDMA sample test application
    ' c4 e( ?1 x2 L. `3 i6 f& O. W- B
  2. /*
    + n6 |5 V: w4 i1 S$ I! y( p
  3. * edma_test.c
    & A8 e- O5 I! b9 ?
  4. *& N' Y1 G4 f0 H) _
  5. * brief  EDMA3 Test Application* F* ^0 g0 U/ f5 S
  6. *" z2 Z! t9 s3 l. F! I
  7. *   This file contains EDMA3 Test code.* J9 z3 N0 A4 w! ~# `1 ~; V7 o$ ?
  8. *
    5 ^% y" Q4 U4 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ T) ~, ^+ ~6 q# `. \' Z# D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) _. |' ]: I+ U
  11. *         TO CHANGE.# Y& v" ?/ i; A2 W; Q) v; n
  12. *$ C& I+ C; N- s: g) a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 E( D. e3 C+ r# G2 C6 v8 l* D8 E6 X( s
  14. *6 A# T  i# ~7 e+ L* l% E7 A
  15. * This program is free software; you can redistribute it and/or
    2 E5 N# s- f6 `8 O+ ]$ }
  16. * modify it under the terms of the GNU General Public License as
    % j( b  U* t4 j9 ]
  17. * published by the Free Software Foundation version 2.
    ' k$ q1 y  c6 M+ X( K0 x, X0 I/ R
  18. *' D1 y) v9 v+ s- P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 g2 j6 c2 R! n: G0 L5 A
  20. * kind, whether express or implied; without even the implied warranty
    # a1 Y/ _( [  E0 A  e* U& h. M0 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & M' B1 x( }" s, l
  22. * GNU General Public License for more details.+ R: W, C; s; F# S- }7 o
  23. */- O% \! Z+ K% t! B9 j
  24. 3 ~$ p" j; U5 `4 T
  25. #include <linux/module.h>' ~; K3 r; t( Z
  26. #include <linux/init.h>* ?9 c+ n2 ~& d" s5 R" H1 N! P
  27. #include <linux/errno.h>
    1 [. w: ?! c- P+ w
  28. #include <linux/types.h>8 W; e) z! Z8 j; i, c: w
  29. #include <linux/interrupt.h>7 l6 Z, x+ c4 {" a
  30. #include <asm/io.h>8 p' C( F! ]# ^( X0 Z
  31. #include <linux/moduleparam.h>
    5 G" g" I/ _* R/ }" g+ D6 K
  32. #include <linux/sysctl.h>
    * O; i4 R+ T( D$ `+ y
  33. #include <linux/mm.h>
    + w: q8 F; D2 g: a0 D
  34. #include <linux/dma-mapping.h>
    ) g, M& x/ g8 d; ^! I( W
  35. + @" j9 i. \, k' w
  36. #include <mach/memory.h>
      h, B2 b  j0 W, g" K; ?
  37. #include <mach/hardware.h>
    7 {/ q4 w' b' V: Z/ M2 a
  38. #include <mach/irqs.h>3 X" P; R1 O+ R4 Z
  39. #include <asm/hardware/edma.h>5 F8 G; ]( X0 K9 y8 O8 r

  40.   ~; \6 H$ D% u! Y
  41. #undef EDMA3_DEBUG
    ; i  Z8 ]: k/ n8 u
  42. /*#define EDMA3_DEBUG*/- W1 O  o6 x9 K
  43. . p: `- V9 p$ r6 C3 e$ L
  44. #ifdef EDMA3_DEBUG+ d% n# x( d) c. U6 R. v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 D  e* \% g3 Z0 Z6 {( ~* K% j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ E. ]( D, C& p$ R( \, f$ p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  h, o/ ?' [7 r% m- R( \9 h! P
  48. #else
    3 r4 T7 V4 I+ [' a. U; ?  s
  49. #define DMA_PRINTK( x... )" e0 Z8 E, r- f, S, L  a& c
  50. #define DMA_FN_IN
    2 o& M) `5 J" o0 [
  51. #define DMA_FN_OUT9 s  A. D5 V; _% Y8 A
  52. #endif8 b3 \: L0 i* H* y& z

  53. - @! L, R" g: C7 L  t: _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 `* d) E3 C& F; {( _9 s
  55. #define STATIC_SHIFT                31 S- M6 E; _' |6 V3 ~* R# ?
  56. #define TCINTEN_SHIFT               20
    + w- E. Y% p# M4 L+ ?
  57. #define ITCINTEN_SHIFT              21/ j9 k1 b5 N4 U- i# W
  58. #define TCCHEN_SHIFT                22
    5 d9 x( `# m9 ~5 m- N2 f0 [
  59. #define ITCCHEN_SHIFT               23
    ( N( a& g3 u0 s: w& q4 P0 Q3 g' H
  60. 5 t# ?- d. a9 q: s. x/ ^
  61. static volatile int irqraised1 = 0;+ N# K. {2 B! p" y& B
  62. static volatile int irqraised2 = 0;/ Y" t" |% p  f( m6 g. E

  63. $ P! a0 ^3 c5 T' L" v' g, G* s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ V0 @$ v  T, t5 f7 I0 Z$ e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) a7 F4 Z8 D( r- u) |. }6 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' q4 d' k$ `/ O3 z1 Q" I

  67. / V. ]% p% s" c+ t6 M
  68. dma_addr_t dmaphyssrc1 = 0;0 ?/ U1 D5 @( R$ J* a& R) R2 {6 M7 h
  69. dma_addr_t dmaphyssrc2 = 0;+ ?8 I: {. {0 R/ x/ m3 h& K5 g
  70. dma_addr_t dmaphysdest1 = 0;, v) F7 b/ ]1 D6 f# U, R1 B
  71. dma_addr_t dmaphysdest2 = 0;
    . ^" Q. \& S* m& \  h

  72. 1 R/ e. E0 n: I& k: R
  73. char *dmabufsrc1 = NULL;2 b1 L4 ^3 Z' F- R3 j0 d
  74. char *dmabufsrc2 = NULL;
    ! E  @4 M; U: A  d* U; G
  75. char *dmabufdest1 = NULL;' y9 K1 K7 e- N0 g4 }1 H# t/ U
  76. char *dmabufdest2 = NULL;
    ' g) k$ \4 E! G1 L  Z2 p

  77. " C" o0 {6 N4 y( h8 a& P
  78. static int acnt = 512;
    * ?$ L! ]' T( E" p
  79. static int bcnt = 8;
    / x# \6 L0 \2 V3 y$ t1 R
  80. static int ccnt = 8;8 n7 T: d7 G4 q5 {

  81. 9 z0 N- {# C' p% `( M/ f7 y
  82. module_param(acnt, int, S_IRUGO);
    , o# R# a2 H6 r' }0 T% L; f$ k" x
  83. module_param(bcnt, int, S_IRUGO);
    4 g; w6 }2 h0 @+ H% H# \; q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  t  t. _  i& c3 D8 R% i, U1 {
2 J- F- K# A6 I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 L& {! Z- P& E: U6 n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( B1 t3 X1 F: i# L6 G' B! S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 v4 ]* u+ U0 O+ t' O- D

2 |3 a+ o2 [7 @2 g: {. Q, j0 F4 U1 O% P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 13:53 , Processed in 0.040749 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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