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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 q& [. b, V0 {; @7 o8 L
  1. [code]EDMA sample test application
    # n% Q6 P+ A% t6 Z9 m
  2. /*% c% D2 h* N( h9 r' O3 X* M
  3. * edma_test.c
    / N9 J0 j3 R& l# N
  4. *" b# d9 e/ g, i: F$ w  W0 ]6 [
  5. * brief  EDMA3 Test Application
    8 m$ F) y- p8 u: F& k
  6. *, l, O" ~7 h1 p. w- Y
  7. *   This file contains EDMA3 Test code.% e5 i3 m- W) s! U" Y) f$ k
  8. *
    ) x6 M3 r- C7 V0 z% g, |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& F1 \7 h( Q- [8 A/ S! j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 z/ T; W+ [3 t9 e, c9 h. n
  11. *         TO CHANGE.7 T  x4 E2 R2 t
  12. *
    . h7 G; }' `1 T) F% w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ M* T7 n# i4 {* B* _7 t' N" q
  14. *2 ]9 r' B$ ?$ U( l9 Z& q1 X. I9 p
  15. * This program is free software; you can redistribute it and/or( Y' I# x" J, v& Q. c7 n! S! \
  16. * modify it under the terms of the GNU General Public License as0 @- V9 F# a  ^) I
  17. * published by the Free Software Foundation version 2.
    1 D9 |9 V' ]# z. \2 v, f" Z+ s
  18. *6 X- E- X6 L  f% [; B* f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 w: n/ |4 k0 I8 n7 T
  20. * kind, whether express or implied; without even the implied warranty
    ' W& j/ d9 m# T! r* s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* Z6 Q6 ]' D6 w2 f+ ^
  22. * GNU General Public License for more details.( \( a* V- [' K% w, k; _
  23. */. n. J) l3 ]2 a, r$ V8 S

  24. ( s! {% w2 V7 H/ C; m; j
  25. #include <linux/module.h>
    5 g4 O1 d3 V& ~6 |, F
  26. #include <linux/init.h>
    * Q$ i4 w$ |- b; C) r% c
  27. #include <linux/errno.h>
    6 s6 T% P) d+ R5 y
  28. #include <linux/types.h>
    * {; v) V0 \& g: c
  29. #include <linux/interrupt.h>
    & d4 H* q, R! C4 @! t4 m/ z1 ^
  30. #include <asm/io.h>
    + y$ g: A9 H6 H: X. k4 j5 ?3 M
  31. #include <linux/moduleparam.h>. h" w7 P' D7 q$ B9 p
  32. #include <linux/sysctl.h>: O1 C( j* R+ r# J) y
  33. #include <linux/mm.h>! ?6 w+ c" M( e. d( I% ~6 L
  34. #include <linux/dma-mapping.h>; j5 a% H: s  a. \6 N9 ~8 z
  35. % W7 t: u5 M( v3 l( k- I5 Z
  36. #include <mach/memory.h>
    ; z* Z( i2 |+ s: X3 w
  37. #include <mach/hardware.h>
    . {- A& h/ o( E0 S) E: C% [
  38. #include <mach/irqs.h>
    % [3 d' s  d' B" B* N- U
  39. #include <asm/hardware/edma.h>2 N) c' H6 O: Q9 _8 b9 t/ p4 p
  40. # y6 V: A# G8 H" ~: W6 c
  41. #undef EDMA3_DEBUG) P& J/ M& `/ Y1 n3 u
  42. /*#define EDMA3_DEBUG*/
    " N; v6 N; r) Q; G3 |4 I' B8 N9 r) j3 P

  43. 4 Q2 B* l/ H5 j$ {( N0 u1 p8 J
  44. #ifdef EDMA3_DEBUG
    $ b$ j5 Q5 `. M% i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + m) Z  [' a* L5 X0 }% \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " W9 y8 o$ D; D2 {. ~/ `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 f+ c$ {5 n8 b2 |
  48. #else: A: I4 o% _8 n- L/ B3 R
  49. #define DMA_PRINTK( x... )
    , B( W& W9 q$ F$ B" W) E* S* K9 r* Q
  50. #define DMA_FN_IN
    $ J) K* L6 I, g4 x# b. Q
  51. #define DMA_FN_OUT) J" |1 ^, \& I  F+ i
  52. #endif
    , b0 N& @# v5 {- W6 K/ f' S
  53. 0 t0 D/ q$ A, D' b6 i0 e, H) b* f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - w% |" c# v" a2 j8 L
  55. #define STATIC_SHIFT                3; y3 @4 f8 d" _) V  E* P
  56. #define TCINTEN_SHIFT               20
    ! P) K; E8 M8 Y* @
  57. #define ITCINTEN_SHIFT              21: X; _8 @& N9 ]) Z
  58. #define TCCHEN_SHIFT                22& `2 I6 _% _. y* K1 i# Y. r+ t, q
  59. #define ITCCHEN_SHIFT               23) |# g) t* @8 I5 K1 W( [' P% f
  60. 4 t- W6 J8 V4 w) \. P8 r. W
  61. static volatile int irqraised1 = 0;% v/ [  h+ c# W; i4 f' }$ p
  62. static volatile int irqraised2 = 0;
    + r" U1 n2 M4 l4 r6 Z4 h/ x

  63. 8 w+ J- ?+ g( a! O, s4 x2 O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - U- c/ \% g/ ^8 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , s3 d2 X; F1 |1 p  S0 Q4 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( y2 r7 m0 `0 Y$ S+ p. U
  67. ) t3 R& n" I2 M3 Q# S. H3 Y; k
  68. dma_addr_t dmaphyssrc1 = 0;; f7 H! a. e4 ]# }
  69. dma_addr_t dmaphyssrc2 = 0;$ R9 Z  r% Y# i% G" m
  70. dma_addr_t dmaphysdest1 = 0;5 t2 a9 K; r0 {$ \# J$ ?
  71. dma_addr_t dmaphysdest2 = 0;
    ; E6 f, i7 ~+ E; y8 C4 [0 j

  72. - G/ N# r8 a7 v. d
  73. char *dmabufsrc1 = NULL;$ B4 C, G. p9 f' U$ j; O$ q
  74. char *dmabufsrc2 = NULL;
    2 u# r* g- P! I. W  u
  75. char *dmabufdest1 = NULL;
    0 Q& |" q& Y! T8 l
  76. char *dmabufdest2 = NULL;+ N- ^- s! v9 X; ?' H: M

  77. " p; r* n5 k- F3 j
  78. static int acnt = 512;  h6 w/ \6 W# z
  79. static int bcnt = 8;
    # M- U- G  k6 _: f9 k, k1 M
  80. static int ccnt = 8;
    5 S6 U  W* Y7 l& `5 F

  81. ) t7 }/ J# y0 n4 x; i
  82. module_param(acnt, int, S_IRUGO);) o" w. D1 g- x7 |+ `  H% q
  83. module_param(bcnt, int, S_IRUGO);7 ^' c0 j8 X  d5 W; a$ n# [% r6 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! f: j, e2 d) ?7 ~+ p, |
1 R- O% Z: }' @, u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, Z0 {* W2 h) {8 c5 @9 \- t# ?! [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 n( w! [* o; j% c2 \: e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& k& B) `+ f3 F# T7 T
. q, ~% ?$ L8 I* _6 Q' E* n. J

# v' \9 S9 F( d, u8 C. E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-6 02:47 , Processed in 0.041201 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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