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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. ^; z: u! ^' k3 g. G/ t
  1. [code]EDMA sample test application
    " z: T. K$ B# H  Q, j2 P# w
  2. /*) K. }" m5 X, d
  3. * edma_test.c
    ; ]( M$ ^4 L, R
  4. *- h9 Q( f; t( }  Q; `) w
  5. * brief  EDMA3 Test Application/ _( {/ a  B, e! E% l! c2 v
  6. *$ H3 B" k* y" j
  7. *   This file contains EDMA3 Test code., f! d; k% J6 {
  8. *
    4 R% c' Y/ y1 ]3 {) l! l- O* w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 c' b0 m& w3 m' n+ }( |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - }+ U8 q' x8 U; z2 i1 F
  11. *         TO CHANGE.
    # W5 b# s  W+ x& P# i" d6 Y$ Y' S
  12. *
    1 x0 y; u7 z4 c; @- N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 s' l+ i$ ^  ?+ N
  14. *+ v% ~5 {1 V% r/ y+ R5 K! L
  15. * This program is free software; you can redistribute it and/or
    # X5 j7 i# R8 l. d4 C
  16. * modify it under the terms of the GNU General Public License as
    2 O4 p2 ]) V' M
  17. * published by the Free Software Foundation version 2.
    0 L5 p( M  b; {" @/ D
  18. *
    ( S$ A* ~' T2 I7 g% {; G+ F+ W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 g% l3 ~' ^8 B) c/ J
  20. * kind, whether express or implied; without even the implied warranty
    3 N0 i* W3 X' Y2 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  C0 C: v  L; v1 i4 s( ~
  22. * GNU General Public License for more details.
    ' w' m$ \7 j2 B  o& r- K
  23. */
    8 ]0 G5 v: y1 i! |* C- {

  24. * r0 B5 M9 N  O) J) ?& F+ z  Q2 J$ B
  25. #include <linux/module.h>& }0 m! g( ^1 g$ `  N. H4 {7 E9 j
  26. #include <linux/init.h>4 G  p% r% \( p$ h' ^1 I- T
  27. #include <linux/errno.h>
    & _2 b: M8 S' u$ K7 a
  28. #include <linux/types.h>
    2 [4 E/ K) {5 F. ^* Y
  29. #include <linux/interrupt.h>6 Z2 H5 X$ u. y2 S4 x  F  k
  30. #include <asm/io.h>
    4 x- m' O. U" |7 \3 x
  31. #include <linux/moduleparam.h>0 o! a+ `. Q' o0 }# w* f4 V
  32. #include <linux/sysctl.h>% F. t3 I& m2 D% j% Q* F/ u/ g. X
  33. #include <linux/mm.h>1 k1 J. W8 L/ |( l# h3 W
  34. #include <linux/dma-mapping.h>& s/ L3 A' d: t+ `7 Y/ d& i, s% U

  35. . n  t& o  q$ y! r; z) B# B
  36. #include <mach/memory.h>; D! T5 d+ F: b) f4 H
  37. #include <mach/hardware.h>
    0 [, v8 l* k7 i% l3 q& v) v9 R, c
  38. #include <mach/irqs.h>& ^8 b1 Y# }; q) w$ T+ ]
  39. #include <asm/hardware/edma.h>
    4 X9 q  v5 G/ b

  40. ' i* c8 @' e: v( v( _
  41. #undef EDMA3_DEBUG. j+ S/ }. w* n: z
  42. /*#define EDMA3_DEBUG*/
    , ^% h7 b1 L7 m& t6 ^$ d
  43. - N4 G9 Y  S, e' Y
  44. #ifdef EDMA3_DEBUG
    ! S( _7 b" o% Z: T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ u0 W: B  G. k9 n! J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 @( o4 K3 E  r- F: K: T8 e, r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 a: N& j- J& ]$ J
  48. #else! H1 q3 P# a. @1 y
  49. #define DMA_PRINTK( x... )
    ; e) l9 h- @% w$ @7 z5 ~
  50. #define DMA_FN_IN4 g  Q/ L9 H2 m% k# k# U1 o& ~3 f
  51. #define DMA_FN_OUT
    ( a$ m! J% ]+ g! k' _
  52. #endif' q6 i' L7 q. g  q

  53. 8 O3 ^  \, o% ]5 V' D7 n7 k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), ~, D' R# Z- e9 c  ]# W. c" m# M
  55. #define STATIC_SHIFT                3
    2 P: ~/ _3 b, N' o
  56. #define TCINTEN_SHIFT               202 {* i* p) I8 q8 N
  57. #define ITCINTEN_SHIFT              21$ M6 H: g. e- N, x% a! k
  58. #define TCCHEN_SHIFT                22
    0 `5 W, @" @7 s
  59. #define ITCCHEN_SHIFT               23
    , e8 g( j$ x) V* e; D/ Z' J

  60. ) Q2 X! ~9 S+ @  B7 o1 u
  61. static volatile int irqraised1 = 0;
    ) _2 p- C9 [# n0 s6 O8 m
  62. static volatile int irqraised2 = 0;% n1 u3 I# _* I) _
  63. ' W7 B) i) K4 m3 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Z! p9 G3 y' L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 }1 E! D; k. E2 u9 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 E  c' }3 G) `: x

  67. 6 b- e% b, T' T7 h3 V7 }
  68. dma_addr_t dmaphyssrc1 = 0;
    ) N7 R2 x8 K% i' f
  69. dma_addr_t dmaphyssrc2 = 0;
    4 \" q' k7 K" \& X! p. h# Z
  70. dma_addr_t dmaphysdest1 = 0;
    * z2 h+ I* q/ d: I
  71. dma_addr_t dmaphysdest2 = 0;" [5 }2 h7 L: g# c
  72. : e* |9 J3 ^! P5 e; `+ ~
  73. char *dmabufsrc1 = NULL;
      @% I8 C; H0 O" D5 [% F  q
  74. char *dmabufsrc2 = NULL;
    * y" u0 U8 \+ `+ s/ ?# Z
  75. char *dmabufdest1 = NULL;2 q6 K& J0 J" o  V. ?8 C! g
  76. char *dmabufdest2 = NULL;
    " l9 M% G, `5 L9 V

  77. 5 O: C6 h9 \4 h7 ~% W8 F
  78. static int acnt = 512;6 {7 h  M  I7 y2 Y( z% ~; P- U& n
  79. static int bcnt = 8;
    9 X4 r- i: ~, s1 Y% A# W
  80. static int ccnt = 8;. I  `9 c- B5 k' |

  81. 9 i3 O  Q4 b- _1 b
  82. module_param(acnt, int, S_IRUGO);1 j! X0 Y6 b$ L7 v- Q+ h: M
  83. module_param(bcnt, int, S_IRUGO);/ c2 P* W; z+ R$ s! C9 V5 c% m4 \- `6 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ J! [/ c: b7 s+ e  V( P- B* v; N9 f9 A/ a* r- x5 |8 \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- n' U# ?+ s% ^* v2 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 w2 s. H5 t6 K8 w& w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- o# r/ n/ u5 \  H* [+ z- ^
# C/ u1 o& Y* @- T8 z

% X$ J& @$ f0 ^/ w! p9 Y5 d' {; g& v3 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 14:07 , Processed in 0.041555 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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