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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 |" ?( Z( q& x& o, Y& m
  1. [code]EDMA sample test application
    / V5 H+ V/ d% {
  2. /*- X% F/ A  }4 `( e
  3. * edma_test.c
    5 `/ h" Q9 l% _* l, M
  4. *! l& Q# V9 ]6 A6 o' _  }' g
  5. * brief  EDMA3 Test Application
    $ `' F. H+ L4 X) I, P: Z
  6. *
    1 S1 v/ b$ o* o9 N$ |0 \
  7. *   This file contains EDMA3 Test code.
    ) T4 K' X! q! F# L) S3 f
  8. *
    2 q) [2 {4 @+ |! f2 U/ y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 B: q3 g1 T6 y& r* h; ]4 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 V  r* t, t* Y, }- ~4 o! K
  11. *         TO CHANGE.
    . V  w7 n2 N* K: d" n
  12. *) J# i) b* I! r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 K* R% A# G  q: a- s3 a
  14. *
    ! _' q# X$ G& t4 N# u
  15. * This program is free software; you can redistribute it and/or
    - w0 ]' ]! Y5 e3 a& b, q- u% o+ t  [
  16. * modify it under the terms of the GNU General Public License as; R0 c) s" P! a/ Y
  17. * published by the Free Software Foundation version 2.8 Y: }' Q7 H5 z4 ?+ ]
  18. *; L* `9 Y- B& u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 [; j; b$ d& Z6 R3 T3 K+ ~
  20. * kind, whether express or implied; without even the implied warranty- U2 P! r- u; h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 L. Y# V: g) Z
  22. * GNU General Public License for more details.
    ; M! p) T6 _1 v5 ~+ c
  23. */
    2 b0 K! i; g: R" a- d

  24. + R* t; X+ \# k4 m+ C1 b% y
  25. #include <linux/module.h>
    * Z. z( E& |; C/ e9 V6 @
  26. #include <linux/init.h>
    6 }1 A* a* D) f
  27. #include <linux/errno.h>1 l3 w; z' j6 t! O, y7 h
  28. #include <linux/types.h>0 i7 x$ B( q: i1 P
  29. #include <linux/interrupt.h>1 S. I0 J) l9 z: j. \! u' P
  30. #include <asm/io.h>+ V/ L5 \  _3 Z' U1 @& u( P. z% ^
  31. #include <linux/moduleparam.h>, `: k* Z: V5 B8 q
  32. #include <linux/sysctl.h>0 H# x  L. A$ N- _5 x1 H
  33. #include <linux/mm.h>
    2 @- z+ z. F& i7 K$ U1 U
  34. #include <linux/dma-mapping.h>
    ( V1 I9 @- _9 F& E6 I
  35. 1 K5 N. e* m$ X, p
  36. #include <mach/memory.h>
    ; M1 u7 Y4 m, L' y7 v, s
  37. #include <mach/hardware.h>
    7 T9 d0 {0 R3 [' n5 z# ^
  38. #include <mach/irqs.h>
    1 y2 I% ~/ ]! }) K3 E: A
  39. #include <asm/hardware/edma.h>& z5 ~) m+ t; V1 H- D

  40. 9 B( m, y% }& ~( |* @
  41. #undef EDMA3_DEBUG/ `7 s* W: X: E; g
  42. /*#define EDMA3_DEBUG*/
    6 P0 Y5 Y7 L5 G5 n+ B0 V  J
  43. # ^, p! R" L1 _, q3 c
  44. #ifdef EDMA3_DEBUG
    # T/ l* W' h, R* {! y) u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# y# [- l' _! ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' X. Z4 H$ m1 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( A( ^5 F- C1 @5 {
  48. #else
    , P" N, x6 F( l
  49. #define DMA_PRINTK( x... ). n% U' Y, m( C2 j' \" }0 r. j  |
  50. #define DMA_FN_IN; D6 g6 B: {& e0 f
  51. #define DMA_FN_OUT) U2 _' s' _  W# ^9 m: t% Y
  52. #endif, i3 ?' S/ C& \+ k
  53. 5 I2 @- U6 M" }9 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( E+ a* s5 m7 F; d5 A9 w' \  O
  55. #define STATIC_SHIFT                3
    * h1 p) R8 Q" I+ c7 _7 j
  56. #define TCINTEN_SHIFT               20( J0 H/ b  d, y! _/ }: s
  57. #define ITCINTEN_SHIFT              213 A/ B. o$ C6 W8 b) {, U1 j
  58. #define TCCHEN_SHIFT                22
    " M: F- K) o5 L: {. Q' f' L
  59. #define ITCCHEN_SHIFT               23
    * J  {) e0 H! L3 {

  60. 9 g' c! C9 d$ r9 m% G
  61. static volatile int irqraised1 = 0;# C9 b! `4 D0 l4 i9 D6 l
  62. static volatile int irqraised2 = 0;9 T: B0 H+ c4 o/ O0 \% o

  63. : {/ N* M. R3 p+ j3 E% r/ q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # S+ [* s# E1 A9 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* F: T% C* `9 c8 w! Y& a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ L& q4 P/ X0 A% E6 @' i$ x
  67. + L0 V. P+ t, S8 l
  68. dma_addr_t dmaphyssrc1 = 0;
    5 u3 X4 F7 `* s# f
  69. dma_addr_t dmaphyssrc2 = 0;7 P: o9 `7 H5 e4 [% `
  70. dma_addr_t dmaphysdest1 = 0;, f& \( L* o+ }+ \1 x& M5 r
  71. dma_addr_t dmaphysdest2 = 0;& x* T! J" K5 Q2 c: n

  72. % n# b3 _# v" C$ Y( d
  73. char *dmabufsrc1 = NULL;
    3 N0 Q! H& F2 P" ~" |
  74. char *dmabufsrc2 = NULL;
    % L' C( r4 ]5 F) I& ?
  75. char *dmabufdest1 = NULL;* s, ^, `. I! c& @
  76. char *dmabufdest2 = NULL;) |  p3 j3 Q# Q- Z& {

  77. , X: O( Y: x" z
  78. static int acnt = 512;
    & |- C) a- X! Q  Q
  79. static int bcnt = 8;' Y2 V8 C! J# ?- O0 r8 Z
  80. static int ccnt = 8;, ~6 `9 A2 Y$ g0 M* L, M

  81.   ~* j5 [* ^! e6 d) B7 K
  82. module_param(acnt, int, S_IRUGO);6 U* [7 l2 n( ?9 }8 w
  83. module_param(bcnt, int, S_IRUGO);5 `- ?% ]! V1 D+ Z) f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ Y/ k5 N: s* p; Z) I0 T$ \
+ L7 a. k4 B7 K. k/ U+ X% I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 J, P* z/ Y2 z5 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- \/ |% o7 p* K; x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ Z+ D! e: Y! L+ ]1 V( ]
, |* p4 t. I! j+ f( {2 B

5 M& ]7 I# ~4 M" A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 08:34 , Processed in 0.036638 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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