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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; L  u8 a3 m8 H$ ~) f
  1. [code]EDMA sample test application
    4 K! Y" H2 X* x& G; ~" q
  2. /*
    . I+ R' T' v# F7 r# w% y
  3. * edma_test.c" E. A( ?4 m7 w) Y+ B
  4. *& o2 d! y: R- {7 [* k- U# M
  5. * brief  EDMA3 Test Application
    + T9 B1 Q& Y; ?( V0 F5 K% M
  6. ** n: k# B0 F. P8 H
  7. *   This file contains EDMA3 Test code.
    4 h  J4 `+ x- s5 ~( p2 x
  8. *' g% E' b5 `1 ]! |% A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' u! L; ?5 K9 f0 Q* h; G' G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 D6 {# {$ I4 j- @
  11. *         TO CHANGE.$ o; K3 g3 x, G, X3 r6 D
  12. *
    ' d# \% a7 Y" Z2 f$ A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 p4 Z: w) W0 y. R* X
  14. *
    % I! |- E4 j0 o- B6 f9 D( ]
  15. * This program is free software; you can redistribute it and/or
    5 M  T7 @! P9 f5 W2 R
  16. * modify it under the terms of the GNU General Public License as
    1 [& v5 k! E' V0 n# M" F% q
  17. * published by the Free Software Foundation version 2.8 y; N2 i& I2 e# M) k3 M7 n  Z
  18. *# ^: f: H9 @: ^2 }0 i0 Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ s. v) o! n6 }# R4 a  g
  20. * kind, whether express or implied; without even the implied warranty
    3 ?7 j; d+ L- q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : @, P8 B* p" ^* e
  22. * GNU General Public License for more details.
    : u% r7 q: ~2 x) Y5 x3 U. Y
  23. */
    ; \0 h8 \0 G) e6 k& r% a+ Y9 T$ \
  24. 0 N, a$ h. G2 F' S- C( N
  25. #include <linux/module.h>
    ( h. L7 K( k$ H* J, h
  26. #include <linux/init.h>, J  @* @; }# n
  27. #include <linux/errno.h># r/ ]; Z$ s* R; m
  28. #include <linux/types.h>
    5 b0 d# `: r; }. N0 W" I
  29. #include <linux/interrupt.h>% Q* [% _6 Z: U, g7 q3 N; h( _
  30. #include <asm/io.h>
    / _% g1 W( k" |* w2 }$ {5 S
  31. #include <linux/moduleparam.h>
    1 K3 G$ X  K  J1 P
  32. #include <linux/sysctl.h>
    ! z0 a. h8 A% S9 |$ e4 J" j% j& ?
  33. #include <linux/mm.h>
    8 l9 i' J) u' D0 E: X
  34. #include <linux/dma-mapping.h>( r7 F" q  W2 [# l5 Q- s
  35. * j/ N# X% W' S/ c$ H7 K5 O
  36. #include <mach/memory.h>
    / s  b! Y7 |& o( Z' U2 m
  37. #include <mach/hardware.h>: _% c3 z# a' D9 r% [# X
  38. #include <mach/irqs.h>
    * B4 I, M( W! I! ~, K
  39. #include <asm/hardware/edma.h>
    0 F, q+ G4 v$ g( l

  40. ; V0 x' O8 \; B6 l
  41. #undef EDMA3_DEBUG- m: h7 p0 l7 j" r3 y6 Z
  42. /*#define EDMA3_DEBUG*/
    $ [$ P7 a0 @; R
  43. $ ~9 h% M$ ?* O. {5 B$ u" ~* Z6 Z# |, M
  44. #ifdef EDMA3_DEBUG
    3 x  q; B* K$ j8 a! D/ C) V5 X9 F& w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ b- }+ w6 R  h8 x% k9 I( y, m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 b. G. f5 \" h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! c& I8 {; B0 G' X
  48. #else
    6 [% y, C$ k$ {- s$ @9 h% D' u" f
  49. #define DMA_PRINTK( x... )9 x7 n& Z* s% w$ o' s$ _+ S
  50. #define DMA_FN_IN
    + ^. x! p1 O# S5 ~& w
  51. #define DMA_FN_OUT
    , D& ]0 D* m; R6 n
  52. #endif
    5 F* g8 z  h1 [3 F; d
  53. ) G( N$ Q! s( d( K) y1 }6 w. h' l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # Q% N, }, j9 ~' t9 N
  55. #define STATIC_SHIFT                3
    6 _; M+ S( T! |
  56. #define TCINTEN_SHIFT               200 x" ^6 I! o1 ]$ o
  57. #define ITCINTEN_SHIFT              21
    % t. B0 u2 _  a
  58. #define TCCHEN_SHIFT                22
    , w' |; z: G( t" L8 q  U
  59. #define ITCCHEN_SHIFT               23
    % _9 e8 l+ C5 l- S9 k) b/ m4 Y6 g% g
  60. 6 D. c% O1 q3 f* L
  61. static volatile int irqraised1 = 0;
    ; R+ e; }0 T8 ]+ B8 M( I
  62. static volatile int irqraised2 = 0;) S/ }4 D+ a7 ]. ^# v) B
  63. 5 v6 M5 e4 F; ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) s$ S8 t2 R# r' E+ A7 n5 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 o$ o, ^. A( z7 K/ K. k" n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , ~6 K  x/ o) }/ A4 g$ Q0 n' {

  67. ! S4 ^9 a1 u# t( a
  68. dma_addr_t dmaphyssrc1 = 0;
    2 q* O/ w; r$ h1 |6 M
  69. dma_addr_t dmaphyssrc2 = 0;
    + h2 P. z" `" w  V( p& u
  70. dma_addr_t dmaphysdest1 = 0;$ Q, y" U1 O  k6 |1 N
  71. dma_addr_t dmaphysdest2 = 0;# c2 @' U( _! }, [; w7 y

  72. . E. u; m: p& }6 V: B2 E
  73. char *dmabufsrc1 = NULL;# I. a. s; O3 m& [% j
  74. char *dmabufsrc2 = NULL;$ {! w7 Y) E8 G% ?" z
  75. char *dmabufdest1 = NULL;4 w. C- h2 g. s: ~3 a* z! \. l; E
  76. char *dmabufdest2 = NULL;( y( d8 O5 P' l  Z9 G. r

  77. , D5 Y* C! r8 I0 _' m3 L! X% T$ p/ p
  78. static int acnt = 512;
    ; C. {' G+ f& R
  79. static int bcnt = 8;% M$ C, P# I4 z1 C
  80. static int ccnt = 8;1 M, U/ w. s1 E2 h* p

  81. 5 p. ?8 g) A4 o' Z
  82. module_param(acnt, int, S_IRUGO);' m; C) V2 w9 {8 A0 [; D
  83. module_param(bcnt, int, S_IRUGO);9 ~2 ]# |. u: A2 ]3 g& N3 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 @/ i0 u  o7 D" a4 P' V
1 M' X( B- m- V- r5 g7 m, C5 ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# v  {* B) S5 d" ]3 [6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& j5 Y& t! B0 K& u3 [  u3 T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 [' d- |) N( D  p/ c! Z# z8 H3 @% J0 B, y0 ?

3 ?* l, q6 p7 K# [# m2 `- g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-4 05:36 , Processed in 0.037140 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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