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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . X1 ~+ x1 S  x/ {. e0 J  ^7 G3 K
  1. [code]EDMA sample test application' |' u! R) p) Z/ N: h4 A; s
  2. /*- \2 S7 i  ^" V, |; M
  3. * edma_test.c
    # s" P5 C# _1 |; ^# J/ U" {
  4. *
    ( ^  k6 K6 o$ t6 y( y" v
  5. * brief  EDMA3 Test Application
    * S* @; I* D5 p7 q3 Q
  6. *
    4 A* `! K- m1 K+ V9 }5 o) ]" ?( |+ [
  7. *   This file contains EDMA3 Test code.
    4 s# c& Y' }4 S) ^& X8 L( e
  8. *4 \7 g# p" `+ U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& ~5 u6 k2 a6 o" }, r# l4 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 K% o" Q: o3 \& e
  11. *         TO CHANGE.
    & j- {! G6 J; ]' @, D
  12. *
    0 y4 a. n2 o5 s3 w0 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 f7 y% K# j9 P( r" s' j* G
  14. *4 B" q& I9 F; t5 n/ Q# L2 b
  15. * This program is free software; you can redistribute it and/or: |) R2 S3 ^- t' i+ A4 J1 k; G
  16. * modify it under the terms of the GNU General Public License as% J5 K2 ~5 f2 D& q& J/ k
  17. * published by the Free Software Foundation version 2.' i1 v' w, ~# J* r* |
  18. *+ L' b; N& x. y) T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; x# P3 c* K- n# w9 u! X, S
  20. * kind, whether express or implied; without even the implied warranty
    / w* n5 G6 F; T/ Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & w9 U5 c. G& p, [
  22. * GNU General Public License for more details.7 t; [5 [+ J3 n9 A4 G6 G: E& S; Z
  23. */+ d; S, r+ t4 Z4 ~$ F- z* o- f
  24. $ Z: M$ D3 R6 F, u! F7 E/ }1 A  \
  25. #include <linux/module.h>6 O4 [9 \4 t7 Q4 a& P, a" d) }
  26. #include <linux/init.h>. _+ \2 v/ u  N- P8 n' m# v4 a& e% }
  27. #include <linux/errno.h>
    0 z& R; I3 [6 g- `$ V5 k
  28. #include <linux/types.h>
    " N) Q( c3 W$ u1 ]
  29. #include <linux/interrupt.h>
    : o; N6 H/ c  }' U; C
  30. #include <asm/io.h>
    " n. O; _! h5 Z9 \3 L. i
  31. #include <linux/moduleparam.h>
    6 W; P( ^9 ~9 T0 s* Q9 r
  32. #include <linux/sysctl.h>; ]) Y8 G0 C( S* R# Q
  33. #include <linux/mm.h>- j5 m2 `+ s% }' x- d
  34. #include <linux/dma-mapping.h>
    ! ~7 n; p/ K; _- d" T. x
  35. 7 C2 E6 y" z5 |, r
  36. #include <mach/memory.h>" u7 L7 I5 W$ |& L% _
  37. #include <mach/hardware.h>& A; _% s$ ]3 n0 Y* k0 x
  38. #include <mach/irqs.h>' ]& \* ~8 `$ ?6 e9 L7 B
  39. #include <asm/hardware/edma.h>* X( h% m+ i8 f' P, m3 x

  40. " z. z, l+ F8 J
  41. #undef EDMA3_DEBUG$ e+ T! r, C. B3 y% z. L
  42. /*#define EDMA3_DEBUG*/
    9 v* a5 @: i9 \% z

  43. & X; w9 x4 g/ G. B4 }" A) [
  44. #ifdef EDMA3_DEBUG# c5 m5 T0 Y- a( O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 r% k! ], Z' t. D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # o/ N9 O& I% A4 G6 }3 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ _* @, g( R* @
  48. #else
      m+ z6 l; \; ?  Z) b
  49. #define DMA_PRINTK( x... )
    # r# k7 p+ p6 v7 E! A+ s' Y
  50. #define DMA_FN_IN& \; p+ c; t' q+ [! {$ s1 K" N  C) Y# q
  51. #define DMA_FN_OUT7 Q7 B7 a, P9 A! z5 n3 X1 T
  52. #endif+ N8 i! ^! J2 L% U

  53. 9 J$ _/ }* ]/ u/ R, W+ u( ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 q4 l1 r8 o* _" j' j
  55. #define STATIC_SHIFT                38 h% `: ?# g- J$ M& m/ s
  56. #define TCINTEN_SHIFT               20
    " u, }0 E) s2 i# Q
  57. #define ITCINTEN_SHIFT              21! O7 O( O' a  |1 s4 Y8 |
  58. #define TCCHEN_SHIFT                22' @/ z( d6 N) y. z
  59. #define ITCCHEN_SHIFT               23
      N6 q: X' B1 ~/ g3 V
  60. ; Z$ ]2 q; i/ h' a) f
  61. static volatile int irqraised1 = 0;5 c) [0 a$ W0 p
  62. static volatile int irqraised2 = 0;
    # H* E/ Y5 O9 F9 W* A
  63. . I4 X% v! |. H: u) Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 n0 p, N  h) B/ c; P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  @, u+ |- h; F: P1 @3 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / \% @# u7 B+ A% X' N- f

  67. 9 M3 ?4 H: L6 z* R/ r  L/ @5 p9 ~
  68. dma_addr_t dmaphyssrc1 = 0;+ ^; i0 J7 H( I: [3 u
  69. dma_addr_t dmaphyssrc2 = 0;
    3 `1 j6 A4 d' f. p5 r+ \% x& ]
  70. dma_addr_t dmaphysdest1 = 0;
    8 a2 p, D- A/ P$ G3 `+ i/ K# E
  71. dma_addr_t dmaphysdest2 = 0;; `3 Q7 K: V2 `& P( Y9 p/ v' }' @

  72. . x" }, |' b' S, r( _
  73. char *dmabufsrc1 = NULL;- D1 g2 ]4 v; l# J8 |1 g
  74. char *dmabufsrc2 = NULL;7 C& A9 G3 W0 C2 a0 [( T5 J
  75. char *dmabufdest1 = NULL;
    % b; D! \0 j3 R* ^+ M  b8 O6 d
  76. char *dmabufdest2 = NULL;& Q/ `2 L, T+ z  Y- ?/ [! d1 t' r( C
  77. $ s, s5 ~6 J- Z- w3 r* L
  78. static int acnt = 512;" r$ s7 u: p- ^" k. P" t  [
  79. static int bcnt = 8;
    , {' y! e* r5 [# e: E/ @4 }/ a* E- S8 q
  80. static int ccnt = 8;
    9 ~+ h, X9 K! M% g* @9 z1 m
  81. / t" C  T: X* s: S! R3 q
  82. module_param(acnt, int, S_IRUGO);
    2 W) c* A- g" o
  83. module_param(bcnt, int, S_IRUGO);
    9 x9 ]: ^% q0 R% E5 J: c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 x4 L( V% ?8 _& z1 X: f% [) g0 E
( t# q$ ^+ m% I+ \0 T# }- s: t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* N  ^1 r. p4 L6 l7 Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) n6 o2 z7 P/ _. Z1 G/ L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ H/ ?4 n& @( a: a0 r
9 r2 |* P1 N2 v. W' ~# K3 u  z+ c7 j+ _! u9 Q) D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 02:50 , Processed in 0.041187 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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