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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ ]8 p. `7 @2 @2 Y$ {
  1. [code]EDMA sample test application
    ; U  k" K5 Y2 X5 R9 A* Z, b! K' r
  2. /*3 Y; F; u' v% N, I& c+ j
  3. * edma_test.c
    7 D8 ?6 I" c$ J+ e! ]' @
  4. *
    " V& t7 {: Z* ~
  5. * brief  EDMA3 Test Application
    * a& @/ v! j! \! Y+ i: g7 {! u
  6. *+ k# S2 @8 J; k1 w( C# s! }2 p6 D
  7. *   This file contains EDMA3 Test code.% W" `" U' k2 q/ K: l1 X2 }* F
  8. *
    ! K" R5 c$ K9 Y( |1 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      f+ s3 W4 a# W1 d  G! t( |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ B& d2 A$ b: A) q- D0 y" w
  11. *         TO CHANGE.  h: N: f- E, T" B; f6 `* r
  12. *
    4 Y# p3 A% R% |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' E! A; R/ y% l
  14. *
    ! s% q+ K4 K- o
  15. * This program is free software; you can redistribute it and/or' o! S5 M  o  g: h) r0 Y
  16. * modify it under the terms of the GNU General Public License as+ ^# F2 B+ C" R. g: Z$ u9 O
  17. * published by the Free Software Foundation version 2.
    * I) [+ J5 a/ U: E7 n
  18. *" x( }& j) I: O9 b3 X+ |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 W; g- }; B8 e( n
  20. * kind, whether express or implied; without even the implied warranty$ u- D+ r; x! K/ N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( i7 ^) g/ B/ P! t
  22. * GNU General Public License for more details.
    ' t1 ?! S- q/ A  j
  23. */( b  V$ l4 z  i* ~3 T$ a
  24. ) [: e% B* |1 q3 w
  25. #include <linux/module.h>- ^$ r7 R' v; Y+ ~
  26. #include <linux/init.h>
    ) R8 O3 r. N* p" {3 H2 E0 w$ V
  27. #include <linux/errno.h>/ n4 L7 q8 v& m& n: s
  28. #include <linux/types.h>9 e/ S+ a/ B( d- \  {
  29. #include <linux/interrupt.h>
    : _7 G2 o! X; B) P1 L
  30. #include <asm/io.h>
    6 O5 f# ~  e- Y1 Q9 H! u
  31. #include <linux/moduleparam.h>
    ' I5 [  d) U  {* d1 ~: s* F
  32. #include <linux/sysctl.h>
      D7 v# A- G: `: V1 E* q0 r
  33. #include <linux/mm.h>
    * ]5 C0 l* B( S3 g
  34. #include <linux/dma-mapping.h>
    $ g: j8 o& ?: Y, w

  35. ) G, i; p* U( ~$ k. Y6 O& J. y
  36. #include <mach/memory.h>
    , x8 O4 h; X4 D4 V- z7 p8 e8 c! O) y
  37. #include <mach/hardware.h>
    7 k' W0 e: [' i3 a+ P0 _/ G
  38. #include <mach/irqs.h>
    ) g3 p7 K6 j$ o5 n, J6 d
  39. #include <asm/hardware/edma.h>/ a, ~' j& Y3 O/ X

  40. ; y% c9 F2 t0 c' d- @, E
  41. #undef EDMA3_DEBUG0 O% s$ Y2 [7 j4 k: L
  42. /*#define EDMA3_DEBUG*/- O  w8 X3 Y% Z. r+ N
  43. " M7 _, A# ~2 r; `
  44. #ifdef EDMA3_DEBUG
    % z: R; s9 G8 V: `4 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 m, B7 P% w/ C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( y+ J  ~  e8 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 o1 K3 s5 [6 D; j
  48. #else
    9 |' v+ G4 T9 X' A
  49. #define DMA_PRINTK( x... )% B: C5 i) |5 }9 }! [* e; x; |' G
  50. #define DMA_FN_IN
    0 k: M2 ^. F$ k( ?% s' G/ F
  51. #define DMA_FN_OUT
    % ?- s) h# P4 @1 r' l: [3 @
  52. #endif3 Y) y  [3 L) p8 M! @5 R

  53. " F+ S3 E- Q- ?! I  L! k* T, c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      f9 O( D; T: I; ]. e
  55. #define STATIC_SHIFT                3
    # W( T3 U7 R% R
  56. #define TCINTEN_SHIFT               20% @4 s  d$ l$ W$ K
  57. #define ITCINTEN_SHIFT              215 J! [7 s# ~2 E; e8 g, t
  58. #define TCCHEN_SHIFT                22# R- n3 @( W6 _% K. p8 y1 `
  59. #define ITCCHEN_SHIFT               238 j) C  x3 V* m, o% _

  60.   x! U+ k5 _9 _+ ]( a5 F" r
  61. static volatile int irqraised1 = 0;
      H4 g% d8 x4 a2 W7 n& K
  62. static volatile int irqraised2 = 0;
    0 Q& k( B( D6 l
  63. 0 S' c# T9 }+ i0 w& r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) c) l1 _5 b0 E; C6 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# s8 @0 c1 v4 R) j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / h6 ^: A5 a3 B" m5 Z7 V' f

  67. ( `) w+ ?) [2 e% p4 ]0 l+ y: Z) m
  68. dma_addr_t dmaphyssrc1 = 0;
    , `! Q+ d1 ]) y
  69. dma_addr_t dmaphyssrc2 = 0;
    3 T# Z, n1 w1 D9 ?
  70. dma_addr_t dmaphysdest1 = 0;
    0 q3 j/ a: z! v
  71. dma_addr_t dmaphysdest2 = 0;
    6 F% m2 R0 j: j& ^4 {' T

  72. 7 k1 @* l- ^6 i+ N; u/ j- A
  73. char *dmabufsrc1 = NULL;/ N% H( h  z6 o1 L
  74. char *dmabufsrc2 = NULL;
    ; y! t3 g) {' X" I" C1 U& u
  75. char *dmabufdest1 = NULL;
    . `8 m) {9 K, F) N- H+ V( h6 ^9 ^
  76. char *dmabufdest2 = NULL;/ p- a9 N- ?9 G2 X7 x6 ^) L7 y! s& ~
  77. & ~* z3 A  Y/ Z; h4 _+ h! `
  78. static int acnt = 512;
    9 C+ `3 [( G4 [1 a5 a& y
  79. static int bcnt = 8;  \3 y" f& t& U7 C* H& k* H
  80. static int ccnt = 8;
    ; j3 J+ I7 z. j: V5 ]7 f$ a
  81. : x- u' r# y9 {# f0 c& N
  82. module_param(acnt, int, S_IRUGO);4 k* P" }- K. _5 _# T
  83. module_param(bcnt, int, S_IRUGO);- ~8 p5 r, G+ c% g. J' W0 M9 k: F& {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 w8 w. {0 u; x$ H% b6 l4 ?9 u
; M1 K1 n; Q6 v0 I% k* C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ f% p2 l& h+ s: [' S" T7 X" d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! s  D% x# ]; Z) ]5 }  @  Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 r# c5 [9 g, g
& B- [( p% A2 |( ~) D. c7 ^
: W- R3 F' L: Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-9 18:25 , Processed in 0.037413 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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