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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 D' \" G% q3 j" _
  1. [code]EDMA sample test application
    7 S5 y/ D- F% {" \, J
  2. /*
    & w% _. O4 t; N+ q0 E  B# L
  3. * edma_test.c, J) z6 U7 Y2 a0 @. }3 p
  4. *8 o5 S5 g# n: e! g6 c
  5. * brief  EDMA3 Test Application
    - t  Z- `1 O) Z; f2 W7 c6 m
  6. *4 i$ s7 k) {( u  E& F
  7. *   This file contains EDMA3 Test code.: ~+ [2 |8 G8 O7 p; |
  8. *5 y7 \0 r4 Q* b2 Y1 V. w( a  z5 `7 D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      _( b/ B( l; ^% P2 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 w$ ]( R. A' V7 Z3 h% D/ r
  11. *         TO CHANGE.& ^# `! E  R' B
  12. *
    * Y; x4 j6 M4 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 C6 e- m  _) K8 F5 ^" u3 w' P
  14. *
    + E% i7 K/ E8 J' E3 H7 e, C: E
  15. * This program is free software; you can redistribute it and/or# r, ~1 V4 c. m+ L- U. J0 {# B
  16. * modify it under the terms of the GNU General Public License as
    . X1 S6 j1 S" f
  17. * published by the Free Software Foundation version 2.
    & z6 E& H/ W- G/ k
  18. *8 b& h. ]0 _1 X" _/ Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ O" b4 q- Z2 i6 R9 m/ L5 X
  20. * kind, whether express or implied; without even the implied warranty& S* k+ w0 i5 U9 Q6 d2 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! X' J9 s9 j' l6 R
  22. * GNU General Public License for more details.
    : C  o) F0 C  f8 Z, c, [: {* q
  23. */" T) B& d- o% ]+ I# ]

  24. 2 v% ~+ e& S' r! r
  25. #include <linux/module.h>: u9 N, i, y1 w/ N0 U# E
  26. #include <linux/init.h>
    % B/ }# ]* S2 W3 O2 C- o
  27. #include <linux/errno.h>, c! I4 i5 w, l: V% E2 v' @" X0 Q5 \
  28. #include <linux/types.h>
    # q( P: ]: y6 ]4 E
  29. #include <linux/interrupt.h>
    2 x5 |, ]4 k7 S; t: B3 v
  30. #include <asm/io.h>
    8 \; J0 t  n' z* }$ g& g: Z
  31. #include <linux/moduleparam.h>. J- \) q- p' ?
  32. #include <linux/sysctl.h>. \, t5 g+ u: D
  33. #include <linux/mm.h>4 Z9 Z, A& X: f1 G$ ~6 n; A' Q. q
  34. #include <linux/dma-mapping.h>7 j, T4 W( ?( D4 V
  35. , ]# J& a4 W' u3 k  P" I5 x; A$ e
  36. #include <mach/memory.h>* ^; c) y# g: @. a: P( b7 a& o7 Q0 g
  37. #include <mach/hardware.h>7 |+ }3 q* t9 [4 L
  38. #include <mach/irqs.h>- w$ A2 u* k$ y# w4 _
  39. #include <asm/hardware/edma.h>0 X% Y: @  `0 D1 Q% v7 b
  40. * N- y: \  B" `( @
  41. #undef EDMA3_DEBUG
    , T' t; n( l/ ^: u
  42. /*#define EDMA3_DEBUG*/9 m8 \; w: |& e2 G. b

  43. 3 O6 V/ t% k* H; e0 c/ p1 y
  44. #ifdef EDMA3_DEBUG
    % c7 s  o" @7 ^0 o, P) g. K; Y% J- x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): C6 i: n% s1 T+ z; F) w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) o! n# ~# G$ W* ]4 g. V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 V) X1 ~, \, a/ _+ F
  48. #else
    / h( @; O& E' v- y/ h, t
  49. #define DMA_PRINTK( x... )  O$ i: u3 j% R
  50. #define DMA_FN_IN
    * s4 ~+ u. |2 o, {1 g6 s( _
  51. #define DMA_FN_OUT. H5 ?0 v" E: \; ~% N& ~
  52. #endif
    9 G/ Z. @5 V) O$ p: S5 d' x

  53. 9 z% C2 Y; {" Q- |6 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % s+ n) C7 u" ^6 `& E- E+ B
  55. #define STATIC_SHIFT                30 P$ V8 k# O3 m% `& z* E' a
  56. #define TCINTEN_SHIFT               20! L' h9 P7 a+ {; }
  57. #define ITCINTEN_SHIFT              21+ M; F' f: Y$ {: W1 N( o. f
  58. #define TCCHEN_SHIFT                22) X! z( S; C1 G- l( Z
  59. #define ITCCHEN_SHIFT               23
    : @6 G0 j- `( j/ r8 y
  60. " L' a1 a# C, r( W' _! {0 s' N
  61. static volatile int irqraised1 = 0;9 O$ F, k  J7 t
  62. static volatile int irqraised2 = 0;
    ' D5 D0 Y4 X9 E# w

  63. * H2 k% p. C  s) A: L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: K9 K$ H, G8 p3 `) L7 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ v- I4 G3 @3 |/ P# e# b4 y: x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, h+ W9 H- I) L- N
  67. " v  _& [& ]" i3 M- \. S4 a
  68. dma_addr_t dmaphyssrc1 = 0;4 U. }2 G( H* F, m8 a- x
  69. dma_addr_t dmaphyssrc2 = 0;- X3 i/ _2 p" J4 I/ f
  70. dma_addr_t dmaphysdest1 = 0;
    ; u9 ]5 r  s: |6 A* @& a  h! J
  71. dma_addr_t dmaphysdest2 = 0;% P$ w" }$ M( |& [% Z7 L

  72. 6 ?; j. O- [  ^9 X0 B# {1 e0 y, a
  73. char *dmabufsrc1 = NULL;
    5 N* H5 r7 \, b3 B/ v; b: |' f
  74. char *dmabufsrc2 = NULL;5 W9 m7 O3 z4 v- j% n
  75. char *dmabufdest1 = NULL;- B3 N0 k, x& y9 t2 s% \
  76. char *dmabufdest2 = NULL;
    " ~/ _/ N- z6 y+ l

  77. ; [% o  q7 R6 k
  78. static int acnt = 512;
    1 F4 o5 U% \+ Q+ P+ E# L2 @
  79. static int bcnt = 8;9 S: w8 U5 t) C8 b5 p- G, y
  80. static int ccnt = 8;4 I9 K. R1 m' c& t6 ]) g' L

  81. / j: e# ~' R+ x! ]! ^* {3 P4 `0 T" {5 S
  82. module_param(acnt, int, S_IRUGO);
    ! e+ }2 c% W. v
  83. module_param(bcnt, int, S_IRUGO);0 ]/ g" N/ A0 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ M- s. Y9 ?9 e# F8 g& O, M& ?0 a: z. s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% T3 s/ i& O% Y8 g! P6 X. darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ G1 E# F- r' g+ A7 V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 ^2 X$ _( h) z* y$ k, N$ V
( j: T+ u3 }' d' `! [0 g( A
% \: p' V: ~' o' G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-8 06:46 , Processed in 0.037295 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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