OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ F! x  c" b5 q& s+ j+ {" x
  1. [code]EDMA sample test application
    4 f- R8 }0 g. I$ M; K. G+ w( p
  2. /*
    ! q* E4 u+ `1 u/ N) x7 E
  3. * edma_test.c
    1 ]0 X0 c- d  U3 q
  4. *
    9 O9 ^' g7 Z+ g2 w% B* x
  5. * brief  EDMA3 Test Application7 W* e  m8 Q8 g1 l; \
  6. ** ^& K$ T0 Z3 f1 V, |5 @
  7. *   This file contains EDMA3 Test code.1 k/ [* j3 @9 K  v
  8. *2 g0 c+ S- f# b# g3 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & U/ U! [4 r8 Q8 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 m, b+ k% }( N, }9 d9 }
  11. *         TO CHANGE.* O' e. R0 ~8 e. q0 Z$ n
  12. *
    3 Y" ~9 x2 q4 S. H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 d/ D, f1 u! \. Q& [9 M$ x
  14. *1 m* ~6 K& ^. \" z7 j* d  w6 Y
  15. * This program is free software; you can redistribute it and/or+ X9 `, A& a7 T1 L- Q8 d/ i
  16. * modify it under the terms of the GNU General Public License as! _2 @9 j3 K: k/ @9 w( M
  17. * published by the Free Software Foundation version 2.
    ( y( I/ |5 V- d0 F
  18. *
    0 d% L/ V# G" [' o3 N, O2 Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 b) F6 r* k# i; v+ H: l5 i
  20. * kind, whether express or implied; without even the implied warranty( O. q# B) D( n. L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 q, O; v2 j# Z) l# x; Y4 d; O
  22. * GNU General Public License for more details.  W2 C. c1 _3 w0 z) A0 e% d6 n& |
  23. */. _8 {% J& e+ ^5 ~, D( m% r" ~: \! C
  24. # w5 ?: J6 M5 ^- L6 Q/ b
  25. #include <linux/module.h>
    ' c; j1 g8 m( s/ }* p
  26. #include <linux/init.h>! ~! \2 t3 w% A, m. W$ H
  27. #include <linux/errno.h>
    8 Q- W! p: y4 q; F. q6 L
  28. #include <linux/types.h>! q4 G+ Y: _1 a
  29. #include <linux/interrupt.h>& }: Y$ t  f9 y
  30. #include <asm/io.h>
    ( x( U5 C4 H$ ]5 Z8 _( v! _
  31. #include <linux/moduleparam.h>- {& Z4 N: _7 P; h0 u1 b" D4 g7 F( n; I
  32. #include <linux/sysctl.h>
      [9 S7 s+ l. i8 @
  33. #include <linux/mm.h>
    * c  V, T1 V3 p0 B& [) M
  34. #include <linux/dma-mapping.h>% [% z5 V0 \  i+ I
  35. ; a$ S% I' |4 N8 Z6 V0 \1 u' p
  36. #include <mach/memory.h>* D  A( k4 B1 I; ^. ?0 |! H
  37. #include <mach/hardware.h>" L, }9 i5 [. E2 P& [% w
  38. #include <mach/irqs.h>
    6 `  |3 T+ L4 ?: L1 V  h6 v
  39. #include <asm/hardware/edma.h>2 s2 R3 s  _8 \' z2 U

  40. # ~6 e; w  A- l6 Z4 S) v( @
  41. #undef EDMA3_DEBUG
    # t4 P# u4 y' \8 Q& e5 i) ^8 j. Q
  42. /*#define EDMA3_DEBUG*/
    ' i, c- b9 F! T. u/ }

  43. + Q# p9 {6 J9 ~, d) {+ q
  44. #ifdef EDMA3_DEBUG
    / t  b2 }: [% r# x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * o, k$ _, P( M4 G+ _; f) W  ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  }% h) B& f5 Y3 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- Y2 g- U1 r; T
  48. #else
    ) e* z% b+ ?5 R% A- e9 B
  49. #define DMA_PRINTK( x... )7 H. o6 _5 o' O: x; I
  50. #define DMA_FN_IN3 }8 K0 F" m5 F' ]: b' R
  51. #define DMA_FN_OUT
    ! k- K# y- V% u4 A7 X: u" g- ^7 h
  52. #endif
    ( p9 K1 P8 h2 C, o5 G

  53.   b% i# H0 n! U# L& A3 X4 P& |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( J! K) L$ {# m) b+ c
  55. #define STATIC_SHIFT                3
    % }+ |' e% e- c, V' ?& ~# P
  56. #define TCINTEN_SHIFT               20" b1 h  P/ A7 `5 R+ k
  57. #define ITCINTEN_SHIFT              21* D" {6 h2 ^4 j
  58. #define TCCHEN_SHIFT                22
    , ]; c, m  @7 E
  59. #define ITCCHEN_SHIFT               23
    ' y- @+ C+ M0 Y) w! q+ V
  60. 3 S! r* d$ q- X
  61. static volatile int irqraised1 = 0;
    0 ~3 x( U0 Q, X5 R8 N
  62. static volatile int irqraised2 = 0;
    0 _; u2 h' N- R: L8 n  u+ P2 K, y

  63. ( ]$ b6 r- t6 S0 @! R( a3 o$ v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& B$ u( \$ }  q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! c" M( h# L$ [/ e3 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & x6 Q; R/ u4 T
  67. * |0 u+ n# f1 Y. A& o0 W: P
  68. dma_addr_t dmaphyssrc1 = 0;) k* H! y; z6 _* q) [3 n
  69. dma_addr_t dmaphyssrc2 = 0;6 I6 a5 p4 }& a% _% b  Z9 b2 m
  70. dma_addr_t dmaphysdest1 = 0;7 [5 C/ a3 M! a6 m2 j' ?
  71. dma_addr_t dmaphysdest2 = 0;6 _: Z4 w  U  e5 W8 W; a) f

  72. 2 w1 j  r, v% b  n4 G
  73. char *dmabufsrc1 = NULL;; B! a: O; y. T
  74. char *dmabufsrc2 = NULL;' P& \( i8 d" X' B3 k0 Q, v4 F( Y
  75. char *dmabufdest1 = NULL;
    # X) p! s* x5 {5 o3 r) Y+ _
  76. char *dmabufdest2 = NULL;
    0 ~! M* n4 k. Z* u
  77. $ _8 {9 s( m+ E3 \# {( L0 u
  78. static int acnt = 512;* z( Z1 D3 F( E
  79. static int bcnt = 8;4 j7 S# L8 B6 b; r- x' I
  80. static int ccnt = 8;
      z+ Q  J8 I3 [# u: _
  81. , G8 I# a* `- x
  82. module_param(acnt, int, S_IRUGO);; s  {8 ], D% p+ P8 h: n! Z, [" Q
  83. module_param(bcnt, int, S_IRUGO);& _# _" ^5 T# o) c( x- p: ?  j! U0 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, f9 M9 @8 z/ ^1 ]
0 A/ s' r. a' Y1 J. r" j; v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& y' V# n. d: e$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( d! O! I3 o+ a* Y. }% `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 F9 j" n( A* j. S
7 o& i& `' ?* e, `% j! w' e

$ O' |& ~5 O) A; `3 t7 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 05:50 , Processed in 0.049624 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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