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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 ^  o" [# R" f/ b( S2 g
  1. [code]EDMA sample test application8 x8 T8 y- q7 j3 h$ m
  2. /*& K: x' i  w- H: L' z7 G
  3. * edma_test.c9 H' v/ S/ r. `5 T5 j, c# f
  4. *+ W: B3 m6 F: v' s
  5. * brief  EDMA3 Test Application6 T( L0 D  T- g5 z
  6. *9 c" u% N, D/ O& [0 b/ `0 r7 m0 \5 ?: e
  7. *   This file contains EDMA3 Test code.8 w! y5 k# h+ I5 l# P0 S0 ?
  8. *
    % B& K0 u+ }" ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ e7 t8 Q5 I$ ]: }/ e, ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 u- H4 l# ^- z, p' `( Z
  11. *         TO CHANGE.8 p) W& m' s4 T3 R. u  \" \
  12. *3 [+ Z6 P' |8 x7 A4 y% E% \' C" ~# u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - X% V+ ]! E: q( ?# C& f* x) M, c
  14. *
    . ?' n) n2 `  P: _( G$ Q
  15. * This program is free software; you can redistribute it and/or
    & ~# g: G5 u$ R$ n* q, p5 Z
  16. * modify it under the terms of the GNU General Public License as
    4 B- w4 C! A  v3 z: [6 t* r
  17. * published by the Free Software Foundation version 2.. w2 V# ]2 |8 y  ]2 M# H' q' M
  18. *
    5 H/ S( E) x  E* G8 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( b0 x1 p% h* l2 z+ d
  20. * kind, whether express or implied; without even the implied warranty/ P: i& Q6 K, x" n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; c" H9 G6 U, _& \
  22. * GNU General Public License for more details.7 l: L2 Y3 j! h/ j
  23. */7 x% d  Y; j. \/ N2 [

  24. 6 J& m' i% m7 y0 W
  25. #include <linux/module.h>' x# q9 H; c0 O3 ]: P2 c
  26. #include <linux/init.h>6 u( w# X1 W" s) B4 K  ~
  27. #include <linux/errno.h>
    5 G* g( `, f) z. k  a
  28. #include <linux/types.h>
    4 t  a4 J9 V, ^8 Z' o' ^
  29. #include <linux/interrupt.h>5 p) r; Q! ], G: p4 Y
  30. #include <asm/io.h>
    / l. w* L6 M0 N; d
  31. #include <linux/moduleparam.h>
    % F# P. S! X8 ^  o" r
  32. #include <linux/sysctl.h>
    0 p" R$ x1 y- k  s- v
  33. #include <linux/mm.h>- u2 T/ B# ]$ Z
  34. #include <linux/dma-mapping.h>
    - ~' w+ l& B9 K

  35. , M4 w& ~7 B+ }6 s- s' X
  36. #include <mach/memory.h>
    3 t. a* s2 v" ^- h: L; ~
  37. #include <mach/hardware.h>0 p$ ^+ b* O& Y( k
  38. #include <mach/irqs.h>
    4 U& G! Y: r# U, N
  39. #include <asm/hardware/edma.h>
    % Z4 M' X; [. x) N& n8 ?
  40. $ J. q) }, l9 }, z& C; n" H# a
  41. #undef EDMA3_DEBUG
    $ z6 K% W: C9 m9 e
  42. /*#define EDMA3_DEBUG*/
    + d& ?& p- Z5 S8 Z3 p
  43. ( x% o3 q7 A  e6 F
  44. #ifdef EDMA3_DEBUG
    * P+ f1 E5 P' B5 ]0 ?7 U  e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : R- Z$ N. q% b4 ]5 X( Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* [% @! j' e' r' k4 \7 Z5 G2 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) i- k# c1 M* N. e0 B
  48. #else
    ) b# F& }( t# a( e$ M$ F. N" O
  49. #define DMA_PRINTK( x... )
    + F+ g+ t; E) T3 f
  50. #define DMA_FN_IN% u( e: e* g6 G; e7 |3 w; d- L
  51. #define DMA_FN_OUT
    , J4 B1 f8 w) W/ f( m
  52. #endif
    , }" z- M. W" ~* E, [
  53. " H9 ~/ l# P; P6 j% z, k5 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & O9 p4 I0 S! ~( Y8 ^
  55. #define STATIC_SHIFT                3
    & Q. Z1 P7 I3 h; u! ?
  56. #define TCINTEN_SHIFT               20
    0 ]- b# _; h% j3 x
  57. #define ITCINTEN_SHIFT              21/ k: o& }. T* l
  58. #define TCCHEN_SHIFT                22
    # ^5 \- k8 a! G& s7 K
  59. #define ITCCHEN_SHIFT               23
    & i5 G" u3 f) A

  60. / O5 w0 R6 [+ t% V4 ~# l* Q5 K
  61. static volatile int irqraised1 = 0;
      D- U- c, j" ]  E" [4 G* e
  62. static volatile int irqraised2 = 0;
    4 s5 a9 _7 d6 ~; x1 C7 k  i

  63. ! r6 \9 z1 h) }6 `8 t1 }1 X# w9 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: R1 ]1 x& _3 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 T+ b2 K+ Q: J: t1 ~; t9 P2 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 l  z$ M- K' g, V6 K

  67. 5 c5 e% r. D+ R6 \, N; Y* c! p
  68. dma_addr_t dmaphyssrc1 = 0;
    2 \9 R. G) z% d! N2 K- }- H4 Q2 C
  69. dma_addr_t dmaphyssrc2 = 0;
    - W7 P7 C, ?- I- V. j
  70. dma_addr_t dmaphysdest1 = 0;$ N. H9 n9 A. e0 I
  71. dma_addr_t dmaphysdest2 = 0;
    5 {  h& a+ L5 o- h/ i/ T
  72. / P/ x9 K; ^% P- y0 J. v) t
  73. char *dmabufsrc1 = NULL;- T  A' Q" T- Q2 d& m
  74. char *dmabufsrc2 = NULL;
    3 l; S% s  _* Q
  75. char *dmabufdest1 = NULL;5 f/ E* O$ ~. }& B9 p* X  s, |: Z
  76. char *dmabufdest2 = NULL;
    1 O0 N! F. A& s+ U! g3 h8 `4 s

  77. + k8 H2 F1 Z/ }3 F% c! u
  78. static int acnt = 512;9 F$ z# C+ e& [. u
  79. static int bcnt = 8;
    6 E5 |3 o$ [# H% d/ z) W
  80. static int ccnt = 8;
    & h1 A: H! p9 r5 J1 O" z, \

  81. ' g; D, @# O) G) b/ ~
  82. module_param(acnt, int, S_IRUGO);
    ( r* f8 U6 |5 R
  83. module_param(bcnt, int, S_IRUGO);. C/ Z# a. i# u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 U5 C5 x1 e5 Q5 J5 w* Q0 R9 Q& P6 r5 z  Q  a) A9 L& N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: r; M$ h: q$ s) \' q4 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 E/ V+ T& N+ h1 S% A7 Z- \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 N; e+ H; R  p, m+ u3 c
2 r6 u- G$ d9 N; v! p' J; P
) b( L3 r2 l/ ~: Z5 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 12:23 , Processed in 0.041145 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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