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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ S/ d9 H4 `, R  c
  1. [code]EDMA sample test application; E# o: v$ C9 k2 _; A: ^2 J
  2. /** I8 k: L* @0 W$ L
  3. * edma_test.c# C2 Q' t6 X" I! k4 L
  4. *
    , I; ~% k& w' E+ y: w
  5. * brief  EDMA3 Test Application* x5 ^$ g" b! {, n
  6. *) `6 G: R' s8 _6 i1 }, s
  7. *   This file contains EDMA3 Test code.( `9 i/ z( ^9 R, V' z6 G
  8. *
    3 D4 R3 B5 m' m; E' }. t+ n( U" D3 ?, t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 L* ^* ]% m# I, @2 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, ^1 x- H& W) i6 l: a+ ~
  11. *         TO CHANGE.6 A9 E; Z9 c4 D) R
  12. *
    5 D- m/ o3 y& q- Y7 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// k; y& s" k1 f* J2 X
  14. *
    % p) \7 y, B9 d9 M. V
  15. * This program is free software; you can redistribute it and/or. C2 a* U) w) ]+ L
  16. * modify it under the terms of the GNU General Public License as
    , b  C$ G, G% K
  17. * published by the Free Software Foundation version 2./ v' J# q2 Y- M6 S+ X3 q0 t: ]
  18. *
    0 s) k' ~" P6 Z* d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& A. D/ }/ t+ J, ]- ~
  20. * kind, whether express or implied; without even the implied warranty
    : G& m( y& e, a3 k) F' W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) x7 Y6 A! b1 M/ n
  22. * GNU General Public License for more details.  M& y- P/ L3 D8 m- N& e5 H3 D2 \
  23. */
    % w% S* \. i) s7 U9 y; I" G
  24. " W$ I" F" l2 d) X/ {# h  j& ]
  25. #include <linux/module.h>/ J$ T- ~1 ?) W- U7 R! m7 N7 g( h
  26. #include <linux/init.h>  K9 e, O: p  m+ A1 j6 x, Z' \
  27. #include <linux/errno.h>& I2 j4 f9 u$ Z6 ]7 N# y+ a
  28. #include <linux/types.h># Y$ v" e! o9 b0 l9 D' K
  29. #include <linux/interrupt.h># s4 Z% E7 T0 a& {6 q
  30. #include <asm/io.h>, V9 m0 W, d/ o0 X8 @" O7 c
  31. #include <linux/moduleparam.h>
    4 Q9 ?; Q/ C, a: E& s' c
  32. #include <linux/sysctl.h>
    + Z+ |. x0 K5 r+ O" }! Z: U; ~' g
  33. #include <linux/mm.h>
    8 r: v# h8 `' \: A0 x% \( @
  34. #include <linux/dma-mapping.h>: o# ~. d5 Y8 ]

  35. - v. s7 `, L+ g, w# `6 q) M, p
  36. #include <mach/memory.h>" `+ D" d2 |% g$ K1 v  z
  37. #include <mach/hardware.h>
    . M, G6 ~' S) S7 t
  38. #include <mach/irqs.h>
    " B$ p* l/ O/ g, Y
  39. #include <asm/hardware/edma.h>3 n" }6 ~/ l1 q& v
  40. + g3 x* L' A2 U% p; H% S2 J0 t
  41. #undef EDMA3_DEBUG9 z* [) m, G: \. Q7 b; G/ \- z! j
  42. /*#define EDMA3_DEBUG*/
    ; t+ G( v" I! D; ~) ~
  43. ) b8 y  A7 I# h# d! ?1 p
  44. #ifdef EDMA3_DEBUG
    5 @9 o, s& }7 d7 k) Y( B- T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 t- c5 Z. ^& a% M  o) y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 e7 M# P5 h4 }  k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 j% d. e8 S) a, }" ~# Z+ R
  48. #else
    2 X' Z6 k6 O. o) [
  49. #define DMA_PRINTK( x... )2 ~4 R7 K; `$ M" _, j% @1 m
  50. #define DMA_FN_IN$ S8 [, A& P6 c. T/ k
  51. #define DMA_FN_OUT1 ~2 D( a. F; ], q- L
  52. #endif
    2 D0 @5 i4 m. e. X) N- L
  53. 2 s/ J9 z! Z6 Z. K- b- {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! Q+ D: s! w& q
  55. #define STATIC_SHIFT                3$ C8 ?3 V# R+ o3 O8 n& @7 e0 S: s
  56. #define TCINTEN_SHIFT               20; n9 h' t: {5 `% V8 V9 s
  57. #define ITCINTEN_SHIFT              21$ p5 m9 G( T* \3 g8 x( C
  58. #define TCCHEN_SHIFT                22
    / r$ v0 i6 R! X6 ]: @! I0 \: @+ B
  59. #define ITCCHEN_SHIFT               23
    : b  b: v) Y4 G0 x. w4 f  r
  60. : U  p6 B0 l& x. s8 K
  61. static volatile int irqraised1 = 0;& V, X2 [3 s) w: k- U
  62. static volatile int irqraised2 = 0;1 Y. H3 D- n, Q7 c  K9 c, l
  63. 6 ~$ O2 X$ L: q$ A0 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " N% Y% K0 l9 f1 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 V# K! J1 Z& |6 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& E0 u% `4 i  W- ]
  67. * ]/ t2 z7 y- _- Z: _
  68. dma_addr_t dmaphyssrc1 = 0;
    7 N2 ^6 Z9 O$ \% B* N% P+ d# o
  69. dma_addr_t dmaphyssrc2 = 0;
    $ D% ]- @5 t+ ?! w& Z
  70. dma_addr_t dmaphysdest1 = 0;7 E1 I. L# C( e6 R
  71. dma_addr_t dmaphysdest2 = 0;8 Y* c; C* ?1 G/ q) u2 N  g

  72. / n+ x" O0 s2 L6 O- @( S, M& ]
  73. char *dmabufsrc1 = NULL;
    9 I: L  ~; k8 s" |- Q/ b
  74. char *dmabufsrc2 = NULL;
    8 l# l) `9 M! {! B
  75. char *dmabufdest1 = NULL;/ _6 H" b9 g0 }' V
  76. char *dmabufdest2 = NULL;
    * P6 q$ M- D( t7 C) M

  77. 9 W: n/ a0 g5 z% ^- }% D; }( z
  78. static int acnt = 512;7 g. V- f2 k& ~; c
  79. static int bcnt = 8;! r/ Y6 v) G6 L
  80. static int ccnt = 8;
    ; o/ a* I9 N0 G) ^3 F1 K4 r
  81. & X% v& [7 N& l3 F9 w
  82. module_param(acnt, int, S_IRUGO);. h3 C+ S+ t& U/ L
  83. module_param(bcnt, int, S_IRUGO);
    - d0 ]& q9 d  z* n  v; G4 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% F; g  V" g& u" p& N& K% o) ?! A% q3 W0 M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. [$ p& A0 P$ I1 N2 A. \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 d9 d- ?$ m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 J/ I5 k/ S2 Y' \: N/ y5 N
- \: }5 |# q7 J" ^, I3 h& _& H" ~/ l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 11:13 , Processed in 0.040661 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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