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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 a" j: M! m9 i6 \) s" W
  1. [code]EDMA sample test application
    / ?: Q1 K- m: v. E  A7 p
  2. /*+ C! m/ \3 X: G7 s" r
  3. * edma_test.c' D- X) c2 [3 _5 G
  4. *  v0 P! E& j( z0 b+ G, C
  5. * brief  EDMA3 Test Application! o0 C! M1 j5 J1 h; S+ Y; {
  6. *
    - ]: Y! Y& V$ S2 m0 U- f
  7. *   This file contains EDMA3 Test code.4 m! @( ?" y' `/ w# G: x
  8. *1 C5 c- W8 ~8 ~7 ?. r% @( M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 {  A! z+ l4 q- n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & j' E0 m8 c* c' H! x7 Z( s
  11. *         TO CHANGE.
    7 \" Q  c+ A  @, Q
  12. *
    $ u: X- x8 x( S) K" ~, U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 A' n) V7 R( R7 r( c
  14. *
      I' q; U- c" I  @& L4 f
  15. * This program is free software; you can redistribute it and/or
    - P9 C* ~3 C, {6 R- H2 z+ p
  16. * modify it under the terms of the GNU General Public License as
    2 u' K% n5 b, r( ?) F. p
  17. * published by the Free Software Foundation version 2.
    0 e, ?) ~5 q6 P0 T
  18. *
    / P0 e! |: Y& k  [% k+ i! m2 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- l% ?- j3 U# E  B  d  ^" i
  20. * kind, whether express or implied; without even the implied warranty
    * V1 g9 l* J' u! H/ u2 X2 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" z$ @( @/ D. E' v/ K
  22. * GNU General Public License for more details.
    6 B# M/ ?0 b! L7 y/ ?; {) D
  23. */
    1 z' h1 f) B% Z& T0 y% G& k  p
  24. . P% Q- f1 J9 w3 g
  25. #include <linux/module.h>
    ( C- `# t' S! u: v+ M; J9 L3 ?+ U
  26. #include <linux/init.h>, c' j9 n0 ^1 @3 |/ t
  27. #include <linux/errno.h>) Q  r  a8 H: X; p/ `
  28. #include <linux/types.h>
    ; @4 T5 n# S/ ~) W% l' f
  29. #include <linux/interrupt.h>
    6 {, U6 \* A5 M/ P4 [& S
  30. #include <asm/io.h>4 w$ ^, T+ {' |5 G3 Q
  31. #include <linux/moduleparam.h>4 |) t5 C! u- O! ^& S
  32. #include <linux/sysctl.h>
    8 [; A/ m8 d. h  j' Y
  33. #include <linux/mm.h>
    8 Y) n: ^0 a6 W- _4 C+ X2 c; \
  34. #include <linux/dma-mapping.h>4 h0 W; ?  G' ~/ G! g

  35. 5 i# k& T3 Y. |( T! j" H) Z: o
  36. #include <mach/memory.h>! @* q& ]/ t+ A9 q
  37. #include <mach/hardware.h>
    / o- ^) e7 i! j5 E
  38. #include <mach/irqs.h>
    $ F7 k0 ], r9 P: l
  39. #include <asm/hardware/edma.h># z5 }! @7 B. C

  40. * L( I( R0 y& Z) s+ h9 }
  41. #undef EDMA3_DEBUG+ z) a) r6 T& \  [/ ?
  42. /*#define EDMA3_DEBUG*/
    + P% }+ k6 b. @7 w" `7 x

  43. 3 p% [7 {+ H4 x  Q$ u9 r
  44. #ifdef EDMA3_DEBUG1 u: M) v+ Y/ `* K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 l) @( o/ r  I  U( s- x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * S3 _+ K! c3 w. Y) L2 S$ B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 E+ r9 B% i! U) c- I1 P1 ]! l
  48. #else$ J. a) }) F! h$ M0 `( Y
  49. #define DMA_PRINTK( x... )
    ' y& G( s* ]$ q5 s
  50. #define DMA_FN_IN
    " N) _0 F+ e: X* j: {# f
  51. #define DMA_FN_OUT3 f) W. C4 j0 w4 v( s- e! a0 m
  52. #endif9 B2 d: E- \9 |
  53. 3 ~  ~0 |& j  V7 j0 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): u1 e: l' Q  V, t+ h- X3 U8 t
  55. #define STATIC_SHIFT                3" X7 y% O# o  h* z& K; D
  56. #define TCINTEN_SHIFT               20& F' b3 _9 S; S0 b( X8 a  \3 w
  57. #define ITCINTEN_SHIFT              21
    # k) h+ k/ c$ ?4 X2 j
  58. #define TCCHEN_SHIFT                223 i5 U' m7 b% R, E' G
  59. #define ITCCHEN_SHIFT               23
    ! W( u8 F" p; ^# e3 L( D* H! j

  60.   k: t) I9 u9 c: H; \; r
  61. static volatile int irqraised1 = 0;: y# K1 S  n# e  }4 W2 \( {- Z7 c
  62. static volatile int irqraised2 = 0;0 V& `- N) e( [# a" a: s; M& N
  63. $ V8 j% Y) \4 o; g7 L. j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! g8 e5 j. L" g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / r! p: ^8 b' _$ Q9 K. c5 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ?2 E* R1 n: d5 L2 P
  67. : \' D+ V/ G/ c9 \: a& N- [
  68. dma_addr_t dmaphyssrc1 = 0;
    . n6 U* f1 C! ^6 q
  69. dma_addr_t dmaphyssrc2 = 0;
    7 l. ^7 {4 x( H2 N1 R
  70. dma_addr_t dmaphysdest1 = 0;" U' K7 W2 S6 ~: V3 m# x
  71. dma_addr_t dmaphysdest2 = 0;
    - l7 i( s, p) {2 |5 t0 n- I0 w7 [$ n
  72. 2 d2 w: R# ~4 `; |
  73. char *dmabufsrc1 = NULL;
    0 Z+ I3 ?4 d% B# G6 a5 E
  74. char *dmabufsrc2 = NULL;
    ! y" A5 ~" ~( y
  75. char *dmabufdest1 = NULL;
    # M) A  n$ ?" |3 A
  76. char *dmabufdest2 = NULL;
    3 e' |+ q0 c6 c# X
  77. 0 X) ?+ l) O; d* h+ t
  78. static int acnt = 512;
    . E0 }" J* i0 _
  79. static int bcnt = 8;* ]2 B! a+ y9 Y0 K1 R8 Y
  80. static int ccnt = 8;" p( }  f6 ~9 f7 t/ d# A  F
  81. ! i/ d- q& _9 U+ z
  82. module_param(acnt, int, S_IRUGO);
    . ]. z' l; |/ o
  83. module_param(bcnt, int, S_IRUGO);1 j  C4 m  c# d8 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# ]$ K3 I. }4 K1 U
$ v! g$ S: O( N0 l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 Z' T0 y8 I5 g4 \& x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, n- S- t7 ^, X; D" H% J) O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 v- e& |3 b& {. f4 L9 i+ X$ f
# R3 M: j' U* G; i$ |8 P
! h+ g, U$ o5 z, K& l9 u! [3 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 03:01 , Processed in 0.040213 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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