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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ Q2 D+ S, Y  E. J& ~
  1. [code]EDMA sample test application8 N5 \3 I5 r1 h& @6 Y
  2. /*
    + S* f9 E" g& ?+ L
  3. * edma_test.c# O8 t( q; `4 Z
  4. *" x6 g: Q+ j  q1 a
  5. * brief  EDMA3 Test Application, M. J& U# ^! ^  d/ n
  6. *1 U4 \' q6 X2 @1 d, b
  7. *   This file contains EDMA3 Test code.& r3 k: |& B1 S5 H2 [4 D
  8. *( f4 M2 V& W& T2 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ y2 w6 j4 m9 `1 \6 ]1 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 N* g  O- D7 N9 ^+ y
  11. *         TO CHANGE.5 f8 K* p5 a' {  F9 l) h; o
  12. *
    5 O1 B9 S8 |. ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ X8 N0 s4 N, J
  14. *" ~9 m% o$ s( s+ q
  15. * This program is free software; you can redistribute it and/or
    # j0 Z0 y6 D* }
  16. * modify it under the terms of the GNU General Public License as
    % _4 \' S* I" }# F7 T& l) d
  17. * published by the Free Software Foundation version 2.$ z& y0 |7 ]; s: W
  18. *, X# z6 F/ L# s7 H/ G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. S: j- C; A) \( `% ]( a. M2 F
  20. * kind, whether express or implied; without even the implied warranty0 u3 h  i( z: G* Y+ n+ Z+ b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . K) [) U, a; {/ A: z7 M  p% Q
  22. * GNU General Public License for more details." G9 S) j* d, R7 o' C" C  }6 d
  23. */2 D1 S8 S$ ]6 E, p0 K
  24. * Z3 M* ?5 U$ O. c
  25. #include <linux/module.h>
    0 U, B# S5 S; Q& \$ G4 ?
  26. #include <linux/init.h>
    2 F) {' |* O4 \' c0 n
  27. #include <linux/errno.h>
    - I4 V  n) w! k6 |; q
  28. #include <linux/types.h>2 U1 j* N# ]) m) @. ?
  29. #include <linux/interrupt.h>
    6 U" W( l1 n2 m1 ~7 `
  30. #include <asm/io.h>
    6 t7 w, w0 m' \) q- o
  31. #include <linux/moduleparam.h>
    * A' [; K! B6 e& a8 [/ B7 A/ |
  32. #include <linux/sysctl.h>% @* O" }' f; _1 |
  33. #include <linux/mm.h>
    + R* p; c* X$ Y
  34. #include <linux/dma-mapping.h>6 N& Q' t% i# ~

  35. / |& \& l. U( p" U7 P9 u* V# R: U3 R
  36. #include <mach/memory.h>
    9 ^4 \4 M% |- n3 m. H! i; c
  37. #include <mach/hardware.h>
    ; k0 X& H0 Y) X& u  x; X) t
  38. #include <mach/irqs.h>
    7 Q+ i; Z: J3 [+ Q# l
  39. #include <asm/hardware/edma.h>( Z, l# }  y. e( k# m( ^
  40. ! h8 @# ]5 i' P8 L" }' W
  41. #undef EDMA3_DEBUG
    - I& y! i# M) ^$ R; l1 N8 O
  42. /*#define EDMA3_DEBUG*/! y& {5 C9 u# @6 _/ u/ E9 }

  43. & ~% }% h$ C" v% S% s1 p8 ~4 t
  44. #ifdef EDMA3_DEBUG* J) Q. P) _' Z6 j2 D4 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) {9 ?) P& Y( M8 V+ Y5 d9 i$ q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 P+ D2 X. E6 A* l) Q& K6 z( F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , L% u! @, }/ [' ~
  48. #else
    9 S+ x8 t) s7 `4 Z$ r0 O2 ?
  49. #define DMA_PRINTK( x... )4 j* q7 L6 |1 `; G9 B
  50. #define DMA_FN_IN
    4 h1 ^, M. k% j
  51. #define DMA_FN_OUT
    % K( c' f( v; {6 P  j
  52. #endif: r( x  a0 q( @; H8 f
  53. ) m( L/ V- {+ q' u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' g! R" j1 s- H/ i4 T+ S
  55. #define STATIC_SHIFT                3
    # y" U# @& F4 X/ r) w- N: a
  56. #define TCINTEN_SHIFT               20
    7 h( Y: k& b, P+ E9 H! {
  57. #define ITCINTEN_SHIFT              21# B7 h, b9 b) E4 N
  58. #define TCCHEN_SHIFT                22% J, s) [/ x' i$ {- t
  59. #define ITCCHEN_SHIFT               23
    ' K) t; G( F5 w9 j4 s* R
  60. ( y9 {8 n) v/ F0 e) H2 [! U
  61. static volatile int irqraised1 = 0;4 D2 l- X  u  _5 }3 {
  62. static volatile int irqraised2 = 0;
    6 k, i( k6 M: \  E& _
  63. 7 l1 C7 `2 b! n( r' J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ~1 U( U) a( F  e! [3 }! a8 z9 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # F( O6 u. y8 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( a/ N' ?: b5 o* i$ q

  67. : n6 I1 c+ n& z8 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    ; v! \6 }& {; K0 t
  69. dma_addr_t dmaphyssrc2 = 0;+ w/ T  w8 E3 W/ a' w! L
  70. dma_addr_t dmaphysdest1 = 0;
    3 L8 `% |* h% `7 N( U& X
  71. dma_addr_t dmaphysdest2 = 0;9 Z3 C. g' l; Z) }; m

  72. " M  c: w- t" [0 h+ W2 W
  73. char *dmabufsrc1 = NULL;
    6 o1 p5 a* a) U( s' J" d2 t+ _
  74. char *dmabufsrc2 = NULL;1 x& w% v* a: J
  75. char *dmabufdest1 = NULL;. h9 a: j% c8 _: X/ u1 ~9 }
  76. char *dmabufdest2 = NULL;0 A* O8 N) w- r% y0 O

  77. , U8 q. z( c) z
  78. static int acnt = 512;/ i# k" t: Q( J7 M) J' F$ w
  79. static int bcnt = 8;4 u" u  L1 b5 k, \" U7 ~  @
  80. static int ccnt = 8;% O8 J8 A1 S$ v2 T: l+ c0 R

  81. : U8 v0 F; M  i! g" k9 r
  82. module_param(acnt, int, S_IRUGO);
    6 n7 ?+ \' a8 j5 j
  83. module_param(bcnt, int, S_IRUGO);
    0 B4 H  d3 u8 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" F# C7 @" H, E% E+ {
* S  q8 A0 V9 y4 Y: b- M0 M7 I& N% Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  i6 h# p4 ~1 v$ z. g) J6 J' H, Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, n$ x' ~- F) a4 a# q$ |; o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 J0 @. \/ n3 \- e9 r9 {6 f
  I3 m5 j8 j' w1 k$ a3 i+ T8 w# S, B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-22 09:23 , Processed in 0.037852 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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