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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  t2 A* k* Q7 H  D) R
  1. [code]EDMA sample test application
    ( v6 t# R3 R; m
  2. /*
    5 n( O$ J8 [1 [7 c( a
  3. * edma_test.c
    6 R! h- h: _) D1 U
  4. *
    * T3 Z6 Z8 X: t8 Z, Q( T: R
  5. * brief  EDMA3 Test Application
    6 L- |$ [0 J0 ^5 U# H8 T
  6. *
    * @7 i  ?, Z0 q2 a" ?: O" n6 [
  7. *   This file contains EDMA3 Test code.+ F$ d2 E& g! A  ^1 K9 p
  8. *
    4 w/ x: M" F+ f7 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 e$ L1 m' a  }/ U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) D5 B* w* j$ C5 R
  11. *         TO CHANGE.& T1 i1 z4 Q0 }6 u$ ?
  12. *
      ?  }% p+ g( p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 A2 D  N' q3 K+ e- W4 A
  14. *
    8 o9 Y1 A7 H0 U; `% G4 T3 h
  15. * This program is free software; you can redistribute it and/or8 A: L+ O/ o, e) y
  16. * modify it under the terms of the GNU General Public License as
    " ]! M0 |4 H# o8 `% [
  17. * published by the Free Software Foundation version 2.2 `! c5 C5 o+ W4 h: D; p& g1 C
  18. *
    ! f. Q+ c6 J) i, E2 C3 u& v/ f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ q& r) i% V- J
  20. * kind, whether express or implied; without even the implied warranty
    & _) G4 E+ [$ [: x: Z2 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! k! M1 h/ m/ G9 Q4 y" P
  22. * GNU General Public License for more details.
    ( I! g2 G$ P% m
  23. */
    - x4 j4 b. G7 d& K% v- T

  24. 9 o/ A' q  N- M
  25. #include <linux/module.h>3 }% l$ z+ \1 o1 B7 u2 e
  26. #include <linux/init.h>! x2 D0 H# G1 p
  27. #include <linux/errno.h>. ~+ l2 ^' ?0 a
  28. #include <linux/types.h>1 \8 t5 j$ a4 \
  29. #include <linux/interrupt.h>% W- g5 w4 t. R
  30. #include <asm/io.h>& @4 U: K0 e( z. l
  31. #include <linux/moduleparam.h>; ~3 x' J" X% C% \8 [2 [  d- s
  32. #include <linux/sysctl.h>/ j( c1 y* g) q3 W- c
  33. #include <linux/mm.h>& J5 F2 D* }8 T9 O, X2 Q
  34. #include <linux/dma-mapping.h>
    & v1 X' s- r% V% f2 G) `) d) P/ j

  35. * n* s0 g0 _# X
  36. #include <mach/memory.h>
    # c- j* s) D2 ^
  37. #include <mach/hardware.h>) _6 D7 U1 d5 K: p; d3 r
  38. #include <mach/irqs.h>$ |. _- N4 O3 ]4 D
  39. #include <asm/hardware/edma.h>
      G) c7 ]8 n' W' C# f0 r3 B1 Y2 P
  40. : O$ p* @" B0 u/ P8 a8 p3 y  ~
  41. #undef EDMA3_DEBUG
    6 c# p5 u" R' B+ H! Y( Y
  42. /*#define EDMA3_DEBUG*/( G2 i  n- i- [, a! e. _

  43.   ^) a6 @& @6 }* |7 s2 W
  44. #ifdef EDMA3_DEBUG% F, F8 Z, ]# H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 R  J4 z4 L& `& R) K, G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . Y8 R, z! W* o. j, s! ?: Z+ }, m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# r$ X( l# A( w7 q( y
  48. #else
    8 `8 S) }* y! ~- L& O& [
  49. #define DMA_PRINTK( x... )
    8 S# _4 f6 G8 G3 w
  50. #define DMA_FN_IN
    5 W* R' \% v* x4 N; k/ D
  51. #define DMA_FN_OUT: D. O+ \" a' C
  52. #endif( ?0 \7 L4 k( @2 a

  53. 5 }% t: W3 h/ ]4 i, c4 `$ T; {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 G. x7 R: r- w8 n# r
  55. #define STATIC_SHIFT                3) M) r9 G5 k4 e, ^  }; G8 [
  56. #define TCINTEN_SHIFT               20$ x* p8 y5 b5 i
  57. #define ITCINTEN_SHIFT              21
    " R. y& S# I2 l6 v$ S1 C/ b, I
  58. #define TCCHEN_SHIFT                22& b9 C7 ^5 I0 l$ N) _
  59. #define ITCCHEN_SHIFT               23, A) z1 L$ @4 u/ _
  60. 0 j0 D2 V& A2 Q/ n5 j& ^9 s3 r
  61. static volatile int irqraised1 = 0;1 j5 ~$ Z3 b. h5 v
  62. static volatile int irqraised2 = 0;% l; P- L! D& |

  63. 3 J! }& e, D: J2 L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" E% R- R) C* J& d  Q/ F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) K6 @0 Z0 u0 y4 t; r! o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( k( `9 d+ g' g& m" @( j

  67. * k9 f7 k" Q7 c: {
  68. dma_addr_t dmaphyssrc1 = 0;0 ]$ ~) _" D6 U! M, y
  69. dma_addr_t dmaphyssrc2 = 0;) K' k# Y) A$ B: m1 u5 p% e
  70. dma_addr_t dmaphysdest1 = 0;/ h, y* x+ A3 m3 ~* O; Z7 d
  71. dma_addr_t dmaphysdest2 = 0;
    4 q5 Z3 H# S! f7 A, t% Y! l! Q4 D8 @
  72. ) c0 X1 f6 T4 I' X: ^2 R
  73. char *dmabufsrc1 = NULL;! G) L3 _' O8 ]* g5 X& L
  74. char *dmabufsrc2 = NULL;
    8 R6 X7 n: R6 \
  75. char *dmabufdest1 = NULL;/ s) C! ]; r$ [  W' Z2 v
  76. char *dmabufdest2 = NULL;6 C# X9 _' a8 T. C% @
  77. " Z& U' {4 a0 k  Y+ j1 _
  78. static int acnt = 512;2 h5 @4 _0 \- B: u2 c8 T! C# r" ^
  79. static int bcnt = 8;
    2 p, f. i2 V9 i# X/ E% |) d
  80. static int ccnt = 8;
    ! r) ~' c7 ^6 c
  81. - X$ h) t, a1 z, @
  82. module_param(acnt, int, S_IRUGO);2 E& p+ |+ m6 r4 ^9 w
  83. module_param(bcnt, int, S_IRUGO);
    * L4 _6 |: r' N. c" L/ A7 l4 a' i6 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- ^+ K" n  ]$ Z! M+ j) \/ c0 @5 v& o
- Z3 ?: n4 {0 G" g1 Z: I* p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* n* |+ v& N* M! k/ Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 S& |' M2 @$ A4 e3 E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 V# B6 C$ R/ J) I3 c' y

$ }, ?* N. @/ N3 x, _! g0 M& i% d7 R) R% ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 04:41 , Processed in 0.039516 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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