OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- m. b, O; B9 {0 T8 k6 ]5 q' v1 s
  1. [code]EDMA sample test application
    2 S6 `( Y3 g- K- \) G
  2. /*
    # T3 n; x7 G! M5 }) a8 z
  3. * edma_test.c
    ( w9 g" g, C! z/ T
  4. *' e- y2 e& ~( R) W& L. Q
  5. * brief  EDMA3 Test Application$ Q5 _$ ]6 S. ^4 P& D0 C( k! P
  6. *
    - I3 z) O: t6 I
  7. *   This file contains EDMA3 Test code.
    1 Z  T! q8 }6 @" }; n. d
  8. *
    4 y' `, n2 F  y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 m* k1 Y; ]. c  K" T* W# k; }6 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, K: v6 h' r' M& G, h
  11. *         TO CHANGE.
    * O" @7 i2 ]5 [2 a4 l+ {& ?. Z
  12. *: x( _) l3 ^' z# s: F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; m0 d" f" H! E! E1 I! l( f
  14. *
    , R0 v+ p% j. v& E" \2 {
  15. * This program is free software; you can redistribute it and/or
    3 U* f9 I& N- j% q! y
  16. * modify it under the terms of the GNU General Public License as3 M" K+ H- p; j' M* w$ o
  17. * published by the Free Software Foundation version 2.
    ( h7 g( v. Q; l+ H  z) X
  18. *9 G3 E4 c$ y" `1 C2 w% B% p3 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 G1 ^0 N( T. y) `& S* W# ~' @- A  h
  20. * kind, whether express or implied; without even the implied warranty
    $ k6 S. M9 N" {, E. M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * G9 K- Q: @6 L- Y! _/ ?
  22. * GNU General Public License for more details.8 X' p+ Q& }: n' c" m) t+ y, K
  23. */
    ! ^+ P* V4 U9 O4 w$ k

  24. 1 R# S1 w4 p& b8 L/ w1 J2 `) U
  25. #include <linux/module.h>
    ) m. L% f% P/ m& V) N% |* ]
  26. #include <linux/init.h>( y$ }0 t+ V( j8 W
  27. #include <linux/errno.h>' W7 U- L* \  R; I0 u
  28. #include <linux/types.h>9 J( _7 V* p9 U5 `' s0 p- G
  29. #include <linux/interrupt.h>
    ' e$ U$ Y# \; \$ q, Y
  30. #include <asm/io.h>
    , y4 z' c, ^* k  v6 x2 {) e6 _
  31. #include <linux/moduleparam.h>
    3 I4 s9 ]; m+ ~
  32. #include <linux/sysctl.h># I. a: g- X! f' D/ @+ J  c- S
  33. #include <linux/mm.h>
    6 k" p5 j" ?% V" C% r0 L
  34. #include <linux/dma-mapping.h>
    , S, u2 v) g; N) R0 o1 o2 I+ E! u) T7 F1 `
  35. ( g9 R1 G1 G6 I
  36. #include <mach/memory.h>+ D9 j5 Y8 K" w7 S6 A1 S4 G- U& M
  37. #include <mach/hardware.h>
    2 ^" m5 q) g+ ~- L
  38. #include <mach/irqs.h>2 z8 f9 U0 W' H
  39. #include <asm/hardware/edma.h># ?, V4 a; A/ r5 d5 ?

  40. / [+ X. p, T9 _' [/ K
  41. #undef EDMA3_DEBUG
    4 j& c5 l; f2 H5 s
  42. /*#define EDMA3_DEBUG*/$ U5 M' E: }7 k" c, f1 T8 {8 A
  43. 4 T, X1 q3 t1 ]* q
  44. #ifdef EDMA3_DEBUG1 F  w6 {4 i+ @) H) P$ E. E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 L/ g" f% D& Z( W/ r6 b* B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 d1 g. q. i! R4 I% _6 n* p3 O" [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : j' T' i2 E4 S2 l
  48. #else& ^4 a( Q) f4 @$ l, c- R
  49. #define DMA_PRINTK( x... )
    # s( S7 s4 `7 x( s. x, m
  50. #define DMA_FN_IN. q/ ~4 U: u; d6 a1 C; O
  51. #define DMA_FN_OUT
    $ S" f" y5 A3 g8 b: {" P
  52. #endif& D( W" ^1 Y% \2 o1 I/ K  }/ ], S9 ^
  53. ; }1 l. ]& T/ O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 V* _3 ^( t: M8 n0 O! \
  55. #define STATIC_SHIFT                35 Z" P* E- S: E) T+ S
  56. #define TCINTEN_SHIFT               204 p9 G2 Q. l5 Q0 q4 j" O( `) [5 \8 R
  57. #define ITCINTEN_SHIFT              21# h9 v/ ^; _& N4 Y( B/ O! M
  58. #define TCCHEN_SHIFT                22* S3 u$ k& [  _
  59. #define ITCCHEN_SHIFT               23
    3 O% I' W. U% `6 o+ I% f; |+ w
  60. . }$ S+ g7 h3 ?( S; ]! H. h: b$ d
  61. static volatile int irqraised1 = 0;" d( f9 L' Q; m
  62. static volatile int irqraised2 = 0;
    & y- K  i& y: Z6 m6 M

  63. 1 J" r/ e% p3 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ x& x" o: n; a8 Z9 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ }& @( M0 q' a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" d% H9 B3 t  o* z0 x7 K
  67. 5 x8 O* Q* y/ I: W% ]
  68. dma_addr_t dmaphyssrc1 = 0;5 p4 i4 V6 r0 ^8 H$ w+ n
  69. dma_addr_t dmaphyssrc2 = 0;
    0 \; Y  f. _# |( }! g
  70. dma_addr_t dmaphysdest1 = 0;
    $ b7 `& N# J0 [: s: H8 L# H
  71. dma_addr_t dmaphysdest2 = 0;
    / B; S: c' j& ~$ T" ?. D

  72. + a( ]" E/ x0 o
  73. char *dmabufsrc1 = NULL;
    # B. ?6 E. f* C9 F& }
  74. char *dmabufsrc2 = NULL;
    ' z- V7 U/ P8 p+ P( ^% x8 \. Q
  75. char *dmabufdest1 = NULL;' w- |/ ^' ]1 R$ R/ D* s
  76. char *dmabufdest2 = NULL;
    5 u' E' m$ L) ]+ r1 F# s% v
  77. 9 l' Z# v+ m& e; N" L  C
  78. static int acnt = 512;
    # Y. U9 B( a" M9 N2 `5 A
  79. static int bcnt = 8;/ o4 Q+ C- m1 U9 }9 x, T
  80. static int ccnt = 8;
    1 P& V( G# q8 B" c9 _: P* v
  81. 1 O, z9 R  {0 s/ @
  82. module_param(acnt, int, S_IRUGO);6 }; h3 Y" Y4 @  c$ ?9 {* C/ N
  83. module_param(bcnt, int, S_IRUGO);
    8 R% g/ g4 q) a" ?; }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ i  T' J7 w1 }- p+ ^( s
, {# F- K4 ?6 Z% O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 I6 T$ U8 _) `; Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! H& B3 I* W1 V) y8 x5 _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ i+ i4 ?0 w( n  A4 o- t, S8 Q; m; Z$ ]4 W& A* H0 G

4 M# `, F; u  ^6 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-1-27 15:36 , Processed in 0.040614 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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