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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 d8 A  R  A5 _% r! N$ k
  1. [code]EDMA sample test application4 K# C# h2 E5 e; w' O# r  X
  2. /*! v/ s) v& U& x; `, u- P8 y
  3. * edma_test.c! h$ C4 b2 Q! T
  4. *
    8 U& Y- k% c1 a" ?$ c
  5. * brief  EDMA3 Test Application* e# Q* [) _$ z+ ]
  6. ** A* ~5 I- f5 V' q: s
  7. *   This file contains EDMA3 Test code.. F0 A4 x. g, f; g# r
  8. *
    7 v4 m/ c& c+ T: r' z( d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  O& v& d- k6 @( e6 z" ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + @' G& _* |( W
  11. *         TO CHANGE.
    . S; e$ N4 f6 X8 E+ Y9 p, S  u
  12. *" \/ h- Q0 g! {4 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ r( i! W2 E: L2 W
  14. *8 o4 Z2 {8 e; ^7 k. v
  15. * This program is free software; you can redistribute it and/or% \, H1 [6 o4 S" J2 W1 {
  16. * modify it under the terms of the GNU General Public License as- ]2 V3 H0 |3 S* w1 F+ Y
  17. * published by the Free Software Foundation version 2./ L' k; K' v3 l
  18. *
    1 q9 E5 _/ m& h6 ~8 J: ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) h) E5 j3 F( I! P8 t$ U. ^
  20. * kind, whether express or implied; without even the implied warranty# l' f4 F8 j3 |8 [7 E; @$ z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 S# ]2 J6 P( M* u3 W2 [2 ^
  22. * GNU General Public License for more details.2 a. S% e8 a6 c4 S
  23. */
    * u4 P' W: @" W. C
  24. " T5 v! B. c8 k# K! b: ?$ Z
  25. #include <linux/module.h>' ]2 T" W3 ?. N8 n) P
  26. #include <linux/init.h>1 k% O2 p0 w$ X  l' j4 V; u: S' w
  27. #include <linux/errno.h>. K: Z; t+ T/ L/ x
  28. #include <linux/types.h>* i  M3 |/ J& X2 ^0 n# W
  29. #include <linux/interrupt.h>! e  F) y" o; M: L
  30. #include <asm/io.h>
    * {( ]  q7 K3 M4 N  }% n
  31. #include <linux/moduleparam.h>8 n; D: U" z( l5 k9 o
  32. #include <linux/sysctl.h>+ G: D+ Y- G! P- {& @4 Y9 y" T
  33. #include <linux/mm.h>  |- \1 l: J3 k9 T% n* f# `' A
  34. #include <linux/dma-mapping.h>
    / e; w; ?# Y& @! z) ]( w
  35. , E' E* g3 {/ r8 d
  36. #include <mach/memory.h>
    . G: o1 {$ p- T" v
  37. #include <mach/hardware.h>
    : O$ [, M% E0 d0 K, ~5 o
  38. #include <mach/irqs.h>
    ) }% x* @2 ?7 t/ Y8 l
  39. #include <asm/hardware/edma.h>
    $ F' W9 _3 G$ `+ Q9 |( {

  40. 3 a- s7 P$ x# y: q8 A
  41. #undef EDMA3_DEBUG
    ) T$ {5 B( I$ @) @& {" R" l, [; P+ C
  42. /*#define EDMA3_DEBUG*/
    " {; ]$ {6 Q1 j' o8 U9 I8 ~
  43. ) C) H6 u# j6 [) b
  44. #ifdef EDMA3_DEBUG
    2 x7 s" ~0 Z8 E+ P! y) N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# q, l3 n/ n1 Y$ t7 \) l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). k) D' L7 q; i- m) I# G+ _* Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# b- v' B! d% p1 y# Y' s
  48. #else. t* x; o0 q3 o; E# c
  49. #define DMA_PRINTK( x... )
    5 U+ y# r6 p. J$ U1 [) y
  50. #define DMA_FN_IN. R1 |% }5 P! M$ }/ d& k) |* O
  51. #define DMA_FN_OUT
    # N# ]# L1 q, {
  52. #endif+ ]: C3 B- g0 s" L/ f
  53. 6 l4 u4 A7 m1 U) c" V# T6 A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 q0 a& D) ?' U7 @2 J$ g" x
  55. #define STATIC_SHIFT                3
    ( V( P3 d" z6 W+ Z
  56. #define TCINTEN_SHIFT               20
    ) a* y) B* Z3 n
  57. #define ITCINTEN_SHIFT              21& y$ d) b- R# y% P( z
  58. #define TCCHEN_SHIFT                22
    # M/ I9 Z0 R: [* b
  59. #define ITCCHEN_SHIFT               23
    , q" i. n" n, C% i  B/ e5 T, |

  60. / ~# q  q% V* O4 B: x' |
  61. static volatile int irqraised1 = 0;9 T5 G; c. i+ K! }. O
  62. static volatile int irqraised2 = 0;
    5 Q; z) w8 M  x7 O4 J% ?
  63. 0 z( Z0 G+ N9 E0 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 p' }. r) D$ a% W& c5 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 d  K- a2 k: g. i% o7 d7 S) {+ M7 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 E) z5 [# \! J; m& K
  67. 3 P$ Q1 m, r5 U" Z
  68. dma_addr_t dmaphyssrc1 = 0;1 l1 ?: [/ r! _" W+ k5 s9 L& x( w
  69. dma_addr_t dmaphyssrc2 = 0;8 _- I, G6 Y$ X; ^" ~$ s
  70. dma_addr_t dmaphysdest1 = 0;
    ! O' q( s) a$ |' v
  71. dma_addr_t dmaphysdest2 = 0;
    3 E# O' Y) b+ B5 H
  72. 6 F+ j2 H  D' b* r
  73. char *dmabufsrc1 = NULL;* f+ S6 B* O6 a% z/ R8 i; C# Q0 Z
  74. char *dmabufsrc2 = NULL;
    $ {9 z0 H; T8 b# F
  75. char *dmabufdest1 = NULL;
    $ G1 i4 E5 u" k" Q
  76. char *dmabufdest2 = NULL;5 T; k6 l& D7 \: Q  ^

  77. + r6 m3 N3 [" {  ]) t
  78. static int acnt = 512;8 T+ e# |! U' P; B6 K
  79. static int bcnt = 8;
    % c9 B( ~% [; o  O$ a; \
  80. static int ccnt = 8;5 U; ^; b. D- Q! q

  81. 9 i  Y5 |: j' T' c8 K$ ^5 E+ [
  82. module_param(acnt, int, S_IRUGO);1 g4 @. O% W  Y
  83. module_param(bcnt, int, S_IRUGO);
    ( j4 ]# G2 L) i: E* v5 `( _+ m2 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  y( G1 N; M- x5 _2 O2 m2 @: W0 q/ I' B6 U9 k; ?. s6 ~" Q" n1 \  `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* H* F7 t1 h9 U3 x/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 s  {) b2 G- f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 o: W4 g7 c3 ^! D" d- y' x7 K5 t6 i0 K0 J

: T# ~9 f3 ?2 L2 I% ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 14:56 , Processed in 0.037125 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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