OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% o- `# X  T3 M* B
  1. [code]EDMA sample test application
    ' ]5 F" q: K* a1 y7 h5 Z
  2. /*
    $ ?( h$ N& c+ {# w& X
  3. * edma_test.c
    - m5 e  T! v  H
  4. *
    % |2 c; P7 ?. P$ v- O
  5. * brief  EDMA3 Test Application' g. Y) k, A; K* a6 Q/ g: [
  6. */ }3 h' @9 O7 K
  7. *   This file contains EDMA3 Test code.
    * x0 u' a6 `/ y% v# h) z8 s1 W, x+ v  ]
  8. *! A9 F9 U' Z  T; S) L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % M; s9 S3 b# a" Z3 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. B$ [" p* {3 a8 L% k7 T
  11. *         TO CHANGE." b) O/ X8 l* [* ]. V( a
  12. *2 O! j# o$ [' r3 A9 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 u9 F. H  x7 ]7 `
  14. *4 R& N, C' q% r1 u/ R. @
  15. * This program is free software; you can redistribute it and/or+ B' W  y8 {4 H5 \
  16. * modify it under the terms of the GNU General Public License as% g. V# e$ p4 M0 j
  17. * published by the Free Software Foundation version 2.2 T- }1 F; b$ ^* N7 {7 _6 a
  18. *
    % d8 A, [  O3 v, S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! {& V8 _) s) G; _/ M7 ^
  20. * kind, whether express or implied; without even the implied warranty5 s$ o& Z) j* ?: U" @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& v+ A1 w& |- i9 v. {" g* h
  22. * GNU General Public License for more details.
    9 E% @0 \/ {  Q$ G. J
  23. */
    & v( a! [' j" o. B) o+ l
  24. ' Y' h! v& O1 K- e* Z* r! p8 c
  25. #include <linux/module.h>1 x- W, y, T" n3 T6 O
  26. #include <linux/init.h>( F# S0 _3 p0 z# }5 ~+ @2 ~
  27. #include <linux/errno.h>
    4 P$ z% R3 e. b, ?# D1 P& L6 \  T
  28. #include <linux/types.h>
    0 C" `" ^6 l: B# L& D
  29. #include <linux/interrupt.h>  w) w- P/ b" f( C
  30. #include <asm/io.h>
    " b4 r  M+ k2 A7 j
  31. #include <linux/moduleparam.h>: e: }4 N$ K7 T! ^5 o+ U" m
  32. #include <linux/sysctl.h>
    4 `# x5 H& i7 f8 [$ z  u& H' i
  33. #include <linux/mm.h>
    0 U: ^9 P% d% {9 G) x( _
  34. #include <linux/dma-mapping.h>- T' c. o- L# w- H% c, M/ n

  35. ' d$ k. x9 B  x3 g& M/ p; f( V
  36. #include <mach/memory.h>4 l) a! x2 |7 l5 r
  37. #include <mach/hardware.h>2 e( [* V+ Z2 O% c" `6 z. ^
  38. #include <mach/irqs.h>2 t' b5 }9 }/ M, M0 a
  39. #include <asm/hardware/edma.h>
    0 q# z- W0 o8 X. k

  40. " {2 R2 n; m& S- ^6 R
  41. #undef EDMA3_DEBUG
    $ T# n1 B. `, y, l
  42. /*#define EDMA3_DEBUG*/
    3 s% U! n- A! J1 _+ }3 `: S

  43. + j( J  }$ |- `& ]
  44. #ifdef EDMA3_DEBUG0 v! _+ f) O& r. G# n% u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 }( X+ J* l8 T  V1 L" H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & S* \8 |% m# O5 H( b5 D% ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 a7 R0 s, y! t* e: C; l; ~
  48. #else/ l( n3 V3 M( T6 U9 ~
  49. #define DMA_PRINTK( x... )
    2 Z( v# ^4 }, y" ?
  50. #define DMA_FN_IN
    : C  q5 E4 z" G; X4 x
  51. #define DMA_FN_OUT
    ; G6 I/ e; E8 _+ m8 m% b( q
  52. #endif
    , C& l2 l* I) F

  53. 3 v/ H, ^- d% L, ?' K. h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 g9 ^/ x0 g. ~" q" P; e8 _1 G
  55. #define STATIC_SHIFT                30 A4 C. q, h5 @. Y5 j+ D
  56. #define TCINTEN_SHIFT               20
    1 w- x0 g" T6 V
  57. #define ITCINTEN_SHIFT              21
    : v% Y, k4 A4 V9 Z! t0 k8 \
  58. #define TCCHEN_SHIFT                22+ ]3 ~+ p1 d  O1 o4 q
  59. #define ITCCHEN_SHIFT               23
    ! H4 M" F* p( r( ?# ]9 X7 o# P" N
  60. / l& Q- t; ~( q) [
  61. static volatile int irqraised1 = 0;
    , M; e: _1 o. ?" q9 I( E4 P/ A
  62. static volatile int irqraised2 = 0;: _& \1 T: J) [; c6 L, O/ a

  63. . B! F5 B( ^/ x' P. V$ x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 x9 i) b- r3 `7 p9 j. Y6 V4 W0 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 m' \0 O% g" ^4 x2 O0 y% c# j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( S& Z) E& N& ^) v# j

  67. ) ~: I- [1 q  Q$ a% |
  68. dma_addr_t dmaphyssrc1 = 0;
    & r/ S6 h( e4 @! J0 `( P4 }3 F6 A+ Z
  69. dma_addr_t dmaphyssrc2 = 0;8 ]0 G* _9 c+ |+ b7 I( ?& W1 g/ ]- g
  70. dma_addr_t dmaphysdest1 = 0;" q2 A9 N/ {! d% d4 t' m
  71. dma_addr_t dmaphysdest2 = 0;$ C& a, O( h* F- L, d$ U: d, i

  72. $ P* h% Z6 u1 O" |5 {5 _
  73. char *dmabufsrc1 = NULL;8 q& I, \$ ]0 a' p/ E% h" c8 q+ \
  74. char *dmabufsrc2 = NULL;/ @0 ~! ?  V9 ]. f; q' _
  75. char *dmabufdest1 = NULL;  O. F) q9 n; g0 M( a3 k
  76. char *dmabufdest2 = NULL;
    0 p* L) V+ _& J. U
  77. $ ^# Y0 a1 P- c: l) Y! R
  78. static int acnt = 512;
    # }' x) S/ n: C0 p& `# L- p: I
  79. static int bcnt = 8;
    / z; x; S( Z- P6 }1 u7 ^
  80. static int ccnt = 8;  {* J4 V1 ]( D" h) H- a

  81. 2 ^6 X9 o& q% Y
  82. module_param(acnt, int, S_IRUGO);
    - v) E; t+ G* C' |
  83. module_param(bcnt, int, S_IRUGO);' k8 t* ]9 u7 E3 C, y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# A, _+ w- N+ {/ _) H9 y
5 E" a9 k0 m5 }( a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 W5 P- `7 I1 W  h; J7 G5 I) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! V9 Z0 ~5 T& c% S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ I! C- r. \) @+ j" h8 u  P
; i+ r6 r$ g2 ?2 @" V; a5 P& \8 q
9 k0 T! o$ o: Z  c1 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 10:11 , Processed in 0.038450 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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