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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + X6 |8 S6 X8 D+ i' Z: S9 U
  1. [code]EDMA sample test application
    & \6 A4 Z  m  w! e& p; E0 _
  2. /*: `; E/ ^4 ~, j! k. x3 V3 G* o
  3. * edma_test.c
    ! @, ^8 \: V6 ?2 M
  4. *
    3 y+ u) L8 M4 `( m
  5. * brief  EDMA3 Test Application- s4 b0 r3 [( s, ?7 n6 v* \
  6. *8 e/ {0 U5 n/ U- d
  7. *   This file contains EDMA3 Test code.
    : X+ w6 B3 W( g4 x9 @$ e  E
  8. *
    1 U8 b' m5 F5 e, r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 {. c2 f8 E! n+ n/ E0 F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 M0 _( ?: j: e! J$ Q& r
  11. *         TO CHANGE.  }7 S4 l0 K& }7 G+ T' t
  12. *8 _' I, W& t9 s* _+ R: m$ w! _0 A/ H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - U+ [2 J- b5 _( ^6 W6 a
  14. *
    6 ?4 ^: `# Y4 _/ i: A- ^
  15. * This program is free software; you can redistribute it and/or
    ( F  e% n# d3 ?, i" I- W
  16. * modify it under the terms of the GNU General Public License as
    6 {8 b- J8 o  H, |& o. @2 ~8 }# X
  17. * published by the Free Software Foundation version 2.
    - p7 [0 q! K& z; q
  18. *% A9 N1 ?& H9 S2 T2 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 _6 H' {7 v. k* S" \3 Q8 r
  20. * kind, whether express or implied; without even the implied warranty
    " r% Y+ y8 k$ O: x2 d! s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 N6 ?) J- [- d3 ^  M( K. m
  22. * GNU General Public License for more details.5 K) {1 P# U' b
  23. */
    # l) |! V, Z1 w" r% [/ w
  24. ) M! i2 y$ B* V3 M8 Y% ]
  25. #include <linux/module.h>8 v: E# Z* L3 A* s" x
  26. #include <linux/init.h>" q$ w8 V1 G1 F. x, l3 R+ c
  27. #include <linux/errno.h>
    % C( A: y; L, X3 f- ?, x% c
  28. #include <linux/types.h>+ N0 U: y3 c' k1 k
  29. #include <linux/interrupt.h>" E! G! e1 h5 @8 z, \
  30. #include <asm/io.h>. X- \; _) }$ c# r* j
  31. #include <linux/moduleparam.h>" U* ~4 U( X+ w
  32. #include <linux/sysctl.h>
    + g7 c0 X$ U2 q# `/ S8 }& ^6 m5 T
  33. #include <linux/mm.h>
    " K' P1 a) @; w2 Z
  34. #include <linux/dma-mapping.h>, f9 J7 F* p5 `  ]8 q- n
  35. # ~; ^' @5 T, J' |
  36. #include <mach/memory.h>4 G5 V9 G) r- _  R% ?& y
  37. #include <mach/hardware.h>
    , t- ]5 J4 H0 v5 |
  38. #include <mach/irqs.h>
    ! \' \# _: g5 a0 w' w# i4 g
  39. #include <asm/hardware/edma.h>6 h5 Z' W4 `& f

  40. ) k. c. K' p' J
  41. #undef EDMA3_DEBUG
    ( v" |% I# ~$ l9 i# M7 H5 Q
  42. /*#define EDMA3_DEBUG*/0 p1 h. @+ D, C- N. F' J$ k

  43. / {7 B$ M& K9 s/ N$ k2 O
  44. #ifdef EDMA3_DEBUG
    0 h% {. @  r" l5 W: R, B' `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 h, h$ b. S, N; e/ _7 q6 v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & c8 @2 @0 G  K! u5 C7 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + ^! P+ G; _1 A9 Y3 }; e
  48. #else+ ]0 G% l$ T9 F6 r
  49. #define DMA_PRINTK( x... )
    / }+ w7 _  u3 x- A
  50. #define DMA_FN_IN
    + [& S7 d. b; w8 [
  51. #define DMA_FN_OUT) w( y" F, X: R/ ^1 i) A
  52. #endif
    : _- b: a' ?# m+ p

  53. - R/ E' N! e! Y5 h0 Z7 }% Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 O9 ?8 z2 a0 h- b9 O! P; H5 y0 R
  55. #define STATIC_SHIFT                3
    9 G$ b! \* z9 F0 L! L# ?: U
  56. #define TCINTEN_SHIFT               20+ O3 F' g, R- M" i
  57. #define ITCINTEN_SHIFT              21
    " I1 J0 A6 n# K7 \8 E- F5 o1 O
  58. #define TCCHEN_SHIFT                223 q6 M: b5 c, d& Q$ x( ?% D
  59. #define ITCCHEN_SHIFT               230 Z- O' L" D6 F
  60. ; K. M" e7 L8 W3 @" g  H
  61. static volatile int irqraised1 = 0;/ H7 M! c. a2 I% M0 o; J
  62. static volatile int irqraised2 = 0;
    2 P& {! }4 i( Z

  63. 1 K& D# y: _( |& Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 y! I* f1 K( }& d5 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 \! N- V8 @5 f# X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 `! _9 Q8 b3 v0 b

  67. 0 {+ H- m  Z  u- ~2 ?; P
  68. dma_addr_t dmaphyssrc1 = 0;! M: d: F3 Z( x* U% t
  69. dma_addr_t dmaphyssrc2 = 0;
    % }( Y4 p+ q. Y& j! P) X
  70. dma_addr_t dmaphysdest1 = 0;- q: l) p9 H9 @, I7 n$ J) @  A
  71. dma_addr_t dmaphysdest2 = 0;0 u& U+ d: B# `2 x1 k/ h. w
  72. 3 b; M% F& U6 ?  x. c
  73. char *dmabufsrc1 = NULL;( d% R, k  V+ v* q. ~; w1 H
  74. char *dmabufsrc2 = NULL;1 V5 {8 R+ v6 W, t4 J
  75. char *dmabufdest1 = NULL;
    + o* n, e& A- j4 m3 E* M( @
  76. char *dmabufdest2 = NULL;9 S. f8 c% S& |& k* w( m2 a" E

  77. ( |' z3 \- v) C3 S2 n+ ?, I
  78. static int acnt = 512;
    % ?6 p4 }7 i/ Q5 r) H
  79. static int bcnt = 8;# M; M: _; c' ]" T8 a
  80. static int ccnt = 8;
    ' G& z2 i" x- t& M7 `! k
  81. $ A9 o% c0 S+ T
  82. module_param(acnt, int, S_IRUGO);6 c2 P1 Z. h# i% o) W; u
  83. module_param(bcnt, int, S_IRUGO);
    . ~7 _6 n4 i7 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 A8 [; M6 ^: k/ n3 M8 ~
) _; ?$ M9 C! k" P& [8 o0 r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 z5 ^1 d, Z- B3 A) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 J6 S: c) t" Z$ N+ N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( f/ t4 T& P1 o$ _  V* g8 d; e4 }
5 i" `0 `2 w3 m; I3 z
; S6 f. z3 @. e  J; q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-25 13:04 , Processed in 0.043457 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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