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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 ~: g8 N9 d# J9 @4 f) W
  1. [code]EDMA sample test application
    $ j3 B7 v! \- t
  2. /*( e! n$ l" W# S7 M& g% K
  3. * edma_test.c
    3 T) B$ A) v8 U4 [& \1 T+ A
  4. *
    0 P. p) w) K4 G$ [4 f$ p+ Z
  5. * brief  EDMA3 Test Application
    1 ~; ^- L5 q0 q7 Y- }
  6. *
    - [& l1 j9 I- u
  7. *   This file contains EDMA3 Test code.
    4 o% O: x; }0 w; C5 H0 c
  8. *7 y- P8 f2 h1 d2 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 s, j8 R4 [; P7 b( _; S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' R- a5 b3 M$ `1 i
  11. *         TO CHANGE.. h) P, Q( S1 {4 n
  12. *% {5 c0 c: A# O3 ?8 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 x, P& p* }# o$ _$ o2 D# t1 H
  14. *
    9 V4 _" b# j# ~
  15. * This program is free software; you can redistribute it and/or! C* ^' v/ P& X% q0 X+ S# N3 X2 |
  16. * modify it under the terms of the GNU General Public License as
    % L% e2 r1 A& t# Q# q: x; X6 w( Y
  17. * published by the Free Software Foundation version 2.
    " t5 j" C0 X2 b, l1 F* F+ Q
  18. *
    : Z3 W+ B& A& v9 {5 L7 i% q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. Q: L( w3 Q1 ]! w
  20. * kind, whether express or implied; without even the implied warranty+ b. n1 q( f6 f! ~' @6 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 ]* F5 q' v, k, {( X# D8 s
  22. * GNU General Public License for more details.
    & D( ]' ^* t# t% @# D9 G& P5 h2 V
  23. */, g$ f- q* O# ], Y

  24. # I  i3 a( P) g; s
  25. #include <linux/module.h>0 T1 I& e$ m, w' X/ g' ]5 G
  26. #include <linux/init.h>
    . ^2 m+ y2 a3 L3 F  a8 i; q; _4 g
  27. #include <linux/errno.h>
    ! ^. A8 Q+ b$ j) R) \# _& T
  28. #include <linux/types.h>2 s5 e6 p" i; D- D8 l3 @5 g' t0 ^
  29. #include <linux/interrupt.h>
    : k) W3 D) i8 b% U
  30. #include <asm/io.h># [- t, g9 d& ~' Q$ y
  31. #include <linux/moduleparam.h>8 S; P: T0 W8 X& o! y
  32. #include <linux/sysctl.h>
    & F9 ]4 G# N6 c8 K; r. A' c, n& c
  33. #include <linux/mm.h>
    3 ^- f' x0 L& B- U' M
  34. #include <linux/dma-mapping.h>
    2 [; }' D$ V0 e% R5 k
  35. ! |! r' K) s* _$ V
  36. #include <mach/memory.h>" h4 `( p0 Y% }# u$ H) N9 F
  37. #include <mach/hardware.h>
    $ K0 A, c7 B5 D$ W$ F& T
  38. #include <mach/irqs.h>( g% }( [6 r3 d: M: r# L8 y
  39. #include <asm/hardware/edma.h>+ U: s7 i0 `" S- m9 Y
  40. 1 A  }" N( |$ k) i8 v# L- B/ d' ^
  41. #undef EDMA3_DEBUG
    , u4 n8 m0 K  d2 m
  42. /*#define EDMA3_DEBUG*/
    ' q( d9 p0 y2 X( l

  43. 1 K/ S8 n2 g+ u7 C8 _" G$ G# N/ [: W
  44. #ifdef EDMA3_DEBUG
    3 [5 l: ?& U. D% W+ f  m6 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# O, J) ~) j! d5 q: h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 L* v$ Z$ h  ]4 \$ [2 n; K2 B$ g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* O9 m/ g2 U. q2 j9 a
  48. #else, ~2 w( `( r2 C7 d
  49. #define DMA_PRINTK( x... )
    ) f0 f$ O4 ^2 J+ b: L& h/ b7 v2 \
  50. #define DMA_FN_IN0 W% f( [& y" @' Y% O/ x
  51. #define DMA_FN_OUT
    " L' a/ H8 f+ V
  52. #endif
    ) T& U  J) P7 Z2 _4 X5 F% s' t% f
  53. 5 x6 Q8 p+ V8 j6 g2 i+ p8 O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      W) F) K/ k5 J
  55. #define STATIC_SHIFT                3# a* Q$ V9 j+ `0 P2 j: @5 c6 d9 p/ m: o2 G
  56. #define TCINTEN_SHIFT               20$ P0 ^2 {" B' F7 V" T- V
  57. #define ITCINTEN_SHIFT              21* `5 h: @* O/ i7 A' S1 n
  58. #define TCCHEN_SHIFT                22
    9 r) P& i7 s- ?. E; ]
  59. #define ITCCHEN_SHIFT               23
    6 o  N: c; {2 K4 N2 u
  60. 3 y" a# Z! p& l. K, o2 s) k# g
  61. static volatile int irqraised1 = 0;, ~  t+ n. O& m/ w1 f6 ?4 _& J
  62. static volatile int irqraised2 = 0;5 P' _# u/ D; ~7 I
  63. % x, X0 W- ]) C* N: w% k5 R+ h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ y, I" {. N2 }& _" E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! V. c9 b2 h1 r( W; G" h- m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( w& \1 C% y/ P/ `# c2 a
  67. 7 ]2 J- R5 ^- i
  68. dma_addr_t dmaphyssrc1 = 0;
    $ d) h! Z% h+ `* w+ P- O' t
  69. dma_addr_t dmaphyssrc2 = 0;
    / n" |5 {: H' ~! N' x; l
  70. dma_addr_t dmaphysdest1 = 0;
      q% F8 r" h0 a% r* k; o
  71. dma_addr_t dmaphysdest2 = 0;7 a  c6 D, ~: X4 p

  72. - J( }/ N- c1 P2 x% L
  73. char *dmabufsrc1 = NULL;
    . }* F+ ~7 M, f
  74. char *dmabufsrc2 = NULL;# Y( O4 x- x3 v$ }7 r$ z
  75. char *dmabufdest1 = NULL;6 e% N, o7 _7 d; R- x! T( m8 @3 Y
  76. char *dmabufdest2 = NULL;6 ]1 @8 p  C$ P( {' Q
  77. . V: ]6 _% V9 \, ?8 Y9 ~
  78. static int acnt = 512;1 T5 M0 r; n7 L9 l# a
  79. static int bcnt = 8;
    - H  W' a- I2 @( O( [( J: Q; k7 P% Q
  80. static int ccnt = 8;$ E$ ?% E+ J( U

  81. $ p2 l; b5 m5 f8 u0 |
  82. module_param(acnt, int, S_IRUGO);
    3 U/ q7 t" b1 s9 l
  83. module_param(bcnt, int, S_IRUGO);
    9 \2 L. s2 @* h, d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- |6 D3 W& ^* j3 P& J- Q+ U. s: V2 {6 p; w# t  J# {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 X% m4 v+ A0 |3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# O, i5 E8 Y" Y$ V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ g0 Z, U6 w8 J$ B' q3 Q' G  J

- _  {' V, l. }3 q
1 D' S, l- |/ N" J% u$ r1 p2 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 18:42 , Processed in 0.039887 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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