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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( F* F; @4 p! D1 Q$ k* Q4 D, l
  1. [code]EDMA sample test application
    + [/ L) i/ X. ?# r
  2. /*
    ! p# Q) C/ }+ {' u% Z! [/ r" P
  3. * edma_test.c: @6 A) o! K2 A# t
  4. *3 A/ e3 L$ j7 U+ c( }; R" H
  5. * brief  EDMA3 Test Application
    $ F% q- y* I( V
  6. *7 V9 D8 O" W" w* ?1 x# B3 Y
  7. *   This file contains EDMA3 Test code.) _3 T" Y! S% k4 x
  8. *. o1 [8 x+ T) a6 n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      n: A" y& o$ S; `& B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : }2 j2 R* c+ [' K6 h
  11. *         TO CHANGE.
    " _7 y: p# z& |/ [$ q/ \: X
  12. *- }$ C# f/ [" A+ s5 e( m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / A) j# Q; D* l1 M/ R- X
  14. *1 p* v0 {/ n0 i5 L
  15. * This program is free software; you can redistribute it and/or# s) }2 [! h4 u0 ^: P. O- S* d
  16. * modify it under the terms of the GNU General Public License as
    * \" S8 d* w% N; I+ G
  17. * published by the Free Software Foundation version 2.
    9 v7 l4 H9 i3 s' n% Q5 ~) q
  18. *2 g0 J( F. y* d/ |6 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 D% R$ I( L3 j5 \# c0 x( i. I6 f( i+ D
  20. * kind, whether express or implied; without even the implied warranty' H) o; _' f8 ^; \) R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 R8 i) J* Q# {2 p/ M: b6 s9 }
  22. * GNU General Public License for more details.
      r# \4 ^1 o7 O$ [" b6 B# b+ a
  23. */" [' t+ c$ M* V: @! `
  24. - `" f& p# h: r& _
  25. #include <linux/module.h>- d/ @  u- Z3 f4 `! P1 E
  26. #include <linux/init.h>
    3 n! P5 @$ ?( I+ @
  27. #include <linux/errno.h>
    ( J5 w) @. @5 A
  28. #include <linux/types.h>
    % {* v/ [. M$ t' \" _
  29. #include <linux/interrupt.h>7 A. U" o. t6 j* @  l
  30. #include <asm/io.h>( B' R' ]* [6 P4 v3 o# X
  31. #include <linux/moduleparam.h>  E! P0 t0 k* _) i8 S
  32. #include <linux/sysctl.h>
    2 B# ~) J5 U. g, P# f, v9 W
  33. #include <linux/mm.h>
    - x0 ]- U+ `: J9 k1 J& E+ E6 I
  34. #include <linux/dma-mapping.h>7 B& T  f* J2 J" a2 I. U

  35. 5 W/ p1 R0 w$ H, k5 |. l8 L/ u! R
  36. #include <mach/memory.h>+ f) u2 |% W+ Q! H+ }; d* Z) \1 _/ U
  37. #include <mach/hardware.h>: t+ B4 j' [9 y; g9 t
  38. #include <mach/irqs.h>
    9 K2 Y& ^) ]! S/ @; w! T) K
  39. #include <asm/hardware/edma.h>0 j1 W  z* y8 y$ c. v! Q! x
  40. ; w5 K+ d! j0 o. d& H5 z
  41. #undef EDMA3_DEBUG' n: K/ v+ L2 k; i# |: b! @
  42. /*#define EDMA3_DEBUG*/
    7 q2 t4 M# M! W

  43. * V1 A* X: _9 i
  44. #ifdef EDMA3_DEBUG3 [' d1 q. m, s+ Q! Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : M3 z( f0 T. u/ i) C' W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# R2 D5 r3 b* t, [/ k$ N* ]1 ~/ d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 O; {% s- a6 h* D; \: k. O
  48. #else% I  d) H' {1 y8 R' s
  49. #define DMA_PRINTK( x... )& D/ s  V, [- q& a; m
  50. #define DMA_FN_IN
      j/ v3 i; l% B. t- V1 \: ~
  51. #define DMA_FN_OUT4 u8 m  X( h' I- j
  52. #endif4 F3 s4 b! c. `. j% t) E. y0 T
  53. 6 L3 o3 U5 H0 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 }6 m6 w7 z1 n& `2 l. F8 ]( E. y3 @
  55. #define STATIC_SHIFT                34 u5 N5 C& z! F& j5 k" Q: @
  56. #define TCINTEN_SHIFT               203 h8 f1 l  e; n* o& J% N" s: a
  57. #define ITCINTEN_SHIFT              217 z4 a' y6 |- U! Y" `+ p
  58. #define TCCHEN_SHIFT                22
    3 u$ s3 |- V- u# w. U* s: o
  59. #define ITCCHEN_SHIFT               23
    + [) G: X6 m; G) u2 F; ]9 _7 R

  60. * O7 e8 H1 C% z/ ?9 W
  61. static volatile int irqraised1 = 0;
    - i$ Y5 Y1 D- n. G& a3 V0 e: Z$ U
  62. static volatile int irqraised2 = 0;: G/ C) X8 q) o, D5 c* o$ B
  63. + T, c( {" h2 U3 |. q8 F* C4 ?. o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - q. ^8 q& h; }/ p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , f" A+ {; z# Q+ @$ N3 Z2 _5 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + @- q+ _, I, a+ `

  67. $ }- k! O8 B# f: f; ]
  68. dma_addr_t dmaphyssrc1 = 0;% [& ^. m$ p5 k- K" w  W
  69. dma_addr_t dmaphyssrc2 = 0;
    ! ~7 c9 M; i7 T+ B% s' \6 j
  70. dma_addr_t dmaphysdest1 = 0;' D3 o: A( X0 ~
  71. dma_addr_t dmaphysdest2 = 0;: Z* I* m- K4 a* H0 u9 z/ t

  72. 9 S( s2 J" R; `/ G6 @
  73. char *dmabufsrc1 = NULL;
    # h" P6 Z2 j" f# l
  74. char *dmabufsrc2 = NULL;& q3 L% V, O0 }7 u! N0 S
  75. char *dmabufdest1 = NULL;
    6 }6 h+ p% u5 [  a  ^* R; i, ~
  76. char *dmabufdest2 = NULL;5 |. h* o/ R2 X

  77. ! }5 e8 ]2 r) `, l! l/ B6 A; s
  78. static int acnt = 512;
    9 K  y' D& ^4 d2 G+ q6 T
  79. static int bcnt = 8;5 i* ^- S( ^* V/ i; B
  80. static int ccnt = 8;; b$ e5 z4 z0 f; w: s

  81. 7 ]; W/ m1 [+ m0 W9 |/ B) b) u
  82. module_param(acnt, int, S_IRUGO);
    # P3 _# a* p! X  _1 j1 O0 b
  83. module_param(bcnt, int, S_IRUGO);5 g3 P$ J: W4 u* Q3 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 M- ]# v9 B) m
$ c. }- [% ?9 A. T) h8 J, e3 H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: k4 ^/ n8 b) I% \+ t- Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# ?1 q+ H+ P. ]7 k8 v1 d: |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# s: N6 G& S4 r& t8 V1 g1 m
& ]/ v' H7 w+ U% @! P) O+ V
5 \9 l9 t. G9 h: Q2 r6 O# k# g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 14:01 , Processed in 0.038555 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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