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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # R* L: R- D  n( v. O
  1. [code]EDMA sample test application
    4 d% k0 g  v. @, s6 Z# p' t4 Y: Z
  2. /*% e; n4 J) {) R, H$ E+ K
  3. * edma_test.c: P4 `$ o' s& B# g* ~" Z+ y
  4. *
      f- v+ |* l" r& ?0 t0 w* d7 u& ]
  5. * brief  EDMA3 Test Application
    & {7 |4 }* n, f  x9 Q" R# k+ f: D
  6. *
    $ [2 n% ], K$ C( n& p+ W. s
  7. *   This file contains EDMA3 Test code.& h( \6 [* C# h
  8. *
      E# j( ^8 {1 @& L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; ?) q! {. e, D9 V3 `8 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: m" F- M0 h8 X: y) X; y
  11. *         TO CHANGE.
    ) g; I1 m9 \, e8 ~3 D+ N7 |
  12. *
    $ R( I! l6 g$ k2 h: q. j! c  w+ c& k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, h% N- g. Z! D" h
  14. *- I9 H4 E) d, M& M0 o7 ~
  15. * This program is free software; you can redistribute it and/or
    ) u  ]2 H+ n* c9 a9 r% x+ P- \  W
  16. * modify it under the terms of the GNU General Public License as* u! y" O/ i! X4 d: W  K% q  E* V
  17. * published by the Free Software Foundation version 2.$ \; Y  h; p* u' x8 f3 n% A7 D
  18. *" W" X- _& D) @; K1 l* s! q4 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & i; F- c1 h) |
  20. * kind, whether express or implied; without even the implied warranty( t3 {" I" R+ g# c' b$ t& S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : g. g' D  E' q) c* D. C  E/ p& ?/ v
  22. * GNU General Public License for more details.
    9 J. _) _  z, p
  23. */9 h. n  {2 d. Q5 v
  24. ; [. [0 `8 s4 I: C& `
  25. #include <linux/module.h># L* o6 A% t- k" V& j4 O
  26. #include <linux/init.h>( Q7 j+ Z. j! A: {* P
  27. #include <linux/errno.h>/ l$ E# }. V7 W2 P
  28. #include <linux/types.h>
    & ?: ?  N9 C/ C2 d6 O
  29. #include <linux/interrupt.h>, Q' X( G% j# T* a9 O. v4 M- `
  30. #include <asm/io.h>
    4 F: B# H& I& r  a6 ?
  31. #include <linux/moduleparam.h>) ?3 _9 w. x! i# v+ H  _
  32. #include <linux/sysctl.h>
    . Y4 Q5 g' [, a  K7 v' m8 O2 {( G
  33. #include <linux/mm.h>" m8 y6 M7 y# D% L% _$ s
  34. #include <linux/dma-mapping.h>
    - n- V. x% n  ?) X9 u" Q7 V
  35. - q( ^( {4 [7 ~6 ^9 g, M
  36. #include <mach/memory.h>
    $ O- p8 L- v5 P: q3 E/ q7 e
  37. #include <mach/hardware.h>
    , S9 Z( K( B7 I% [5 s
  38. #include <mach/irqs.h>
    ( C' @/ B9 Y3 Q% p+ `  C
  39. #include <asm/hardware/edma.h>2 h& I* Z$ H6 Q3 Y1 y; ?: M6 c1 a( {
  40. 7 c. Z, ]  E  y6 {, C7 m
  41. #undef EDMA3_DEBUG# X, U  t9 Z% f/ A
  42. /*#define EDMA3_DEBUG*/
    ( \6 M# w2 M! x5 @3 r
  43. ! B) u! w9 E0 O7 Q4 w2 d
  44. #ifdef EDMA3_DEBUG, f" n: F' N# T. w/ J$ ?1 A4 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  D8 j( s3 E/ q- [5 r" q5 |# N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; p3 F# B+ j! P; W' z& ]9 f* ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( I) N; z9 u6 q5 j( d
  48. #else+ P* o- w& a1 R
  49. #define DMA_PRINTK( x... )( P8 i3 L1 V4 {6 ^
  50. #define DMA_FN_IN9 o7 R/ A6 w, O7 a
  51. #define DMA_FN_OUT$ P7 A6 }2 l: }- h3 S9 Y, ~7 U% [
  52. #endif
    + B* I* a" e9 O
  53. ( e1 O. [& H$ P4 e5 |% z, E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , f. z: D# q7 ~! g1 \
  55. #define STATIC_SHIFT                3' [. \/ f0 C7 L. k: \
  56. #define TCINTEN_SHIFT               20* k, q( e% A5 R: F5 \5 l: j
  57. #define ITCINTEN_SHIFT              21
    * Z; L1 v) L6 k
  58. #define TCCHEN_SHIFT                22
    # w2 O( j' ]1 q+ h& Y+ o, X
  59. #define ITCCHEN_SHIFT               23% K4 f8 z3 k& Z5 E# s

  60. 8 w% g+ G$ g2 a$ a: w
  61. static volatile int irqraised1 = 0;
    2 F  C1 K$ g" J& |' K
  62. static volatile int irqraised2 = 0;
    * m7 ?9 E. n' X7 z: r$ L( J/ ?

  63. 1 f3 m5 N0 D9 M# _+ C$ ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% n: x. ]% r! l1 h5 [3 d( W  y$ o% F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" B) ?5 O+ w2 i1 r; m- J+ D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; l) h. [$ r! e5 B8 t, F
  67. 6 x- w2 u( Q# E. a
  68. dma_addr_t dmaphyssrc1 = 0;$ ]; y- n5 g8 o3 M, C  s
  69. dma_addr_t dmaphyssrc2 = 0;
    - Q# E( M" ]0 h
  70. dma_addr_t dmaphysdest1 = 0;' ]$ Z* X; ?0 W* U
  71. dma_addr_t dmaphysdest2 = 0;
    2 x# Z8 S5 I6 ~5 u

  72. 7 G* _2 D/ P4 p5 L$ I# f. c& r( B
  73. char *dmabufsrc1 = NULL;
    0 i% K5 W3 k1 L
  74. char *dmabufsrc2 = NULL;' S& t0 B6 j2 [0 c/ j# \8 q3 M
  75. char *dmabufdest1 = NULL;
    , Q) j) Q3 B1 A
  76. char *dmabufdest2 = NULL;
    : H7 I5 I0 I3 X8 {

  77. . l2 y6 Q1 ~) D4 U& @8 F
  78. static int acnt = 512;
    + B- c( {3 T8 g4 Q5 N% Q
  79. static int bcnt = 8;! }# M- d! {9 d- s$ S' p6 w/ a5 z& ~
  80. static int ccnt = 8;
    0 V. {9 }" c- j6 }! l1 r

  81. : P  D$ [9 x' G( q3 `: j! C! y
  82. module_param(acnt, int, S_IRUGO);
    : _- P0 C( I  q) @) M
  83. module_param(bcnt, int, S_IRUGO);8 R6 b6 {. X$ V; a; R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# |+ ~, P: y3 R$ M

8 i& ~) M- i6 _# [+ c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 A. a/ _$ M4 o2 b5 M3 @6 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 [' a' r5 n7 G: y  n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 h1 ~% q5 l! S1 @( `7 S

. E8 ^- {* _* c& |4 w# ~/ F0 u5 m9 U( F: l. L) g7 `# h1 k- ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-20 03:39 , Processed in 0.040452 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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