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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 R' L& u* ^0 {! L# b
  1. [code]EDMA sample test application
      v% o3 s2 U4 F) e1 M& F
  2. /*
    ; i* b5 ]5 w9 c+ q4 p/ C! A
  3. * edma_test.c
    0 p$ W$ [; c6 ^+ y" f
  4. *. b' R: D0 F6 ~( t' n! w
  5. * brief  EDMA3 Test Application
    % ?4 ~5 T+ k4 ?0 n+ j% N+ O  n
  6. *
      G# S) ~. U3 y& i$ u
  7. *   This file contains EDMA3 Test code.
    2 U5 Y# _* F! G" j' q
  8. *
    + h1 D. _; y" ^. v6 p; W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 E6 V& Z$ F% L& y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      e5 Z" ]# O8 G: x: L
  11. *         TO CHANGE.$ s) b( }$ G3 I  \; f7 h8 e. W4 O
  12. *: R, S- M! w4 l3 V; I1 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% V+ Y8 P$ m+ g
  14. *
    + |) @0 p7 S4 c- G9 S3 Z
  15. * This program is free software; you can redistribute it and/or
    9 y9 a, n/ j0 w% t5 ^* c
  16. * modify it under the terms of the GNU General Public License as9 t/ q" }, z5 e- R9 V7 e  x
  17. * published by the Free Software Foundation version 2.8 M+ {" G" \* c* B
  18. *4 B0 Y+ V! d! O( V; R# m: ?# M/ _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 }3 z2 ^% m, P* @7 `
  20. * kind, whether express or implied; without even the implied warranty
    - X5 s$ c( D" A6 Z8 U4 F; l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* I, K' J! p4 Q9 l4 F- D
  22. * GNU General Public License for more details.$ u3 b. E1 x! f8 M& D' t" O7 N' K
  23. */
    3 {  f* b+ i7 A
  24. 7 Z& P5 b1 O1 b$ `/ ]
  25. #include <linux/module.h>
    * o2 i* t1 d! ^" V1 Z2 A6 ]
  26. #include <linux/init.h>
    5 s9 @+ o! E  z8 @7 J- R
  27. #include <linux/errno.h>
    , m1 @# x8 @5 \9 J7 w3 E- L
  28. #include <linux/types.h>
    $ v* [+ r! M1 \7 f# }
  29. #include <linux/interrupt.h>" Z! q" e+ _" _( H  s  [; w
  30. #include <asm/io.h>6 ^+ X1 F3 D( X. E7 I
  31. #include <linux/moduleparam.h>8 @* q5 F' c; P( h
  32. #include <linux/sysctl.h>+ F/ Q. b6 Z0 j
  33. #include <linux/mm.h>5 c3 `& s. R  G: S# w7 n
  34. #include <linux/dma-mapping.h>
    % T9 g. }9 ]1 v1 Y

  35. " `1 z$ P) m! p$ Q/ r: }3 C
  36. #include <mach/memory.h>" \* `+ S$ |1 z' s# T4 |0 u
  37. #include <mach/hardware.h>  y! r  Y8 h8 U) s/ V# A  u3 q
  38. #include <mach/irqs.h>- g' E  o: ]+ p! ~( T: W
  39. #include <asm/hardware/edma.h>6 P% F+ w" C3 a6 x$ U
  40. 5 d( {7 j3 l# {- s4 L4 C& R$ q
  41. #undef EDMA3_DEBUG8 _/ x: T- D- P
  42. /*#define EDMA3_DEBUG*/
    $ q- G/ J; Z, W& l& d
  43. / u: A6 u! h$ c7 L) P, Y! i1 q
  44. #ifdef EDMA3_DEBUG
    , O/ s! ^# k' K6 D( N( a& c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); E! z' |4 Z5 n( d& c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; w2 \1 L' G& v  G- |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( e3 g" X+ I5 L6 M3 b
  48. #else6 \/ U$ H! L- e2 w
  49. #define DMA_PRINTK( x... )' n  Z/ w2 F3 m( m
  50. #define DMA_FN_IN* K: [, W2 H5 H: N5 A
  51. #define DMA_FN_OUT
    * M: e9 W( c+ W6 F
  52. #endif
    : X$ t4 u4 E. u" r; B

  53. 6 H! c. e5 H3 \1 P) q$ e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ d& }7 d2 e( e7 S3 x
  55. #define STATIC_SHIFT                3
    ' \* e& C0 D; O/ d* w( i1 M2 O
  56. #define TCINTEN_SHIFT               20- w. z, M( B1 O2 s  I" h1 u
  57. #define ITCINTEN_SHIFT              21' l& \9 ?. ?2 y! a% K, f, a
  58. #define TCCHEN_SHIFT                22
      y. |6 I+ S$ B" g. h9 F8 l
  59. #define ITCCHEN_SHIFT               23
    0 k3 M# _! K! E+ E% |
  60. ; Y: i+ G: t; n; {7 M6 _+ T
  61. static volatile int irqraised1 = 0;7 a- x5 Q& p. p& {2 O  C3 [& P
  62. static volatile int irqraised2 = 0;
    - _* L0 n  M6 S" O* w" i8 [. R5 \. B

  63. - i: s1 @5 a+ W0 S) p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 U4 p. A8 T2 y/ L. I% g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 x0 i# j9 ]  L* v' m8 W6 l. r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 c9 y/ y) v' k& ]; q# Z$ Q
  67. 3 D% D9 i" Y. j
  68. dma_addr_t dmaphyssrc1 = 0;
    ( c6 }( n- m/ b9 Z) {7 g) V& J! d
  69. dma_addr_t dmaphyssrc2 = 0;
    3 ^0 v5 |2 c8 E% p0 a
  70. dma_addr_t dmaphysdest1 = 0;
    " h+ L: v$ o* e' m
  71. dma_addr_t dmaphysdest2 = 0;
    . Q- @9 B9 p) d: X
  72. 0 `6 ?- j% C( A0 |7 S! t# D8 f
  73. char *dmabufsrc1 = NULL;! I7 {. R( ~' p( m. [# J
  74. char *dmabufsrc2 = NULL;4 G9 I3 K5 e  e1 F0 q# F/ n9 D
  75. char *dmabufdest1 = NULL;5 ]+ a" Y7 T/ b; N! o1 |/ v
  76. char *dmabufdest2 = NULL;% Y* G( A$ P% Q8 A5 h
  77. 8 g: k  I  l/ \
  78. static int acnt = 512;5 _" W" S2 g' o) [
  79. static int bcnt = 8;
    ( W' [- ^5 k! x8 \' i: z7 P
  80. static int ccnt = 8;
    5 G% n' e: U+ p# E* o

  81. # A9 x, m7 V) ~6 I" b. m
  82. module_param(acnt, int, S_IRUGO);7 q% J7 P* I& i& @# Q, g
  83. module_param(bcnt, int, S_IRUGO);
    : c9 g- @# B( V! f' r! Y, l7 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' O! `# d% W" J) k! x  m4 O
9 l7 _0 P2 _0 J0 \9 g1 l! t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, ?' w' s( S1 P  v+ D9 I. R
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 A* y( ~+ a% U2 G7 x% O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 R8 s6 W6 R! M! @( [
# Z: p5 A0 G) l+ u# t9 Z' T* @

' e  @& D" P' z9 F3 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-23 08:15 , Processed in 0.042311 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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