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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: j: j2 D* E% M5 H& h4 ]; G
  1. [code]EDMA sample test application
    4 q8 F0 N; ?2 I* u6 Z: g
  2. /*' H- H" ^- W) ~0 q7 O
  3. * edma_test.c: P/ y& k3 |3 e% ?/ H4 q
  4. *
    3 e* Z7 y' N& u: H4 p4 y0 Z
  5. * brief  EDMA3 Test Application  e) U6 e  _, a1 e5 A7 g* P
  6. *
    % Y0 Q- _6 q  C" {  f* N7 L
  7. *   This file contains EDMA3 Test code.
    0 B9 E' G9 T  `
  8. *
    1 o- z6 u6 P' [9 e. {! N& s4 C4 \7 l4 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 Z1 w. G1 v2 y. R6 ^8 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      y4 d7 a4 {  c# G# e3 i
  11. *         TO CHANGE.
    ! q4 n0 n8 V3 }# E
  12. *9 ^9 T" `. V4 y2 M" j5 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 G+ _! G% t- G/ G* N: C$ W
  14. *
    3 I6 E) a; x) n9 ]/ Q, I; ]( i6 l
  15. * This program is free software; you can redistribute it and/or; ?$ j" ^; |6 }" {+ ?& P
  16. * modify it under the terms of the GNU General Public License as
    & g7 _" u! h9 l7 e" \
  17. * published by the Free Software Foundation version 2.! ^9 a: |, r; {& ]( y
  18. *+ w6 v$ W; s3 y- d! P1 y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # Z% E5 e6 y  O
  20. * kind, whether express or implied; without even the implied warranty2 F  B) N5 H  T# v( _8 l1 r( O2 w4 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      t# z( s3 Q1 k6 `1 v
  22. * GNU General Public License for more details., w! ]% w8 x+ v5 Q7 K! s1 @/ q
  23. */9 i- E1 a4 Y) Z+ h* ~
  24. % M4 V. B9 R& V
  25. #include <linux/module.h>6 r$ }& Z8 k( v$ W
  26. #include <linux/init.h>0 ]! P3 b# C* K, l+ b
  27. #include <linux/errno.h>) [# d4 a0 a# B
  28. #include <linux/types.h>
    , }8 o1 K% S5 p7 Q* t
  29. #include <linux/interrupt.h>+ S( w& O. |+ f" r7 L
  30. #include <asm/io.h>1 H4 B4 [5 K) i  f/ F  I2 G
  31. #include <linux/moduleparam.h>! A9 G7 p/ O; N
  32. #include <linux/sysctl.h>
    ; [7 _$ g: D: e  `
  33. #include <linux/mm.h>: s, M  d0 g/ @/ a* X
  34. #include <linux/dma-mapping.h>6 g5 D, V! X$ S" a* v3 F0 g3 |- S1 x

  35. 5 y# s8 q6 t5 A4 |
  36. #include <mach/memory.h>  @1 M5 i4 |# |
  37. #include <mach/hardware.h># K' e% w, e  I/ q! @; n) a: F
  38. #include <mach/irqs.h>+ o  j6 P: `0 o9 J+ Y# a) F/ M
  39. #include <asm/hardware/edma.h>1 M* v8 B- |" \) O7 o6 X& B' U( F' q

  40. ; {& b: y: Z! F" e
  41. #undef EDMA3_DEBUG
    - t0 ?4 f( O% x' G# R: I+ {
  42. /*#define EDMA3_DEBUG*/9 W8 w! @% G" r# x/ ^: Y

  43. 2 M8 e2 j4 x- \  j2 l$ X
  44. #ifdef EDMA3_DEBUG- E7 v1 ~6 b6 r  p1 M& u$ E: v4 }) c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ e, i# c, J. M( O) a) o1 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 r+ d" i" d/ v+ o: s2 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ }- f$ Y* O% x; R( b) L( O5 Z
  48. #else
    ; n7 U: x' P( ]* ~2 m7 `
  49. #define DMA_PRINTK( x... ): J; b# j! L: ]# a$ C! U) s# o
  50. #define DMA_FN_IN1 C& D( d- x. [" |3 }: ~" _
  51. #define DMA_FN_OUT
    # ^* l% ?. s9 ?- F* L4 f
  52. #endif
    # |* X  m- V9 x8 |7 H: N

  53. & b1 N6 @3 ]3 T/ r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): w- I$ }8 Q) l. G. i+ W1 c% @
  55. #define STATIC_SHIFT                37 N/ X0 y7 ]( J( N5 k0 A
  56. #define TCINTEN_SHIFT               20% ?/ i, _: j, c: P5 D8 z6 A* F
  57. #define ITCINTEN_SHIFT              21  z/ a3 _" P0 ~) W$ i4 S) ]
  58. #define TCCHEN_SHIFT                22
    / D( d' s3 r$ D& e+ ^+ K
  59. #define ITCCHEN_SHIFT               23! i+ k) M1 p& O+ X

  60. 0 n3 t# D1 {- |, |) R% I
  61. static volatile int irqraised1 = 0;
    + b# b! ^% M! W3 g+ v- M
  62. static volatile int irqraised2 = 0;
    8 j( \- ^5 N0 f9 ], x' g. |

  63. 4 V8 O. n  D& D, S9 X3 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 \) |( h5 n7 y6 o$ |+ X) ]# `& q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / A4 L4 D5 ~2 N+ T$ s6 H4 k. ~9 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & l6 M- Z) y' G+ y. H  j$ j9 ~7 T5 p- q

  67. ; y& m& l! j" D: ]# W$ m& @7 d: N
  68. dma_addr_t dmaphyssrc1 = 0;  Y; k# G- e- U; `( A+ j7 ~' C
  69. dma_addr_t dmaphyssrc2 = 0;" K  y& o. c% u8 H" V1 E5 _4 J/ p
  70. dma_addr_t dmaphysdest1 = 0;) s1 I: u4 P  F* g# L
  71. dma_addr_t dmaphysdest2 = 0;0 K- z+ L' y9 {% v9 K! j3 t9 J: ]

  72. 7 g/ P4 x; S2 F# g
  73. char *dmabufsrc1 = NULL;
      `8 }! u4 _6 t' {& G0 w. F7 L- ?! S
  74. char *dmabufsrc2 = NULL;
    1 U5 C. ^3 X; B8 ^9 b
  75. char *dmabufdest1 = NULL;: Q) Q( d0 S! K+ O' ]+ t
  76. char *dmabufdest2 = NULL;
    ' n( _5 ~1 x3 S" M' J9 _) U

  77. % _6 W3 H( w3 K4 a; X: N/ \# W
  78. static int acnt = 512;4 ~! F" j/ |# L/ z5 v7 {
  79. static int bcnt = 8;
    9 d; |$ B: y( z( [
  80. static int ccnt = 8;
    8 T6 s. E; o3 t; A
  81. % I( H9 P( e6 S/ s2 {8 K
  82. module_param(acnt, int, S_IRUGO);- A9 y" u: q2 A8 Q6 ^9 ^
  83. module_param(bcnt, int, S_IRUGO);( j4 R, y) |% q+ v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- i8 {* [1 [" w$ M+ |: u) q! i8 c
' G( }5 q0 q+ e( [/ \2 }0 z$ G3 ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- ?1 i8 Q" ?; T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 s) k* Z" R2 v% z% a2 t$ B6 q) u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) @' m# }9 {5 s- I9 |

+ d) u% [5 I" Z9 `) X2 A! B& H8 H& ~* T% }' M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 23:38 , Processed in 0.040559 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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