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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: s; m7 }. L% Z3 x2 j
  1. [code]EDMA sample test application
    7 }2 \* g' V/ \0 e! x/ z$ V
  2. /*
    - g  U) k0 e" }- a( B" V# i
  3. * edma_test.c2 _: `( y6 L: }2 k& \1 k* @, C, N
  4. *
    " l+ I+ v! R& d5 R" e0 ?" z# A
  5. * brief  EDMA3 Test Application
    - v* x  {, s" ^+ z: a4 Z* S6 d
  6. *
    4 _- P" `) ~: c% `( N' N" ?. T  L
  7. *   This file contains EDMA3 Test code.
    . \  `5 k  T1 n! q- T$ W
  8. *
    3 B9 {; K7 \' Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & g- Z; b7 T; o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 `3 G+ d, f* K0 s( Z
  11. *         TO CHANGE.
    : x) h5 Q( u/ G, \! _/ l2 X
  12. *
    + n4 [: }3 H3 @. ?* U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + J0 M6 E% a, }$ y% I
  14. *
    7 q2 f1 T+ Z" V" }
  15. * This program is free software; you can redistribute it and/or% w' f5 E4 x. N8 r8 N7 J
  16. * modify it under the terms of the GNU General Public License as3 {8 f( G; ?; b9 o
  17. * published by the Free Software Foundation version 2.- Y2 p. u1 Z: A
  18. *. L$ |; X! n/ w# j+ k! r. T* K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ f$ H- G* {$ X2 l9 f9 v
  20. * kind, whether express or implied; without even the implied warranty# |. T" \2 S0 n5 t5 I/ y1 [8 I. k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 P0 p: o* x) Q
  22. * GNU General Public License for more details.( C1 b- P+ K9 T& `4 _& q- d, f: t
  23. */
    , v8 a. W  o# \
  24. : {) ]0 k6 H  j7 a
  25. #include <linux/module.h>
    " N; f* Q9 U- ~& q& ]
  26. #include <linux/init.h>6 c% @1 {; b9 A+ k9 n, l
  27. #include <linux/errno.h>
    , f+ k0 T" O7 `% j
  28. #include <linux/types.h>6 P3 J) E, k; S
  29. #include <linux/interrupt.h>
    # e3 D# I) f$ q0 u$ L
  30. #include <asm/io.h>
    / K9 a! n$ ?5 ~: e# E7 q/ x
  31. #include <linux/moduleparam.h>, P# ~3 T: T- ~+ Q* p. x& A
  32. #include <linux/sysctl.h>2 F+ \" {0 v- {- Z8 }/ r
  33. #include <linux/mm.h>9 z7 B( W9 u- j; e' F
  34. #include <linux/dma-mapping.h>
    + ]+ B0 \6 h) U% k5 b0 r
  35. 2 K! M% ~1 N7 @. H2 R& \) k8 G7 u4 S5 c; ~
  36. #include <mach/memory.h>
    # c; X; Y7 y/ F9 V
  37. #include <mach/hardware.h>
    / e* h8 O# U  n( e9 Y
  38. #include <mach/irqs.h>
    6 L# \' Y1 F! b; I) C; C
  39. #include <asm/hardware/edma.h>5 h) a1 T. k+ [

  40. 4 g& m* J" c9 ^* h- p
  41. #undef EDMA3_DEBUG
    ) V2 E4 N$ [: f3 Q
  42. /*#define EDMA3_DEBUG*/
    - }% w/ O! `: K( C: _! U
  43. $ X5 H4 b5 b) E) t1 R4 N3 [
  44. #ifdef EDMA3_DEBUG
    / ]. s% G3 C  w9 C/ d( n3 _; I) w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) t- p& \  d4 T5 w) m% r& m6 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 W# L4 P7 F+ U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* c, D4 ], w* a% K
  48. #else- s8 `' u3 R) k( C) K
  49. #define DMA_PRINTK( x... )
    ! ^4 s5 j5 [% F
  50. #define DMA_FN_IN" _5 P7 O: a. h0 Y2 c0 i+ e
  51. #define DMA_FN_OUT" e1 k$ g2 Y3 a$ k
  52. #endif
    * w% v$ o. }0 ]  S5 Z

  53. % M/ K& ^+ }+ u/ Y8 R% c5 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , E6 Y9 V) Y- F+ z
  55. #define STATIC_SHIFT                3
    3 y7 o5 g  u1 f, z
  56. #define TCINTEN_SHIFT               20* y$ @# G1 `8 L1 _2 d
  57. #define ITCINTEN_SHIFT              213 n8 N( c# |, y
  58. #define TCCHEN_SHIFT                224 b% I% d% K# C! @* v$ p+ _
  59. #define ITCCHEN_SHIFT               23
    $ ~6 s7 K  \& ~" `

  60. . d' B" u# t4 V, }- V
  61. static volatile int irqraised1 = 0;
    : `' {# ]) t7 h( S
  62. static volatile int irqraised2 = 0;: v. j/ o  u$ {: c/ N2 `
  63. 7 T, o9 {: s; Q" j# }! b7 H" y9 c, F  z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. m" g; e, K7 _4 ~- y* \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 [% a8 K: N: E/ e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 g- c  I0 Q' I1 Z* V; V# g

  67. + _/ s* I( r& B1 z' {
  68. dma_addr_t dmaphyssrc1 = 0;
    , F, d/ Y$ ^- o6 \& Q: X$ ~6 L
  69. dma_addr_t dmaphyssrc2 = 0;
    9 d2 _# c3 K! l/ o& d
  70. dma_addr_t dmaphysdest1 = 0;8 Z6 k/ k) _* u! v
  71. dma_addr_t dmaphysdest2 = 0;
    6 o+ I4 h6 s2 T5 @' o, ]4 S# s7 d
  72.   E4 u3 P4 ]' ^% o- U
  73. char *dmabufsrc1 = NULL;; j0 T1 y/ q! {2 K7 s, @/ J
  74. char *dmabufsrc2 = NULL;
      g, ~* k- Q- z" u0 Y8 N) Y3 ~8 i
  75. char *dmabufdest1 = NULL;
    % U9 w5 P4 Y8 @% W2 N
  76. char *dmabufdest2 = NULL;
    & ?$ o8 x4 }* n3 w1 e8 ^2 s6 @

  77. 3 t# ^7 @1 ~2 ^2 K6 Q
  78. static int acnt = 512;
    . \! E( M# \6 C$ k2 Y2 `
  79. static int bcnt = 8;+ O4 U% L- O2 I( Z7 a) X8 B+ B
  80. static int ccnt = 8;( ~# g5 m, x; g' d) n3 C

  81. : @3 ]( t2 h  v# m2 r6 ^8 z+ D
  82. module_param(acnt, int, S_IRUGO);& |' F: l3 n8 e# O0 P
  83. module_param(bcnt, int, S_IRUGO);
    ; o- N! s1 J* K" y! @/ M2 D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. |1 S& \# I$ m& T
% \3 @' m+ K* T7 ~% _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 o8 U/ l1 k) t, u# _% T5 [; garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 v; E& J' ^6 R/ Y; A6 D1 E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- e8 _& \6 c, T. M$ \( I

/ S# `7 g8 S( I3 g8 n: T) ?1 G7 {
6 H) {& f* v. }, z- e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-19 11:57 , Processed in 0.038888 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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