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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- |- L2 f/ _0 b0 n  L3 i: L
  1. [code]EDMA sample test application
    & Z( N- P. H' y1 c
  2. /*
    9 J. j/ S  k9 y" L
  3. * edma_test.c+ {# f5 r: W- S2 \0 |
  4. *
    ; @3 k" Q6 t4 m" k! ?1 M
  5. * brief  EDMA3 Test Application
    / ]0 k! V/ C% ^: x5 {! B
  6. *
    ( I" ]; F0 y+ ]) N7 ^
  7. *   This file contains EDMA3 Test code.
      c; x' }- n( m; ~+ Q$ I
  8. *
    # b9 v7 \' ~; C/ T# l. O' J$ _, B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 c$ J* l7 K0 U1 X8 S" e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - h) o: @$ A, m9 A1 v& w4 O8 E
  11. *         TO CHANGE.
    4 f" V" [- H: ]5 c
  12. *
    ' F- v5 y% Z# b' B0 m: L' X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # }$ w0 D9 ]- d  M" [+ K
  14. *
    ! C, G: ?6 C1 |, o0 Z6 T
  15. * This program is free software; you can redistribute it and/or
    & O  Z3 j8 R: J/ i, ~
  16. * modify it under the terms of the GNU General Public License as
    / i1 F) D- ]1 o( j1 }
  17. * published by the Free Software Foundation version 2.6 z; b/ {- d1 u
  18. *7 P; O  W8 t6 z; \$ w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 @1 e: Q; [7 C  |1 t( e
  20. * kind, whether express or implied; without even the implied warranty
    + t! c3 }* ?* C3 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # G# }6 w1 f1 f0 P8 f
  22. * GNU General Public License for more details.
    1 L" |- ^' f. m5 P8 u9 t* j+ M2 c
  23. */
    ; Y2 B/ w- \8 \2 ]$ H4 g! ]0 W
  24. 8 q1 @- g3 w7 \+ k
  25. #include <linux/module.h>
    ) e( G/ P8 G0 Z' M0 t2 p. Z
  26. #include <linux/init.h>
    4 y2 K1 n, J& r
  27. #include <linux/errno.h>2 |; ^$ I4 [; H+ K! k
  28. #include <linux/types.h>
    9 V' \: `6 m9 l
  29. #include <linux/interrupt.h>
    6 t, u3 t* E! Z# ~) H
  30. #include <asm/io.h>! ^- `9 B- a: s. W3 g' Q
  31. #include <linux/moduleparam.h>
    1 N9 T& Q9 V* ~
  32. #include <linux/sysctl.h>
    - W  V5 }8 [& I! `
  33. #include <linux/mm.h>0 {" T6 [. z, H9 {; _1 v
  34. #include <linux/dma-mapping.h>; }; G& J0 y) V4 ?- _2 \( o7 Q

  35. " P$ P1 w( H4 G
  36. #include <mach/memory.h>
    ; O7 }  c& P: V8 j1 {" k
  37. #include <mach/hardware.h>
    , [& D& e3 _/ n
  38. #include <mach/irqs.h>
    : Q  Z+ o5 R7 m; p; g2 Q
  39. #include <asm/hardware/edma.h>
    : b+ I- K2 Y; a3 h0 A% L, d
  40. % A7 {5 Y7 x- F+ h
  41. #undef EDMA3_DEBUG6 P9 M3 |! k& r: d
  42. /*#define EDMA3_DEBUG*/
    ' Z9 c: i4 q  T9 K6 ?

  43. 8 f, @- @2 _' ]& f2 s6 N
  44. #ifdef EDMA3_DEBUG
    ) n# ]1 ^$ @: c7 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 d) o2 Y; I) [3 Z7 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& S& l! `) O4 a: P# N2 g' O/ j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 J: l) R: }* O2 x% x3 y
  48. #else
    - t# ^; t. [4 t( V- [
  49. #define DMA_PRINTK( x... )& D* L4 w  i6 E3 _7 C
  50. #define DMA_FN_IN/ i: I9 V- p; L9 M; H& Y. t4 b
  51. #define DMA_FN_OUT( _& q% `3 c" L
  52. #endif
    1 b' {- A9 E! A2 E5 k; I. d
  53. 5 J( Q9 ~3 Q. `' \: Q3 B7 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% \% [# j$ G& K+ a5 ?9 a6 i9 F( a3 o
  55. #define STATIC_SHIFT                3
    & H  R* c! c6 _6 _  I" c0 M) _& M
  56. #define TCINTEN_SHIFT               20
    8 D8 t6 ?. _' h! r: j9 n! b6 Z2 U
  57. #define ITCINTEN_SHIFT              21- T. l3 c) e2 z3 e5 \
  58. #define TCCHEN_SHIFT                22
    ( d1 \* _/ Y7 \: Z& e; H
  59. #define ITCCHEN_SHIFT               23& D2 K+ X3 T; i1 R$ `1 c" V
  60. 4 O5 _1 x) k& Y+ b9 J
  61. static volatile int irqraised1 = 0;* i/ d! a9 Q& J( _4 J* e
  62. static volatile int irqraised2 = 0;7 R- B4 V" c4 \

  63. 5 \0 ?* `1 s! f5 t5 c- @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 G6 K- `. ^( O. B  ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % r/ I1 H, B  z8 F3 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 m$ o. R) \7 C+ h+ V% H/ G

  67. $ ^3 z+ m% @. d+ n1 H. u" y) Z
  68. dma_addr_t dmaphyssrc1 = 0;
    2 q5 n* _  @' ~& b2 p$ j+ f" K
  69. dma_addr_t dmaphyssrc2 = 0;  Y: s5 t/ c3 P1 Y7 h0 [
  70. dma_addr_t dmaphysdest1 = 0;
    ! Y" i3 S1 Z  c) w
  71. dma_addr_t dmaphysdest2 = 0;
    & Y# g7 S- \6 @8 y  z/ q

  72. 2 b) u& y6 |( t5 J8 S' N
  73. char *dmabufsrc1 = NULL;
    # X7 ^2 N0 l. @8 C
  74. char *dmabufsrc2 = NULL;
    - @/ n+ n. N2 b6 h, {
  75. char *dmabufdest1 = NULL;* ]& w; y, `* N) o
  76. char *dmabufdest2 = NULL;9 I) I% B& Q" R( g5 i

  77. 5 |, N7 L7 q( m5 c+ _' f7 B. S! f
  78. static int acnt = 512;
    8 b' W, B. @4 Q" j, g: U" i
  79. static int bcnt = 8;
    3 B% `: ]5 j# b8 V3 E3 Z
  80. static int ccnt = 8;
    2 Z+ ?) v6 Z7 X1 G  u

  81. % o& v1 {% c% J
  82. module_param(acnt, int, S_IRUGO);
    ' O5 a, U3 E8 S6 j3 Y7 C
  83. module_param(bcnt, int, S_IRUGO);
    & H$ p) ?  J+ }( \! _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 L1 X/ B, f) ]. s, `
. A8 x" o, I8 a5 X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 ]8 g, [$ c+ f0 r& c! |# a7 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* k7 i1 T: f5 F& x0 [! H4 T# G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# N# Y4 j7 K2 T! P6 ?( @" I' r& E: b, b1 f3 {$ r/ s

' f5 q* a8 d8 A* v6 v& j7 S1 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-5 10:50 , Processed in 0.039242 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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