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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 y" ~$ W! G8 Y6 U! ^  s$ q
  1. [code]EDMA sample test application
    # u7 H0 ]9 L- x# _) R
  2. /*
    + V& S# g* L2 R: G
  3. * edma_test.c
    - s" [! R; u9 F1 d$ t
  4. *
    * ?3 J* v6 L$ f
  5. * brief  EDMA3 Test Application- j  @5 M$ O5 c/ A
  6. *
    ) s  m  p# G& d8 h
  7. *   This file contains EDMA3 Test code.; _- \7 Y; _! p1 h$ W
  8. *0 @6 Q, P- r. v5 c$ y( R! w0 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 U: j, ~' _  `5 n! ?' u( \. @! K1 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * p5 ?" R& q: B0 _- Y8 B
  11. *         TO CHANGE.
    , b2 k& W# u0 |! ~# F
  12. *
    0 \8 j  N( d6 C' |. v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 _+ |. S( X3 G& ?# ?
  14. *
    # Z' L, `" }0 Y9 x9 z/ A+ k
  15. * This program is free software; you can redistribute it and/or
    2 @- o' T3 s) ~/ f- m
  16. * modify it under the terms of the GNU General Public License as
    " M$ s( S/ \5 W, H0 k, s
  17. * published by the Free Software Foundation version 2.
    - c2 s" \/ x' x( V- K! p
  18. *& a! S: M' E' u% r' E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 i3 x! p" `( z
  20. * kind, whether express or implied; without even the implied warranty
    : V, ^" m( Q  p( {2 H0 ~: a! l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* g& N3 S6 B; z2 T
  22. * GNU General Public License for more details.1 Z/ ~3 t5 t  z) Q0 m
  23. */
    & c) Y- c. Y5 N' e- d  N
  24. ! d2 _* |8 C4 p, P1 n3 c! }3 O
  25. #include <linux/module.h>% _8 O& t9 t- P  \5 ]
  26. #include <linux/init.h>
      w; U. l! a9 U  L
  27. #include <linux/errno.h>1 T) T& J: J5 m6 }3 e
  28. #include <linux/types.h>" L: [- d; C7 K8 F! }9 P7 J0 q
  29. #include <linux/interrupt.h>8 E  O* v2 d) F7 R' _; p. `- a0 a
  30. #include <asm/io.h>
    6 |6 y: E7 ]6 _+ |' |/ I  |* k" i4 F
  31. #include <linux/moduleparam.h>5 Q0 s' Y$ @, C  |- O" A3 l
  32. #include <linux/sysctl.h>& }0 B( \5 U3 v9 y+ g
  33. #include <linux/mm.h>
    2 l+ l8 S0 _  D; T5 H
  34. #include <linux/dma-mapping.h>
    3 ~. x. U, t" x" t0 ~# d& X
  35. ; S$ [: @( Z6 X0 c2 [' v
  36. #include <mach/memory.h>* @9 Z/ i+ }7 m- X/ R
  37. #include <mach/hardware.h>1 z! S8 r3 n3 a4 K, b9 L2 O
  38. #include <mach/irqs.h>) c6 f, ~- C) f" w
  39. #include <asm/hardware/edma.h>/ T+ P4 a% s5 k: s3 s  B
  40. 8 X* g9 X5 v3 S" m/ B6 F
  41. #undef EDMA3_DEBUG; r! B  S+ j) B* R2 m& X5 W5 M
  42. /*#define EDMA3_DEBUG*/
    $ h. M& I9 H5 R0 B

  43. % [2 X: n# t7 [" g( q
  44. #ifdef EDMA3_DEBUG6 J( m  L; S! Y4 i: @7 ^( x4 p- [3 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ @) r% G& W2 H1 p) z, Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# g/ w% I4 g2 ^& C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( V# w6 x/ M7 H% A
  48. #else( m1 o0 {# T/ a' i) y/ c) j9 O
  49. #define DMA_PRINTK( x... )
    ( L6 T8 Y, H" l( q
  50. #define DMA_FN_IN$ ~( K6 x& P' P- T! L
  51. #define DMA_FN_OUT
    0 G1 f5 Y/ ?/ _- c  Q; R
  52. #endif
    ( Q" {. N7 N' C8 i' o

  53. ( `9 o* v* S$ W" u* P4 c' W* C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 J8 ~& |$ b6 V, {
  55. #define STATIC_SHIFT                3! O9 ?: h" k/ e1 w6 B  r0 q3 S
  56. #define TCINTEN_SHIFT               20
    0 k6 _- X$ d* ?! m
  57. #define ITCINTEN_SHIFT              21$ }' f  `# M  N: v
  58. #define TCCHEN_SHIFT                22  J% @8 C3 P. q7 z8 a8 [$ O2 V, v
  59. #define ITCCHEN_SHIFT               23# {4 ?3 y7 J4 A0 K  z+ T/ G
  60. 1 ?- i# @0 M7 h% v& A/ x
  61. static volatile int irqraised1 = 0;
    : }- C  \1 T) D6 E
  62. static volatile int irqraised2 = 0;
    % f- s' p7 j6 |' @( v. ]; k5 d  e9 ]
  63. 0 g, [+ _* h+ |2 X- E5 u8 l* Z4 T+ @: G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + x  F" v5 J/ F) b" A* s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 \* A# t/ K! D. x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; s9 p1 w7 D7 r0 _- K

  67. ; Q% D! Z# Z$ n1 l
  68. dma_addr_t dmaphyssrc1 = 0;7 s  e' i, P" h; y
  69. dma_addr_t dmaphyssrc2 = 0;
    & c9 p$ |# m- @9 {$ U; i( n# X
  70. dma_addr_t dmaphysdest1 = 0;  I3 v6 Y8 K8 l- ^. }' J- K& h
  71. dma_addr_t dmaphysdest2 = 0;
    2 ~4 t" a1 }  U' u
  72. ! S  p  T3 n1 H
  73. char *dmabufsrc1 = NULL;
    7 S1 R( ]# D3 x- c8 }4 I
  74. char *dmabufsrc2 = NULL;
    % m$ ?0 Y8 r8 z1 n# r% o
  75. char *dmabufdest1 = NULL;( N7 @5 l6 v$ E
  76. char *dmabufdest2 = NULL;
    ; W, g2 R9 g3 i4 a3 \
  77. 5 t/ W* t6 B# O' k: A% y% ^4 C
  78. static int acnt = 512;7 z8 M: i6 s2 D+ A! f% v
  79. static int bcnt = 8;: U+ s% G) f4 J- n. p# G
  80. static int ccnt = 8;4 ~, {& {$ K9 z4 {0 V6 x( W8 y
  81. ; f' C' H1 W/ Z5 R( l( b  j% A0 E
  82. module_param(acnt, int, S_IRUGO);8 G* W3 E+ N- ?5 D
  83. module_param(bcnt, int, S_IRUGO);
    3 p$ i$ Q5 _' ^- e) P$ J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 p0 ]4 A* X  x: w* D9 d! u( `
1 x6 N& M6 _: y3 f$ U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- O( l  \$ t1 l# ?1 A- x- x; |" |+ Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; M8 J* J4 L8 ~1 S* E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& z$ Z! @1 X; x+ _# l! ?5 X8 S9 S/ N/ J5 ]9 {# D+ N0 A; ^
; H$ D7 r, O8 d) _3 C. L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-18 06:00 , Processed in 0.046451 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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