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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 c9 @" n" G/ L! M( r3 {% @0 |6 ?
  1. [code]EDMA sample test application
    5 H8 B5 o/ |* y/ n2 V5 ^& `, |* O5 w' ?7 U
  2. /*, l' |8 x% q1 X: {7 ^7 b
  3. * edma_test.c% |6 M/ c+ n; _: B
  4. *8 x7 m3 y7 Q& j8 U7 F2 W4 N
  5. * brief  EDMA3 Test Application  k: c4 g3 t, v) B
  6. *& \5 {" }6 H. ], o- p
  7. *   This file contains EDMA3 Test code.' s2 C3 t3 N; l9 c* l- ?0 A5 `! g
  8. */ |2 F, L2 A/ k$ P. P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 A. b. E/ D2 ]2 `& G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' U. H( s2 N& ]* S. l! A
  11. *         TO CHANGE.7 Z, h( b% R- D5 l/ p1 @
  12. *
    9 v5 }; g" l: c) i  o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 V; h0 _, R9 {5 Y# N9 w2 O
  14. *# S4 p( X8 I* a+ T1 x/ H
  15. * This program is free software; you can redistribute it and/or" q$ a; {) A1 B$ K+ \
  16. * modify it under the terms of the GNU General Public License as! E0 L% f4 j% h( ]$ i" a
  17. * published by the Free Software Foundation version 2.# I$ Q5 j; P7 A& `  B
  18. *
    : n% s" v" t( l  B) }. j9 L0 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  l8 i9 V: ]' h$ Q" I4 x7 Q1 Y
  20. * kind, whether express or implied; without even the implied warranty
    % }3 h6 d# {- F0 w+ Q" _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 c! h4 [. N+ ?& O
  22. * GNU General Public License for more details.
    + f% k  B0 [, N$ o9 ^0 U
  23. */. T* ^0 i" F6 g, a
  24. 1 U7 x) B. G5 X" d& ?
  25. #include <linux/module.h>
    / Y' {4 S3 J9 i4 D4 T2 R
  26. #include <linux/init.h>
    % C. M' l  P! {/ j
  27. #include <linux/errno.h>
    6 f8 K8 F2 K# ^7 S; M, L$ y- ?
  28. #include <linux/types.h>, x- r* l) l7 [4 @# l
  29. #include <linux/interrupt.h>
    6 o4 O' t8 H  q) q9 h3 J- T
  30. #include <asm/io.h>
    2 }* h( f' M( c! [% \/ U
  31. #include <linux/moduleparam.h>" z4 m  i! x0 ], p0 t  q
  32. #include <linux/sysctl.h>( N  L) Q3 N8 g/ C$ Z; S
  33. #include <linux/mm.h>
    " E( m/ |) d  [+ T
  34. #include <linux/dma-mapping.h>2 L# b+ P0 r/ U) ]7 w3 R; _1 z

  35. 7 O8 H2 E7 q7 T7 V
  36. #include <mach/memory.h>
    ! ]7 b" ?3 V; w) O$ \
  37. #include <mach/hardware.h>4 I2 q! x' z8 U
  38. #include <mach/irqs.h>
    ! x8 q: U5 E& J4 W" c# }% D
  39. #include <asm/hardware/edma.h>
    1 n. ]/ u* g# q" d$ S( Z& A2 D
  40. 5 q1 b! E! Q# ]! S" a) k2 D
  41. #undef EDMA3_DEBUG
      ^$ m* _2 r; s/ P+ ~2 ?
  42. /*#define EDMA3_DEBUG*/
      p, ?* L% n. E6 |. Z. A) A
  43. : u1 }7 h4 A' s& e( K# v7 s
  44. #ifdef EDMA3_DEBUG' U9 A1 u2 l3 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 N  k) q) l# v$ \, {+ O' j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 c8 F) A0 ~0 U* W5 t$ k5 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 R% ^7 q/ k0 B2 g: v5 S/ s
  48. #else
    , f! C2 u" _, b, l* e7 c$ F. n" j
  49. #define DMA_PRINTK( x... )
    $ K, X: R) y$ h7 O. P. }
  50. #define DMA_FN_IN
    1 E* w& }6 I* g4 {7 C
  51. #define DMA_FN_OUT% L6 k, l( Q8 S
  52. #endif
    * E# |$ s# v4 Q. t% `
  53. 9 D; Q: e, l# S+ M( ^) T2 w4 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ {% a$ `' M0 J) G' u# U8 v
  55. #define STATIC_SHIFT                3
    7 S5 f2 f4 P% E& r
  56. #define TCINTEN_SHIFT               20
    3 m1 n8 t* M# ]3 x: H
  57. #define ITCINTEN_SHIFT              21
    & h$ P. X& Z' l* \4 a* }4 d  B) G
  58. #define TCCHEN_SHIFT                224 |' l8 T6 s% G7 T8 V/ J  |
  59. #define ITCCHEN_SHIFT               23
    " S; @. W2 a5 ]* K8 f
  60.   T+ P( p+ y: d. G7 p. |' r" [4 j
  61. static volatile int irqraised1 = 0;
    1 ~% T% u; O+ L! V7 N
  62. static volatile int irqraised2 = 0;
    % R! x3 @, }& R1 x5 A) v
  63. * E& g$ G6 R7 m, s- v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' f4 c) X# E5 x- o$ {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: S& i) z: b% v: f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 R( l! J0 D- x. i" G! h1 r& g) I

  67. $ ~2 X, I+ K+ n  m. y* |' f
  68. dma_addr_t dmaphyssrc1 = 0;
    3 V$ K- c" i+ t& y
  69. dma_addr_t dmaphyssrc2 = 0;& ~+ M- q5 f! E2 ^% r6 p
  70. dma_addr_t dmaphysdest1 = 0;9 J4 q  G' F6 i$ m1 {7 ?' O
  71. dma_addr_t dmaphysdest2 = 0;
    . v% C5 o9 P) W- o* Z( O0 l3 u

  72. 9 w6 h4 a9 a8 E+ W+ D3 Q6 g4 \6 l
  73. char *dmabufsrc1 = NULL;* I) r0 _+ Y+ K" O3 d9 {
  74. char *dmabufsrc2 = NULL;. N) U- [# j! G0 {
  75. char *dmabufdest1 = NULL;: H& _3 r, I- {) N% |  z- k
  76. char *dmabufdest2 = NULL;
    $ D% N* E6 w) L' d" d! i
  77. & Y/ L2 z# {/ n1 K$ U7 c/ C
  78. static int acnt = 512;
    $ A# n# o0 b* q1 o
  79. static int bcnt = 8;2 m5 ?+ ?" b7 R/ n
  80. static int ccnt = 8;' J. |/ d9 S% _- u2 l2 R# \1 }4 k
  81. # L; f5 h" h* T2 B. @  [; Z* n
  82. module_param(acnt, int, S_IRUGO);
    . t9 O; M- T2 w+ D( ]( w) j! d
  83. module_param(bcnt, int, S_IRUGO);, b$ L  C8 ?" w  u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ l- W/ Z  }, D3 z+ |
  _+ J# N. w- N& Y! K. q9 T. u5 p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: V4 b8 o+ X. V/ oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 x: E4 u7 y* u5 _5 L( |4 i# v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 ?% {/ s0 |3 d5 Z, |" p7 d

! [" V) }$ d: D# Y% U7 n
3 M* w" F; q2 i& w3 L/ L9 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-24 08:12 , Processed in 0.038034 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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