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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 R2 z+ v: e* h+ T1 ]  g
  1. [code]EDMA sample test application
    : r: q- J" ]1 i! {2 h% @+ X/ \
  2. /*( q+ N2 v& M! Y) g
  3. * edma_test.c9 {* @# R* g" O! P
  4. *
    ) E$ [% P) A+ c
  5. * brief  EDMA3 Test Application' U+ r0 v# e6 i' }1 a3 z" h
  6. *
    8 T+ E+ O! p0 \0 E* i* Y' d" _4 J
  7. *   This file contains EDMA3 Test code., R: G/ w3 |( X$ J6 X- O9 Z' {
  8. *' T0 O- k/ s7 p3 T/ r: v0 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 J- `9 w9 ^4 k- ]% s9 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) B& R1 f2 }7 D7 p  S
  11. *         TO CHANGE.7 y- S. [. U( T3 t  M8 q" M
  12. *
    , T- N2 R, }3 |% m( S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, J# }" D; H( J* f4 r
  14. *8 i. c" |# _( K% f: C# U
  15. * This program is free software; you can redistribute it and/or
    9 J0 c2 q" w; Y# P. h: M1 n4 ^. h6 x
  16. * modify it under the terms of the GNU General Public License as
      u. n% l  `+ _
  17. * published by the Free Software Foundation version 2., c" ?0 y/ K9 B/ D! v# y  j
  18. *
    5 _# w/ G' y. V$ N+ U: |( L. B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % K! F! d( q* I% |( G
  20. * kind, whether express or implied; without even the implied warranty
    " m9 t; Q. i. ~& _8 Q1 x* a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* f1 A: Q! C5 A8 [# g
  22. * GNU General Public License for more details.0 Y- s7 @! u8 p4 \1 _& V0 p0 ?* `
  23. */
    " z( ~4 c8 f/ }$ D

  24. . n' m8 \: }. |8 g4 a, p
  25. #include <linux/module.h>
    * Z; f5 U7 {, h7 O
  26. #include <linux/init.h>
    . {; f9 n$ |7 \' |
  27. #include <linux/errno.h>; K+ E$ X) Q/ Q' q1 X, Y
  28. #include <linux/types.h>, X) {/ q$ z" G7 S
  29. #include <linux/interrupt.h>3 m5 Q: Q- t9 }3 ^( M3 R& G
  30. #include <asm/io.h>
    - B$ V: l7 q" |. U; _( K* k
  31. #include <linux/moduleparam.h>
    " u" C: L0 z5 R+ S9 {0 w
  32. #include <linux/sysctl.h>0 v. w4 K, t% s/ a, d
  33. #include <linux/mm.h>
    ! {2 r; G7 }" P5 `# m7 a  H
  34. #include <linux/dma-mapping.h>
    * M% C+ E" S# P4 t5 n

  35. 0 m4 p# |# q) m: [" K
  36. #include <mach/memory.h>
    : b! G$ b$ _7 b" ^7 o; F
  37. #include <mach/hardware.h>
    : X, A& B. o- ^! x$ R. C; X
  38. #include <mach/irqs.h>' T; C5 O3 |" x/ B' [5 m3 Q4 G
  39. #include <asm/hardware/edma.h>
    8 i+ o  w% u4 K0 e4 h
  40. " j# J% E' c, s( I4 H- B
  41. #undef EDMA3_DEBUG
    2 I: n# r8 h2 z! v% _6 w. W
  42. /*#define EDMA3_DEBUG*/
    0 B% C4 x; }$ I7 K

  43. 0 }( J9 K; S1 k* U& q
  44. #ifdef EDMA3_DEBUG
    - h' b* j5 \& q8 [, l4 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 B- w( J# e+ {5 R7 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( L0 q1 W9 h) ^  q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , z( v6 ^; s- R- p9 G
  48. #else
    8 M: e$ L! W- {, j7 R; M) h1 E
  49. #define DMA_PRINTK( x... ); P" ?( j+ U* c5 o) V
  50. #define DMA_FN_IN
    , z0 K1 P4 o; c7 Q7 s9 P
  51. #define DMA_FN_OUT
    % s) _$ F7 u* w2 ^9 }. e% U+ d) Y8 P$ I
  52. #endif
    2 x9 k$ v7 b  t8 i' F2 b4 g

  53. 3 m# N- w# d! R" n3 E3 l  U) W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      O) ]: T! O. P' k, N# N
  55. #define STATIC_SHIFT                3
    " c" z2 t- ~4 f' D: A
  56. #define TCINTEN_SHIFT               20. J% w! J1 Q2 D. c7 ]% K
  57. #define ITCINTEN_SHIFT              21! w; Q5 L) g: h# E% k) G* g& w
  58. #define TCCHEN_SHIFT                22
    1 U5 w7 T% a& v- x5 @, h6 a
  59. #define ITCCHEN_SHIFT               23
    8 |8 c' \6 q* u
  60. % N! h/ x2 [! c( ]% ]
  61. static volatile int irqraised1 = 0;
    / m; a5 Z; j! W2 }/ A. ^
  62. static volatile int irqraised2 = 0;( H5 Y+ c% b0 R& W0 Q) Y8 E
  63. 8 ]# C# \( @4 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; M& g9 Z( A4 U9 y& @4 U7 L4 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 ]" _* L2 Z& O# K1 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! p( w0 |1 C6 P) C/ F% j

  67. 9 ]4 N  E5 E2 J  A  h
  68. dma_addr_t dmaphyssrc1 = 0;
    * U9 s$ `1 R; q& H/ m
  69. dma_addr_t dmaphyssrc2 = 0;
    1 x2 w: T+ `! a) p  C
  70. dma_addr_t dmaphysdest1 = 0;# z5 l3 @3 k# t4 [
  71. dma_addr_t dmaphysdest2 = 0;% \# L. |9 X& x- W0 m% _& g3 o

  72. $ u1 g/ ?- C3 j/ F
  73. char *dmabufsrc1 = NULL;
    $ I8 w9 e8 H' i
  74. char *dmabufsrc2 = NULL;
    7 }8 i5 y6 T8 |& X
  75. char *dmabufdest1 = NULL;! c# B7 k1 n7 y8 k' w! @1 }
  76. char *dmabufdest2 = NULL;
    7 Y, o; {! d: K2 O  T, [: e

  77. + B' @# d$ j/ T, x( [5 |5 V1 X: c0 E
  78. static int acnt = 512;" H& C& ?( h8 [5 C
  79. static int bcnt = 8;7 b! F' K+ h+ S
  80. static int ccnt = 8;8 S7 T1 W6 n0 |7 x6 X& j" Q
  81. + J, q$ ~* ?" V' M4 E
  82. module_param(acnt, int, S_IRUGO);4 Q: C; V' f) R/ r! w! ]0 X- h* ~
  83. module_param(bcnt, int, S_IRUGO);% u" U1 W; f+ a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% t' D  O3 C& g6 o5 Y
( N# [; H( q5 M* q) E$ p# P! R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& D  I4 W6 [, N) U1 Y! J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' q- ^' h$ S3 ^( r( O' m* ?+ m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. N9 Y' u4 @  a. u" }9 C6 }

8 \# f/ r  `! D) d1 E# Z" H; y1 T2 T) S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-1 11:14 , Processed in 0.037507 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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