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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 v7 T4 _8 x8 b
  1. [code]EDMA sample test application1 V# c6 K) ^6 k+ M8 P. S! d
  2. /*
    . N7 e: [% T9 F4 W' m
  3. * edma_test.c
    " L$ m. A6 f; b- j
  4. *; B* m0 b1 X5 w* F* F0 s  e
  5. * brief  EDMA3 Test Application
    3 u* E* R/ u6 {5 I7 l
  6. *% y7 i2 r. ?* a
  7. *   This file contains EDMA3 Test code.
    , F2 M9 I7 `! ?' h2 G, ]7 m
  8. *' W- Y& ?( G8 |+ _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . Q' ?+ x8 P, E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & B& |; E4 c$ f6 W) \! i+ m
  11. *         TO CHANGE.
    & M. {- _6 @4 s: @) E$ z5 Y
  12. *
    0 J9 Z5 C) y, r. E  v0 I! m' L! m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 y. \. G* V; ]6 \, C$ K
  14. *
    " A8 X# N  y, m" ^9 V, e
  15. * This program is free software; you can redistribute it and/or
    - t1 l& P* P. F% Z+ O
  16. * modify it under the terms of the GNU General Public License as8 f) y) u3 [7 X; I! \8 D
  17. * published by the Free Software Foundation version 2.
    1 k4 G* \" }3 {( ~% A/ c. `( Z0 g
  18. *1 g3 u1 b# Z" o% L. R+ n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" d4 G* W+ G* L
  20. * kind, whether express or implied; without even the implied warranty
    2 H. G3 c% f, h1 V" E1 @- w0 N9 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" Y2 `4 M; H3 x  o3 S# i. m- M6 ?3 I
  22. * GNU General Public License for more details.
    4 A0 c, [1 ~1 X4 H) O
  23. */# h7 r- W& t  N$ K# |. X

  24. ; [( L  c2 y1 s
  25. #include <linux/module.h>2 {4 v" o  J0 b: |% I/ r3 R
  26. #include <linux/init.h>
    . y6 O' _- u% ~5 f" U/ S1 u" S
  27. #include <linux/errno.h>
    . ?& P8 q" B' b
  28. #include <linux/types.h>( P2 n8 W& I; x5 h
  29. #include <linux/interrupt.h>/ n7 y4 ^, O6 i3 ]0 ~
  30. #include <asm/io.h>' h  b3 _% u7 M! G: p) G
  31. #include <linux/moduleparam.h>) Z7 V$ w! `6 L( t" d$ h
  32. #include <linux/sysctl.h>, h/ X4 @% I) W' o3 W- G8 b* U6 `5 C
  33. #include <linux/mm.h>0 q! ], k/ }* F& F2 [! y
  34. #include <linux/dma-mapping.h>
    - C5 x: I- q  [$ u5 X  _' v
  35.   Y2 y7 s8 J$ R4 f/ Y$ p0 u
  36. #include <mach/memory.h>
    " W. t, @7 L5 c" O
  37. #include <mach/hardware.h>
    / `$ {5 n  u% L, x7 M
  38. #include <mach/irqs.h>: ]' M4 R2 k5 l4 b0 y; @
  39. #include <asm/hardware/edma.h>
    1 k6 x+ g- Y; i/ T  i1 R) a* f
  40. / z4 p+ Z* U4 B9 {% K
  41. #undef EDMA3_DEBUG( Y; Y) \7 `8 e7 F2 F
  42. /*#define EDMA3_DEBUG*/7 r! c6 f% ~( p  I
  43. - j! J" d+ E. p  C# ^/ }& [! ^
  44. #ifdef EDMA3_DEBUG( _& e7 _" x1 U4 `3 ]5 C) ~/ b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), m/ y8 Z& @7 d" L5 ~2 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), u8 l4 d7 ?) E  O2 e8 [! C2 M" w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ U- V& C- ^, h" @9 v7 |# y
  48. #else- g/ S6 K1 Q% j7 a% ^. h" l" T2 u3 M
  49. #define DMA_PRINTK( x... )
    ) y4 D. k8 p( s8 q9 v# t9 B
  50. #define DMA_FN_IN5 }: Y6 |! h! N) C3 A
  51. #define DMA_FN_OUT
    3 M  V& X' i8 |- u, f; }$ [
  52. #endif1 S0 F7 J: I9 _8 ]6 G8 |- a0 \
  53. ' A8 `$ _2 G6 a+ t8 v$ J2 L8 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 z; d; S) c! m* W- |
  55. #define STATIC_SHIFT                3; H  y0 q3 c4 g% p$ w! ]
  56. #define TCINTEN_SHIFT               203 y/ q' d; `1 e9 ?% C/ e2 C' K. I: `! I
  57. #define ITCINTEN_SHIFT              21! t1 j% N5 Q$ k, J8 K4 ~+ z4 I
  58. #define TCCHEN_SHIFT                22
    5 j  ~6 ~4 g1 [& u3 C! o9 ?! b$ m
  59. #define ITCCHEN_SHIFT               23
    7 L; S0 X$ y& r8 C

  60.   n- N. K4 ^2 h$ v0 |' g
  61. static volatile int irqraised1 = 0;
    ) U! [  u& n- o% w8 m  u" m4 ]
  62. static volatile int irqraised2 = 0;
    0 a1 V* V4 k& U1 s& F: a5 w

  63. * {- O1 ?' S. s3 c! X; x/ m! T8 ?) o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) T; Q4 F8 R5 z) e: h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 c: K4 h# r1 C" t9 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% d5 k$ M; o9 ]* m% F6 U
  67. ; K- r! S) K) x* q3 f9 }+ e% w  `! }
  68. dma_addr_t dmaphyssrc1 = 0;
    ! k- ]6 e7 W; }& {: h
  69. dma_addr_t dmaphyssrc2 = 0;8 |5 P$ e  K* A# v2 j. M5 A0 U0 Y" P
  70. dma_addr_t dmaphysdest1 = 0;
    ' s1 D0 m/ @! l6 O# @
  71. dma_addr_t dmaphysdest2 = 0;
    2 ~4 R: m/ d- E7 ^8 H
  72. " \' H1 O5 R  C: ^
  73. char *dmabufsrc1 = NULL;: T" O9 u8 ^% W: S! s. C: _- D
  74. char *dmabufsrc2 = NULL;, L$ y- N9 j. o$ m2 Q) A( f
  75. char *dmabufdest1 = NULL;
    ; F; h" E0 F* }5 M
  76. char *dmabufdest2 = NULL;
    ; ]2 l* f; \8 _) K" p" Y

  77. 9 h; \% J* w; y* n
  78. static int acnt = 512;: W/ X2 G6 {, ~" v% _% m' y
  79. static int bcnt = 8;
    ' h! s: L6 e4 z, P& b, [# m
  80. static int ccnt = 8;
    : u, ~) T9 B' {/ I1 c; u: b
  81. 5 W# W1 A9 g/ |+ b& Q
  82. module_param(acnt, int, S_IRUGO);
    ; o2 h3 h8 s+ L
  83. module_param(bcnt, int, S_IRUGO);+ l* a6 q. q9 {) Y. R5 V2 s  ~. [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ j, c: `- ^: G7 ?) Q$ @

; p6 r, G) [6 ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& }* C  O( x  o7 Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 J7 |8 I1 Q! F! ^7 K9 r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 y  ?6 E# R# m/ X1 t
6 j3 g9 g& ^8 f7 w: p1 q. F* J& s0 X8 @. `6 O4 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 17:42 , Processed in 0.040474 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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