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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; ]# f- r* c" A6 O
  1. [code]EDMA sample test application# O' h/ x8 B/ X1 p" i' ?9 a
  2. /** ]: A' v$ T- i9 `! M+ J! c. X
  3. * edma_test.c5 j& e; W1 O2 B* A8 t
  4. *! y- Z0 n. p& p8 l
  5. * brief  EDMA3 Test Application. B& J/ u& _: x1 X  L% Y
  6. *
    3 |6 {1 o: }! E+ u& _9 t
  7. *   This file contains EDMA3 Test code." p) U; W! h. W$ p6 O0 V: ?7 ^; X
  8. */ P" z$ N* b! W4 L5 @! N7 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) Q/ z& |. S. q- U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ [+ ?" u  H* _+ ?' l: Z
  11. *         TO CHANGE.& @/ N% Q% \" P$ S
  12. *: P. [# V0 A" c  W" u& N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' E3 S! m8 z% j
  14. *
    ( y' H/ m. P, a% X  E. j( `
  15. * This program is free software; you can redistribute it and/or
      |; x* b4 F$ B0 H! `
  16. * modify it under the terms of the GNU General Public License as- l+ ]; }' i* O8 W
  17. * published by the Free Software Foundation version 2.
    4 t% V1 W; O. d2 O5 D/ }
  18. *; f. d9 @$ h& Y6 M5 X! x0 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 W0 }- R9 G  G4 ~1 v
  20. * kind, whether express or implied; without even the implied warranty
    % B- U9 k3 E# Y  z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; X6 c8 l0 I! z4 M( y5 y  q# _: S
  22. * GNU General Public License for more details.4 ?! l  w* D; ?7 P5 I+ A+ g2 y
  23. */: @( G) p; m1 V* ?( T! Z+ Y# ~
  24. $ h8 |& r7 [' m! P4 k4 i& j
  25. #include <linux/module.h>" c7 u4 Q: l, `# }% k9 E6 J
  26. #include <linux/init.h>
    * O$ k2 K/ [2 f
  27. #include <linux/errno.h>( ?7 v0 O# y2 i: x# ~" L2 D
  28. #include <linux/types.h>4 N- B6 B& @/ V- o' n
  29. #include <linux/interrupt.h>0 K* n0 ?9 k5 W
  30. #include <asm/io.h>
    ) K# W6 e' ~. E4 b' J
  31. #include <linux/moduleparam.h>
    0 Z) B! j6 S' y' \
  32. #include <linux/sysctl.h>
    , Z( c- l. n3 J9 A1 E, \
  33. #include <linux/mm.h>
    9 w/ v6 U  a8 {0 j
  34. #include <linux/dma-mapping.h>4 B# ?. O. j% z& p5 M5 n

  35. ' q3 t$ f) W, d
  36. #include <mach/memory.h>
    & H+ ~( o9 D! M# G8 D0 Z; S6 h
  37. #include <mach/hardware.h>( {1 V" ?, R. z$ s0 y
  38. #include <mach/irqs.h># ^3 i( [+ a" k5 b! j" N% f# ]
  39. #include <asm/hardware/edma.h>3 ~2 u0 U5 @% Y& a- t( S

  40. 3 P3 N6 L) h/ b0 b9 G$ Q
  41. #undef EDMA3_DEBUG, X. M1 o+ ]2 ~2 h0 l+ D9 K
  42. /*#define EDMA3_DEBUG*/
    9 {: K  ]! t' }/ z8 i
  43. 6 h! u7 K  y7 y9 j
  44. #ifdef EDMA3_DEBUG) Q" O3 I: n& Q" J( {% |# q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! {2 T% y- e8 W! X# V1 {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 s) S8 e8 o' f' m4 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( R7 c% J7 C4 J+ ?9 j6 f% o
  48. #else
      K+ m' n0 B; b
  49. #define DMA_PRINTK( x... )
    / H3 E6 {, v8 z4 _
  50. #define DMA_FN_IN
      Z) F6 h4 f: T$ s
  51. #define DMA_FN_OUT
    ( C- R6 f* J) c3 S) w/ i
  52. #endif. j" |7 C, p9 d# u2 r7 O  p+ j9 z

  53. : `6 {2 H+ k. t6 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): }% g* `/ I& p) b
  55. #define STATIC_SHIFT                3  B1 w3 S, r6 Q
  56. #define TCINTEN_SHIFT               20
    9 N2 p+ J2 }. X" P  _
  57. #define ITCINTEN_SHIFT              21) e1 J8 b  s% x7 D; m- n: ~' |
  58. #define TCCHEN_SHIFT                22
    $ U4 z; u5 H9 D0 F: n8 `
  59. #define ITCCHEN_SHIFT               238 U+ q$ r6 W. ?' K: @. X1 \2 x

  60. . N$ R) A/ a8 y2 u0 @
  61. static volatile int irqraised1 = 0;- Q5 G$ M# p& ]8 O6 i& [: P( c6 i
  62. static volatile int irqraised2 = 0;2 g2 d- n3 @( B. k% z; G" [
  63. ( a: F; z- ]- {2 k, n  [" U0 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% T6 E$ Y& q6 i* T6 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% X( [" R. z- s. p  I6 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - X; v5 G& g4 t9 r+ L
  67. 8 h' W: {( a- g0 z
  68. dma_addr_t dmaphyssrc1 = 0;5 p) f$ C, H0 r  g
  69. dma_addr_t dmaphyssrc2 = 0;
    , M& {; b( h' ?5 V
  70. dma_addr_t dmaphysdest1 = 0;7 L; e% l8 A9 x" t5 `
  71. dma_addr_t dmaphysdest2 = 0;
    9 k0 r4 i9 e+ ?! L6 l6 k

  72. ; ?! r4 E, X2 Y) z( D0 T
  73. char *dmabufsrc1 = NULL;
    - @* t8 [0 F: w+ i
  74. char *dmabufsrc2 = NULL;
    / v' P" Q1 w& X$ W. o" v2 q, S) p; r
  75. char *dmabufdest1 = NULL;, j8 m, H( \9 |  t8 _
  76. char *dmabufdest2 = NULL;
      E+ x/ i6 x) w9 J  ^

  77. ' N" q5 O" F1 m7 T' b
  78. static int acnt = 512;
      v  n3 c" \0 i5 F
  79. static int bcnt = 8;
    ; X4 }: ]- z+ }' {* R. V
  80. static int ccnt = 8;
    + m; r, Z6 N/ H: q

  81. ( b( ]4 P& _( ?) V/ s: _
  82. module_param(acnt, int, S_IRUGO);3 U7 ?  @/ C5 V2 @3 V4 X7 m
  83. module_param(bcnt, int, S_IRUGO);& ~3 S) W0 K. R% k. Z: [) R) r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! ?; |) c7 ~1 G4 p
. g: N  E5 I. e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 |0 A/ u: v$ I: x. M- W. s+ v
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ v+ p( h( g2 F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 D4 c% e$ Y1 v& a9 F
6 z+ `9 P8 C9 Q) r* i, ]+ i: d+ r5 L) w
# k8 g9 x* a4 L4 A; Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 15:07 , Processed in 0.041251 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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