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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # {2 b( @7 @$ H4 E7 `5 K. v
  1. [code]EDMA sample test application. J6 U2 Q# ^1 f7 Y, p0 D* v
  2. /*
    " h9 S6 `0 `2 k5 ~3 P
  3. * edma_test.c1 R0 w  D1 m) j
  4. *
    + h( q. u, T8 x8 m, d& X
  5. * brief  EDMA3 Test Application
    + i+ S- x: z9 h/ O3 j
  6. *. \2 e1 {, B/ R, e! G
  7. *   This file contains EDMA3 Test code.0 o5 f" m8 i6 z: c' s3 n# J* y
  8. *1 e! m; u( Y8 Y. `5 R3 Z* L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 `( f& x% I+ @) o1 J% x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - W/ g" _' X; e
  11. *         TO CHANGE.
    9 E% W6 j% q* q
  12. *7 p0 d' n1 U1 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# h! T3 L8 l  Z
  14. *1 z( {/ T* Q0 T7 E
  15. * This program is free software; you can redistribute it and/or
    . @  t, o7 C3 b6 h& S
  16. * modify it under the terms of the GNU General Public License as, h1 o" X# q& }% T  g7 Z
  17. * published by the Free Software Foundation version 2.
      O& \% I* j( C! V6 A/ D
  18. *# s+ r. u2 f  X  B" O5 s3 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- q8 w4 _: W; y9 C9 p, c
  20. * kind, whether express or implied; without even the implied warranty- `% C( q9 \. _, R) y& x$ v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' p  V% B% c) ^
  22. * GNU General Public License for more details.
    " |0 I9 w# W+ h/ ]
  23. */+ t; {& H; f. z) @4 v8 I

  24. ; A- ~* Q: z8 h' D  B" _1 L: c$ X
  25. #include <linux/module.h>
    " v0 J8 i+ u' d- l6 [) t" ~
  26. #include <linux/init.h>
    7 k' d0 [+ x: w0 d) ?$ ?7 p
  27. #include <linux/errno.h>
    . U1 j% R% F4 H; C! ^7 L, U/ A* G) L
  28. #include <linux/types.h>+ Q( \( Y5 n; P# y
  29. #include <linux/interrupt.h>
    / ?) E' N. y/ v5 e: Q0 O5 I
  30. #include <asm/io.h>0 X8 ~5 W& M0 ?: |4 b, ^/ z
  31. #include <linux/moduleparam.h>
    5 m) ~" Y; z- J1 k4 {
  32. #include <linux/sysctl.h>
    0 d% c. g3 z8 ^; s! V+ g5 @
  33. #include <linux/mm.h>
    . V& Q# D6 i1 g# W# X
  34. #include <linux/dma-mapping.h>
    , Y3 `, [! S6 b  v9 \( c
  35. 4 L  U0 H  _. B# \1 N
  36. #include <mach/memory.h>
    2 w! F! C" e  H! g0 d& V* m
  37. #include <mach/hardware.h>
    6 S# ~' g$ o7 \; }9 b' h
  38. #include <mach/irqs.h>8 N9 k& ]: e5 C1 A* K; B
  39. #include <asm/hardware/edma.h>
    $ t; z7 @0 s$ ^3 i+ v

  40. 7 H. v% D8 M5 P' B/ Y  N3 G2 y% K
  41. #undef EDMA3_DEBUG- Z  `/ X7 Z( ~' a1 a% X
  42. /*#define EDMA3_DEBUG*/' r* w1 N; r  f1 p

  43. / X: h/ c6 d1 _: ?& a6 M1 Q
  44. #ifdef EDMA3_DEBUG
    3 B: A1 y% M' J8 ~" ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 h$ p5 T- d* }8 I: s! w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ Z" Q7 _& f$ w0 m! P6 a1 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 N1 c& O2 q! W' ?
  48. #else4 n6 Q5 g; E9 T
  49. #define DMA_PRINTK( x... )/ m$ F  n! e9 F3 X: \
  50. #define DMA_FN_IN# h! n9 j# M' o
  51. #define DMA_FN_OUT- u% ~: Z8 v' @9 T. q
  52. #endif5 J. V( `6 t7 c/ Z  c) H

  53. 1 Y' B' n5 ^. h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 f6 r8 @! I: K6 u1 O- {
  55. #define STATIC_SHIFT                3
    5 q: d8 |. y+ @: C' r2 [
  56. #define TCINTEN_SHIFT               20
    3 [4 H, p3 q( ]- C) P
  57. #define ITCINTEN_SHIFT              21
    ( X7 N+ M3 {) S' }, L5 Y, `
  58. #define TCCHEN_SHIFT                22
    " f" Y6 [4 r9 s6 O1 I+ h
  59. #define ITCCHEN_SHIFT               23
    1 }3 ?4 L6 t2 M' b7 E$ s( @

  60. $ s& ]7 Z- R, T( v" f
  61. static volatile int irqraised1 = 0;: |1 x; T- b$ I# ]2 l1 U/ S
  62. static volatile int irqraised2 = 0;! ?$ ~( V2 w. b8 J: ?9 f% R  C

  63. ; R6 u$ l; L. S* R0 O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# L; d7 a9 B1 c) {% g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% X$ `, x" J# p2 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # F) X. ^& r  G! p! d: D3 S
  67.   J! s  W0 G  v
  68. dma_addr_t dmaphyssrc1 = 0;
    4 n  E* e0 e6 P( `# ~
  69. dma_addr_t dmaphyssrc2 = 0;
    4 ]0 K- U6 R/ w) g! c6 J
  70. dma_addr_t dmaphysdest1 = 0;& U: A' y; R$ r) _. h0 z5 \9 V
  71. dma_addr_t dmaphysdest2 = 0;
    ) U  p& H2 Z  D+ e' m
  72. : q6 G5 u# O* r0 w- }# L
  73. char *dmabufsrc1 = NULL;
    4 I2 U6 H/ M! J9 j5 e. Y
  74. char *dmabufsrc2 = NULL;; H! J# z- |/ L
  75. char *dmabufdest1 = NULL;
    % m) T& {: M, ?$ z# Y( g0 |% W
  76. char *dmabufdest2 = NULL;
    " e9 X) p1 J. @' N$ O
  77. 0 b. u; h! i0 P- ~+ F2 W+ _
  78. static int acnt = 512;
    7 C. T4 E& X! k, ~$ O5 F; D
  79. static int bcnt = 8;
    ( R; h9 O# e6 S- U
  80. static int ccnt = 8;
    2 i# Z/ o9 |4 v
  81. & z3 k0 E" U% M9 t5 E
  82. module_param(acnt, int, S_IRUGO);
    % o. X2 M7 J- V- l7 j1 Z6 }3 w
  83. module_param(bcnt, int, S_IRUGO);
    " C6 }0 {0 m" ~3 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 h; L1 R  U& d: T/ k2 W8 L  ?
3 g; r# w# e1 e3 b8 f4 B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 ]' ?( Q4 d: L' P; x2 X* R3 U  d$ v) z  ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' W4 M! L0 }) I: j- P8 K1 e4 s, A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- U' i8 F; H! E+ Q- z

+ \: ^" I3 F% G7 v  \' c! e, j: v( w6 V& [9 L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 10:25 , Processed in 0.043571 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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