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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 U5 w' h( d; m% i- M" `
  1. [code]EDMA sample test application$ k9 J' d9 K) b- t* a* J
  2. /*
    + y$ v2 U0 O* q: Q( t
  3. * edma_test.c! R+ E/ r$ ~. X! R- F
  4. *8 w+ J7 |, y- {7 Y
  5. * brief  EDMA3 Test Application# Y  @0 O& t3 D, {: y$ D! R/ H
  6. *, S# ]$ P( ^/ H* v
  7. *   This file contains EDMA3 Test code.
    ! ^) v4 G9 V3 S$ ?$ c( {/ a
  8. *% {1 o/ g, x3 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 a: F6 n# H. X3 Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; }3 ]3 ~2 k2 _, O- O
  11. *         TO CHANGE.0 r% ?. @" U, ~7 H2 p
  12. *2 Q5 x& Y" r* o+ Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & O. [& y$ D) ]. {. f
  14. *
    ) Z" c( p  o6 K+ {; A
  15. * This program is free software; you can redistribute it and/or
    7 c, d0 E$ d$ x
  16. * modify it under the terms of the GNU General Public License as
    ( p7 y( k6 E( N5 w/ O9 U- q# k
  17. * published by the Free Software Foundation version 2.! Z4 m' q" \) t: O* Y
  18. *5 g) [3 }8 z. [+ `; Y% S& s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ A: J4 G! G9 A
  20. * kind, whether express or implied; without even the implied warranty
    & k5 q1 D0 q9 M* ~0 p6 m% k0 U  T+ {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- Y& e3 W6 s! N: g* H5 d1 P0 S/ @
  22. * GNU General Public License for more details.
    ) m" H# e9 i+ w& ]$ Q4 g! O- k8 \( ^
  23. *// G2 o7 p; U( B# D! Y
  24. 3 Y4 \* s, e. Z- z+ z1 g/ ], E  T
  25. #include <linux/module.h>
    * p8 F) z" n. b" c# n% ?  f: D
  26. #include <linux/init.h>; W9 I" \( R% _( c0 b
  27. #include <linux/errno.h>
    9 x5 I! Z/ c, |! o- H
  28. #include <linux/types.h>/ A8 S3 T2 g+ P7 T3 J/ C' O& V
  29. #include <linux/interrupt.h>" F6 e6 c! X, K
  30. #include <asm/io.h>
    8 R  D! C- t5 Q$ V# p$ T! K
  31. #include <linux/moduleparam.h>
    # d, K) q) A9 ]8 ^2 V! h% Z
  32. #include <linux/sysctl.h>' X3 E$ v- j2 Z/ A
  33. #include <linux/mm.h>
    9 v, g% x6 y1 o; L* H3 l& X
  34. #include <linux/dma-mapping.h>$ z7 h$ e: T4 K. u* y4 a0 B
  35. " w; ]" P( j4 c* Y( u" S
  36. #include <mach/memory.h>) }. k6 `/ H" I
  37. #include <mach/hardware.h>
    " v3 j$ h; Z) q# o+ `8 Q) b+ J# N
  38. #include <mach/irqs.h>
    " b7 o8 c' d* s9 E1 X; n
  39. #include <asm/hardware/edma.h>. N, w" F& {' `1 d

  40. 1 Z, s' `$ C) K0 O9 Y! ?8 y
  41. #undef EDMA3_DEBUG
    2 Y- W/ W+ @8 d0 Z2 t
  42. /*#define EDMA3_DEBUG*/
    " v1 l3 ~3 ]5 l( f8 F& X  Z

  43. 4 v& [2 |' v0 z  [7 y8 p  Z
  44. #ifdef EDMA3_DEBUG
    ; o) L: t1 k! V9 g3 x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / p  _5 X: l1 o! L8 l. v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) a7 O1 Q( K5 p# C/ k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; e) Y; T% K* c; O+ {
  48. #else- h8 h' ^+ z4 D5 N# `/ K  Y
  49. #define DMA_PRINTK( x... )
    : ]" z* K& L. v  f
  50. #define DMA_FN_IN
    ) z1 f$ M4 w: n* c) _) f/ C; i- o
  51. #define DMA_FN_OUT
    " u+ g7 O  R/ P6 _$ G
  52. #endif
    6 S9 i# e# M# s6 w" \) a7 y

  53. 7 z! a  _3 r- i7 \3 a& `# Z- h0 `9 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      M& c$ B9 b3 `  y
  55. #define STATIC_SHIFT                3
    & x6 X8 N' B" v$ K* O) f
  56. #define TCINTEN_SHIFT               20; A3 ]! {" c* w8 O# m) n
  57. #define ITCINTEN_SHIFT              21
    ( d, j( ?- D% [% `
  58. #define TCCHEN_SHIFT                22
    & n; ?8 m3 o( r/ q6 b
  59. #define ITCCHEN_SHIFT               23
    + I$ q; L- l& }5 C2 K
  60. 0 F' j' e7 |: x* j" {6 g* L7 W- R
  61. static volatile int irqraised1 = 0;
    2 d* I1 l# S1 e9 b
  62. static volatile int irqraised2 = 0;
    * J  E/ S0 O" E5 ~* t7 o& I6 e
  63. ; l$ ^' b1 f. [. X) ]' n- Q+ S7 e# m) F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 E7 K. ]& o6 ^9 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( _4 E7 V6 [) L% M. ^. X/ H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) i& e- z* g, ^( {* s% J0 D& d
  67. * I6 ]0 q  l% E% d. n9 `. d" G
  68. dma_addr_t dmaphyssrc1 = 0;1 Z& M: _2 x9 ]8 w) |( d# I
  69. dma_addr_t dmaphyssrc2 = 0;# ~. M7 J2 D4 h& `0 d, h+ y5 O
  70. dma_addr_t dmaphysdest1 = 0;* o$ J: V0 g0 ^; D( e
  71. dma_addr_t dmaphysdest2 = 0;8 W. K' I- O# ~6 m" N
  72. 4 W' k. r( R! X5 z
  73. char *dmabufsrc1 = NULL;  J. E9 E# ?5 Z- Z! d% x
  74. char *dmabufsrc2 = NULL;3 \) ]6 F1 h+ h0 A% }
  75. char *dmabufdest1 = NULL;$ A5 K$ K( e# D- c: s
  76. char *dmabufdest2 = NULL;/ v( f/ c- E8 W; i6 L3 {7 x% k7 v
  77. 8 `; r* p0 z  s6 {
  78. static int acnt = 512;
    , D5 o6 W6 t( Z
  79. static int bcnt = 8;
    ( O8 L5 v+ E$ B# l
  80. static int ccnt = 8;! v( _6 L# n. s5 ?
  81. " O* O& C: \* j% \# b" ?" M
  82. module_param(acnt, int, S_IRUGO);
    . d' q& {0 ^( \# V6 j$ M
  83. module_param(bcnt, int, S_IRUGO);
    3 z! z% K2 |4 J0 `/ S0 z# h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% ?  a# ~5 z0 l% l4 |' e

2 b$ J, m1 _8 p3 P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 [& g0 k! l0 i# D" H% harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 s! `5 M# o+ I2 t4 B5 o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! j( k! `4 B+ O, u
$ ?) ^- y+ b7 u9 `5 P8 z
& }9 q( w5 B7 B$ c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 14:01 , Processed in 0.038041 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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