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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 D( A( Z, N$ r' d! {
  1. [code]EDMA sample test application
    / g0 P6 B/ H. B% l
  2. /*) r2 h1 o4 Y. E0 ?6 e+ D, X5 v
  3. * edma_test.c- ~) r$ i/ c! }: z  t
  4. *  \  e4 t0 ^+ d# n: y9 t
  5. * brief  EDMA3 Test Application
    ; ?5 R  z/ ~- D+ t3 M1 Z
  6. *
    ' y# Q1 D" q. R
  7. *   This file contains EDMA3 Test code.
    ! G0 z: o  q6 T4 x
  8. *
    ( x0 F/ q1 ?4 _# E4 D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 Q' `. w3 L/ c1 n, r5 U6 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 ~- _3 a5 _% |/ b
  11. *         TO CHANGE.
    # I) ?$ F+ \4 u# F- Z
  12. *0 C" J( C4 B" Q! E$ a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) D1 k1 z; t* D* ^; l" c
  14. *" j# x$ V. l' @: }; }
  15. * This program is free software; you can redistribute it and/or
    , w' B8 ^& \* w0 i4 N$ Q
  16. * modify it under the terms of the GNU General Public License as0 {0 n) H2 C0 h5 H9 t' ?5 e
  17. * published by the Free Software Foundation version 2.
    7 C# |: f: \3 O: k' t
  18. *' f4 L9 f0 a0 g/ b! K# r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! r5 n0 c# R2 Y. {( ^2 ]
  20. * kind, whether express or implied; without even the implied warranty
    6 ^1 {- r! z! _' {" ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! r6 K: ?7 X  i9 e& \" c# e
  22. * GNU General Public License for more details.! b/ O. l5 I& P' r$ |5 Z8 e; ^
  23. */
    ! a1 v  D. [. H/ j5 U

  24. - c# A2 c2 }1 m0 [
  25. #include <linux/module.h>' P' ~* V4 Z  Z8 B5 a! `* e
  26. #include <linux/init.h>8 \7 z0 b& H* S* b' d! X
  27. #include <linux/errno.h>' L) L1 p6 @- _/ _( N9 `, F
  28. #include <linux/types.h>
    , L( J4 r: X: h2 L  r) _2 w! j
  29. #include <linux/interrupt.h>. o; b+ K5 A% \  Y
  30. #include <asm/io.h>- e8 |2 D4 m( U$ `# g7 G
  31. #include <linux/moduleparam.h>
    * P" a, A; ]3 a" s& ^
  32. #include <linux/sysctl.h>
    . }& X5 z" W, _9 U1 Q
  33. #include <linux/mm.h>
    7 E1 ?( |3 d) @3 @. L* q+ W
  34. #include <linux/dma-mapping.h>6 ^, d% e/ l3 W7 k, w

  35. / ?# V; x/ e  C8 Y/ E# Z
  36. #include <mach/memory.h>
    0 ~! v6 O# h1 E+ X; R# F% p6 w
  37. #include <mach/hardware.h>6 W5 Q# J" T+ y) j4 T2 F; A
  38. #include <mach/irqs.h>
    " E, T' I: I; J( L: j" Q1 Q( A
  39. #include <asm/hardware/edma.h>
    , g) B& }5 j& X' L# q' }

  40. $ @" a7 u( I8 \# \6 a4 R
  41. #undef EDMA3_DEBUG4 E; I1 g( a/ D! G9 c' l8 ]
  42. /*#define EDMA3_DEBUG*/3 @% I  o7 e+ }2 a6 i8 L; a

  43. , l% x/ D4 h- Z3 t/ q
  44. #ifdef EDMA3_DEBUG
    0 W( v7 D2 b& J( ?7 p* Y; M6 f( m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ e3 G2 N; v5 p' n  E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & c& q3 _( O" y6 v/ Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! z0 Q: K' r1 V
  48. #else3 g1 S( [! r! @; S5 ^- l' ]5 v
  49. #define DMA_PRINTK( x... )& a0 G# X6 g$ o" _& f
  50. #define DMA_FN_IN; ?5 O: L5 O  D2 r$ t) K
  51. #define DMA_FN_OUT
    , t# H6 c- f6 e4 P9 g' g
  52. #endif' F0 {& P, Y, R5 Y! x" d

  53. . e4 J6 q7 m' [0 e+ [. ]* ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( M! x% C5 R6 O7 ^3 E+ r- ?
  55. #define STATIC_SHIFT                3* {6 O" X8 s: Y/ t! \/ N6 A
  56. #define TCINTEN_SHIFT               20
      o& S' K! }9 z/ R, H
  57. #define ITCINTEN_SHIFT              21( X, _! E1 ?# H% U" Y
  58. #define TCCHEN_SHIFT                228 d  k9 v7 A% w7 w. S& n7 L
  59. #define ITCCHEN_SHIFT               23
    1 v6 H  _% X8 U5 R( C

  60. ' [* ~; ?7 @9 e
  61. static volatile int irqraised1 = 0;
    0 ^- Q, a$ y8 S- T, S6 x$ S
  62. static volatile int irqraised2 = 0;% a& ]7 T/ c( j+ |% \  |8 y% ^
  63. ' c8 ~: h: Q3 D3 i, }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% p* Z' G) S" N# T4 E9 ^1 V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ T# E0 f* ^; }, r& t3 @& _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 `" v6 x" f6 t+ Q: a

  67. 7 p) H0 X% E, }+ m/ L6 u) Q
  68. dma_addr_t dmaphyssrc1 = 0;
    % ^8 M9 K5 G7 n# U
  69. dma_addr_t dmaphyssrc2 = 0;
    6 h& k3 ]# @  n5 f3 }+ o$ K: {
  70. dma_addr_t dmaphysdest1 = 0;
    4 b" ]% O6 [8 k# ^
  71. dma_addr_t dmaphysdest2 = 0;( [7 w% ?: y4 y7 ~
  72. & u8 f9 H# F& t. Z2 S* [' _5 \
  73. char *dmabufsrc1 = NULL;( R( _4 X) g7 E5 o2 c2 }  a
  74. char *dmabufsrc2 = NULL;/ P) p' a* @2 P3 h
  75. char *dmabufdest1 = NULL;4 D; n) {, ?4 @' a# T+ X
  76. char *dmabufdest2 = NULL;
    ! R. s4 H5 e4 U( S) d5 X! e

  77. ! Z* G9 ]8 H1 E+ V" X
  78. static int acnt = 512;
    0 \' f$ ?6 R4 m' x" Z7 e
  79. static int bcnt = 8;
    7 S! M; K6 C# h8 N# m& ~
  80. static int ccnt = 8;% B/ B# J7 p8 N1 V- k! \2 D' Y
  81. : `" X+ c' J8 o/ U5 t
  82. module_param(acnt, int, S_IRUGO);7 j9 F4 K; W9 N  R& y' ?( @. \1 Q
  83. module_param(bcnt, int, S_IRUGO);! t. o2 E: v3 p/ q  B) u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, t* }7 \3 j4 p; Z9 Q2 k% `
9 _) m- k, ]9 z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 F9 o( b6 I7 {1 M* ^* g: }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" m' u4 A4 t5 e) Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 r, T9 ^, t' a# u! I8 ~
/ d3 s2 D$ \8 ]6 h7 {+ z
: Z$ T9 E  W. J& d* [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 11:59 , Processed in 0.040979 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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