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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 l2 X3 I$ ]. Z; ]: N! ^. `3 B
  1. [code]EDMA sample test application
    $ M7 L& I+ ^* W. F, Z
  2. /*
    ; ^: Q5 F6 f/ E0 a2 C
  3. * edma_test.c) P: G( R0 t& T3 N# Q3 r
  4. *" R+ Z) G( f) G4 L/ ?8 T
  5. * brief  EDMA3 Test Application( c$ F% x) r1 n; A, G2 n6 r
  6. *
    + I' O$ K( J* T3 e% u8 X
  7. *   This file contains EDMA3 Test code.
    1 m0 d- _( R: H
  8. *
    " S7 Z" C2 }% {, K; @, C6 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- Y8 C. c: }2 ?& |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, T! ?- T& z1 o5 _3 A: {1 b* k
  11. *         TO CHANGE.
    2 r; o- r$ J2 b& y& D. N
  12. *4 V) n* v- j6 k! ~- @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      @7 f' `! f+ C* K1 t1 h) X7 q$ j2 r
  14. *
    & r# L6 I$ v6 A
  15. * This program is free software; you can redistribute it and/or
    1 s7 P4 [" w- O' Y: o2 @6 G" T
  16. * modify it under the terms of the GNU General Public License as
    9 m4 v$ k8 Y7 V0 d
  17. * published by the Free Software Foundation version 2.- _; s5 r& y$ P# B* z$ A! c' a
  18. *9 j9 ^+ N$ D# r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % m! [. o4 T8 @& t( x. W+ \
  20. * kind, whether express or implied; without even the implied warranty
    2 K5 F0 h* I# h& N% [  U" f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 b9 f: m: t4 k) A
  22. * GNU General Public License for more details.
    $ S6 w+ z+ w% Q" L. ]9 d$ c
  23. */. z$ p1 }# E7 s: s# h& U/ L2 v
  24. ! n8 g+ M: Z# L
  25. #include <linux/module.h>- [  y% r- P. o9 a- h% H; T
  26. #include <linux/init.h>
    4 i; h" I; u) e& E8 h: p' F9 Q
  27. #include <linux/errno.h>
    $ R) ^/ y, |7 p3 A3 z' v& J. V) H+ z
  28. #include <linux/types.h>
    3 j/ t+ M+ C+ G7 F8 L( ?) a
  29. #include <linux/interrupt.h>
    , @* V; e0 k) K! L- Q9 N+ R9 n2 W  ^
  30. #include <asm/io.h>, s0 m. L- T% j) t
  31. #include <linux/moduleparam.h>
    / X  F) s1 q2 h; s- T% ?2 v
  32. #include <linux/sysctl.h>
    4 {8 ?1 m2 |" d! i" ~
  33. #include <linux/mm.h>* D& O/ O  U: q* Y1 _$ Z
  34. #include <linux/dma-mapping.h>
    # ~" {- n4 s0 a' z/ g

  35. & w7 Q4 H4 @6 B8 C4 |& h# ]+ n
  36. #include <mach/memory.h>9 Y1 y9 e# V" F% D
  37. #include <mach/hardware.h>' p4 W" E4 G+ Y: o, S/ e: X
  38. #include <mach/irqs.h>. R6 G2 Y8 t* o8 e% T, w
  39. #include <asm/hardware/edma.h>" y5 ]; I) S" y9 h, ]$ V

  40. # }- H9 C7 ^2 }; Q4 }
  41. #undef EDMA3_DEBUG6 d" f7 g6 g: \
  42. /*#define EDMA3_DEBUG*/4 V2 D  v+ Y1 F" I+ p. u1 T

  43. 2 {: B6 R0 u% n1 R- H3 ]
  44. #ifdef EDMA3_DEBUG6 G2 i: [9 t9 |2 i' Z* q/ L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( e: x+ ]0 j  n1 P! r4 Y% P( H- n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) F! j* p; E& s; i( i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). `" c9 H1 Q7 L% p# O" z: u+ P
  48. #else
    ) h, u7 Y8 n" z- _3 i/ E3 ]7 A
  49. #define DMA_PRINTK( x... )
    / ^0 W. B2 x. G. g( u
  50. #define DMA_FN_IN
    ! \( Q. F. B3 c7 e% r+ q
  51. #define DMA_FN_OUT
      ?' d* g! |  u
  52. #endif+ x1 E/ O) m& g

  53. ) S9 H- I: W  Q+ @0 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - k8 ^9 W+ R7 V( u  b3 J
  55. #define STATIC_SHIFT                3& ?3 T$ c2 H! y  U- N
  56. #define TCINTEN_SHIFT               20; K$ r0 k; ?6 a
  57. #define ITCINTEN_SHIFT              21
    ; c% X' ~5 o/ K8 w, l
  58. #define TCCHEN_SHIFT                22
    - Z. p" D" G! c! S% m
  59. #define ITCCHEN_SHIFT               23  z; I9 u& X! H- V
  60. 0 x2 a  Q4 I! ?  |2 C
  61. static volatile int irqraised1 = 0;
    5 _# X8 Q1 ?* H! r! M9 E
  62. static volatile int irqraised2 = 0;9 ~* f; d% q$ |: L

  63.   n- Z  w2 P  W7 u: k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. u0 t) e+ W& b+ Y/ x3 Q2 {2 S* x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 k; L; ]9 _* M5 `, x9 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( q6 V/ J  {) J7 u+ Z! X: P

  67. ) o: _: ?! ^) B) _& U# k: _9 ^  W
  68. dma_addr_t dmaphyssrc1 = 0;
    1 l7 E9 h- J0 d; o) X- D
  69. dma_addr_t dmaphyssrc2 = 0;3 f% J% Z" H5 v9 s
  70. dma_addr_t dmaphysdest1 = 0;
    - _* H: @8 O8 r9 @, M
  71. dma_addr_t dmaphysdest2 = 0;3 E: X5 C& c! u

  72. ; v- X. \# t: B* p, v$ n$ d& k3 m
  73. char *dmabufsrc1 = NULL;
    1 E' }6 F0 E" G8 f9 n
  74. char *dmabufsrc2 = NULL;( N" s7 z/ [5 m, f, Z2 D
  75. char *dmabufdest1 = NULL;
    ) ^  W- @$ s0 K* v7 Z1 g
  76. char *dmabufdest2 = NULL;  Q# C1 R( T. {) O7 V/ y# O# o

  77. & b* _; r: i2 I  {
  78. static int acnt = 512;
    * ~# [* V- Y0 @& p1 g9 x. o
  79. static int bcnt = 8;) y' w7 F; Z7 u3 f
  80. static int ccnt = 8;4 ?1 s% y1 O8 J2 T

  81. * }& C1 ~* a7 y* m) ~+ ?
  82. module_param(acnt, int, S_IRUGO);
    * Y( |% [5 Z; e1 I% d
  83. module_param(bcnt, int, S_IRUGO);+ w! J7 T% n; J, X2 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! k; ^2 m: }7 v

8 d, E. x  m) `9 N) t7 f. A  g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ {, u$ D$ |9 ?4 v* H# v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. w) Z: V4 T( |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 ?% m1 E$ ]+ b% `" w* ^* @6 e+ X
8 R/ h5 E& A, @+ k2 c
  f* N/ N1 R0 V; X) g/ {1 x! C' U2 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 22:30 , Processed in 0.043723 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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