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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : b# Q- K8 Y3 Y
  1. [code]EDMA sample test application
    6 G/ _9 O# U) b8 I; x
  2. /*
    1 N8 s; `6 z1 p" q' k, [! O! X
  3. * edma_test.c
    ( W! g+ x/ `) s/ L' O6 p4 ~( L
  4. *
    + Y& l& Q3 x4 e* @" s8 @# N
  5. * brief  EDMA3 Test Application
    " d) x% i/ u7 M# y3 U5 _- X
  6. *
    # X  _" X& j3 o4 }. i8 g
  7. *   This file contains EDMA3 Test code.
    ) M1 s3 t4 e) f$ O+ e! _4 D
  8. *
    . o2 x& u2 b4 f8 Y; b+ x; ]* a  ?$ x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! O6 b2 T% U, T2 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ Z- W- G7 S7 U- i; P* A
  11. *         TO CHANGE.8 T6 w' m) X9 |" G9 @
  12. *
    " d' z- h% \1 r0 }5 _: B( p/ o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( j: C, Q- U* z% G" p& k5 }4 a; |
  14. *
    1 G, F, l# U4 v. c. v+ C4 ]8 ]
  15. * This program is free software; you can redistribute it and/or: \# z2 p- p# ~: X% s8 R
  16. * modify it under the terms of the GNU General Public License as
    / {- A& @; I) K+ d) f
  17. * published by the Free Software Foundation version 2.. f6 _3 f- z. B. S2 K* D( y  Z" J
  18. *
    ; J" q: d, N  d" H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : V% b( q6 l0 y0 K) i! k( _
  20. * kind, whether express or implied; without even the implied warranty% Y$ s0 P( b8 P  A# q' R8 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 e; E3 X3 M+ u7 P; V7 X0 {+ |
  22. * GNU General Public License for more details.& B/ P9 M- I5 h+ i
  23. */
    + R. E2 ~1 Z9 H. A

  24. 8 G7 l1 G2 W% Y2 h& F
  25. #include <linux/module.h># O& ?9 f9 S+ o; F
  26. #include <linux/init.h>- C9 O4 e) j9 G% e
  27. #include <linux/errno.h>. o2 E3 U/ @% G- @+ h0 B
  28. #include <linux/types.h>. O; [3 F- \/ P+ k! W
  29. #include <linux/interrupt.h>
    6 s. u* s$ ?$ O; K- y+ K$ u  ]
  30. #include <asm/io.h>
    - `0 z) [# ]6 O; D
  31. #include <linux/moduleparam.h>' R, n+ U; D' E9 B. [) d
  32. #include <linux/sysctl.h>3 s8 f/ S2 P& u% b( S/ E
  33. #include <linux/mm.h>! U6 W5 v! x9 C9 [4 P* O' L: m+ D) b
  34. #include <linux/dma-mapping.h>1 \6 p: y# a- D- ~" h: I- S

  35. # c6 }. q6 ~8 z- N* t. H1 Q1 |
  36. #include <mach/memory.h>
    ' C. `! X8 S  @4 |; [- [) s
  37. #include <mach/hardware.h>
    ; Y' w1 l- x/ v7 X
  38. #include <mach/irqs.h>2 M+ Y  W& Z) X/ C5 r% }; p
  39. #include <asm/hardware/edma.h>8 c% R- Y4 C2 s% u2 }( Z
  40. # J( i+ W: ~! u$ E# r5 A# Y
  41. #undef EDMA3_DEBUG. O4 q( l6 ?# c5 q6 G7 }
  42. /*#define EDMA3_DEBUG*/& W& Y4 w5 u+ L# t. M

  43. " p% C* t5 m9 n* z! i2 ]7 c1 [8 \
  44. #ifdef EDMA3_DEBUG9 A  D; |2 [4 c/ m5 W. }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): D* Z; y9 k& x& n% S7 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# L6 D9 `$ r% Y+ _/ e8 a6 d; S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " ]# F  T" E; h7 U
  48. #else7 O' r+ L; s  E- K
  49. #define DMA_PRINTK( x... )
    % E+ ?$ A3 Z1 s; q" I% k
  50. #define DMA_FN_IN
    . s5 C' T/ c' k9 D( I
  51. #define DMA_FN_OUT
    # I: e/ V. C2 C+ ]* Q+ t4 b
  52. #endif
    1 I5 t4 c) R/ C5 Q8 R! Z/ T3 W* j
  53. 9 m9 d' N6 r( u4 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ P6 T% o1 l& j& U  o  [
  55. #define STATIC_SHIFT                37 ^/ r$ A+ ?% U  p5 B( }7 j
  56. #define TCINTEN_SHIFT               20& h$ \- S) L5 A. @9 G* r
  57. #define ITCINTEN_SHIFT              21
    0 ]; ~9 `# E, b8 L
  58. #define TCCHEN_SHIFT                223 u: c$ |+ B; T, ^& N
  59. #define ITCCHEN_SHIFT               23
    3 b( V, b- E( Q+ c+ e  i* m7 W

  60. * m- j+ V" @+ [: r: o. A
  61. static volatile int irqraised1 = 0;$ n+ k0 r; X* b( K& ^; X3 V
  62. static volatile int irqraised2 = 0;9 W9 k4 X, {. z: @: j3 P

  63. * `' x* D! e* ~: b/ J$ H/ v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 N7 f7 Z3 v$ a) Y( x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 s4 S/ X, n' {) ~0 F8 ?8 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 k: m% x5 H- P$ V' P* s# p
  67. 9 k. W* K, o2 N8 B' U
  68. dma_addr_t dmaphyssrc1 = 0;
    , Q4 r* x7 Y9 H% L: Z- K
  69. dma_addr_t dmaphyssrc2 = 0;1 S" F* b6 t# s% ~
  70. dma_addr_t dmaphysdest1 = 0;
    ' J1 e( q1 H  @; l+ {. c2 C1 ]) {
  71. dma_addr_t dmaphysdest2 = 0;* B9 {- ]1 Y5 {0 m0 w$ W
  72. 9 f) O" }( o. L) G
  73. char *dmabufsrc1 = NULL;
    ; ]  w$ z1 e' ]' T: M
  74. char *dmabufsrc2 = NULL;9 q1 l) s" J9 Z8 k8 J0 B
  75. char *dmabufdest1 = NULL;' _9 r3 y& U" P1 K% Z' O! N. J' L
  76. char *dmabufdest2 = NULL;
    + E7 d, Y8 n/ D- |% z
  77. ' i% E" a/ o2 G; W9 d
  78. static int acnt = 512;% P. }5 w. L5 |0 H' R9 M. a
  79. static int bcnt = 8;
    6 u, O) [. S: h/ t; @
  80. static int ccnt = 8;% b2 d: c$ h6 [& e
  81. ! e! Z4 l$ U5 l+ w% R0 G
  82. module_param(acnt, int, S_IRUGO);# r1 _% l! k  Y& F& L, o. A
  83. module_param(bcnt, int, S_IRUGO);
    / C+ }9 B: @, e% J: f# ^, S2 d3 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 |# C) P1 Q0 O3 W" L
' z4 ~( ]+ y& {' m& w8 U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ R- `" c; V. x# h1 I& B1 q6 i( Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, I+ T' h3 q  ]2 ^  n; D, z% }& ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 Z+ F/ l0 E: L0 \
+ Z1 |& _) b* B# c, W7 p) J( B
) n4 k6 y+ m( r; Y6 d0 l; F! b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-31 12:32 , Processed in 0.039144 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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