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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 P; M1 z# D. I: ]' {8 ?  T* s6 q
  1. [code]EDMA sample test application
    & v. d0 K. b, l9 e; h  P
  2. /*
    , n5 \; V- }7 |% x  e! g- c
  3. * edma_test.c
    + C; z. [" y7 x8 D5 I
  4. *" o3 E, h: I2 j
  5. * brief  EDMA3 Test Application/ X  b2 h* Z7 R
  6. *  l3 F- o' T* n
  7. *   This file contains EDMA3 Test code.
    3 V! T" l9 ]% r$ V8 |: a; s
  8. *
    : t, ]9 R8 M( h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) `8 R" {$ K' h' Q2 ~+ U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 O# f( Y1 k/ Q& L* J5 h
  11. *         TO CHANGE.
    + z1 U5 ?: O' H+ |$ {8 w2 P
  12. *8 `! T2 b* w3 k: o" }6 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# J. g9 T) T- K" `, ~+ m- w
  14. *
    / r% y- s( G6 |, `. a
  15. * This program is free software; you can redistribute it and/or
    3 @& W7 }  E2 @, m7 T
  16. * modify it under the terms of the GNU General Public License as; S4 d3 w! P, p& h. k& ~! a8 v4 L
  17. * published by the Free Software Foundation version 2.
    * m$ R) a% _3 i# R
  18. *
    7 p! o+ p9 J3 g, F) F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # F9 j( R( {" y$ l9 K% _  ~! W
  20. * kind, whether express or implied; without even the implied warranty
    * C8 }0 E6 p; E, I# x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ G) ^0 q% \1 ^& k8 l" V  w4 A0 m
  22. * GNU General Public License for more details.9 Q6 ^8 m; r! z
  23. */
    9 i! u6 c! T/ ]2 e6 y, ^& F2 p

  24. ( v; |8 X0 J7 _# C* U! s6 |
  25. #include <linux/module.h>
    " J! O% V  r9 i. h7 M' G/ N/ ^7 F' i6 M
  26. #include <linux/init.h>/ U4 n- L& \- f
  27. #include <linux/errno.h>
    - P0 J* Y* e- h, v* K
  28. #include <linux/types.h>
    # D. L' X1 O' ?1 r- U# `
  29. #include <linux/interrupt.h>4 b( }8 k$ X7 I6 O; k
  30. #include <asm/io.h>
    $ T; ?4 V8 S8 e: n, S
  31. #include <linux/moduleparam.h>- u$ N$ R2 l5 o! W8 f2 _
  32. #include <linux/sysctl.h>
    $ k0 z1 ~% j- w# K7 w, k$ ^1 q! }
  33. #include <linux/mm.h>0 z7 u$ t8 E) J6 n
  34. #include <linux/dma-mapping.h>
    6 M9 H5 p) @6 k- n8 |# a/ S/ f

  35. - \+ H$ v# x4 }
  36. #include <mach/memory.h>4 t5 z% Y1 b9 y* m" e& X; ^
  37. #include <mach/hardware.h>7 ?- u' o: S3 N- Q, g
  38. #include <mach/irqs.h>  D, F. Y  d$ G% A' ]
  39. #include <asm/hardware/edma.h>6 ?) y: \" ~' `
  40. 8 V1 ^/ K# n: E( _$ O
  41. #undef EDMA3_DEBUG
    9 i* ?) I4 r& |" b# X
  42. /*#define EDMA3_DEBUG*/: H* Q) f( P& i$ |

  43. ! a, m* x: a- q" c) [
  44. #ifdef EDMA3_DEBUG* x+ T. o' O8 }. U  s* a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 d! y0 O/ v1 X! X: q7 z6 `# e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / h* g5 C5 a" @* B' O% }" L6 e* n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 ?9 f4 i* f2 P" i( o6 a8 H( c3 F
  48. #else: T, o9 X$ E5 U5 K! ]' u
  49. #define DMA_PRINTK( x... )3 B* C+ T' l$ v# ?  a1 P
  50. #define DMA_FN_IN, m9 ^3 ?2 @9 e( l
  51. #define DMA_FN_OUT
    7 R4 m, w+ U/ ?# R" S" v; F
  52. #endif
    % [9 r7 e/ K9 l
  53. ) v& ?4 ?: |3 E* |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  v7 H6 w1 N  ?$ C' m
  55. #define STATIC_SHIFT                3
    % J, w" ~% o# B0 o# b8 q
  56. #define TCINTEN_SHIFT               20
    % A( d. w" o4 Y8 R( F6 L
  57. #define ITCINTEN_SHIFT              21
    2 V; F( X3 x; i8 A# y
  58. #define TCCHEN_SHIFT                22
    0 G* V5 N- M, v0 o9 q6 I6 y: ~' Y' r
  59. #define ITCCHEN_SHIFT               23/ y, `# }( }$ v! H0 q1 `
  60. * f  _2 Q3 {3 x4 W  `) k
  61. static volatile int irqraised1 = 0;. C/ J5 l0 a3 V/ T" K- t& C
  62. static volatile int irqraised2 = 0;. I' l' C: E& {9 I) b6 T
  63. 1 f) Q. a* q3 Z7 W$ V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( t* [4 a, d# `4 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 b0 `. `" d; i/ [7 I  V7 R' Q  k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 ^& |5 s8 j  @7 D; o+ i5 D/ ^. A8 d

  67. , L8 V+ M- V4 v9 Q: x% {3 a2 L3 I
  68. dma_addr_t dmaphyssrc1 = 0;
    0 C* D0 X: d: {% u
  69. dma_addr_t dmaphyssrc2 = 0;
    2 t. G1 ?8 @) d; ?6 Q, N
  70. dma_addr_t dmaphysdest1 = 0;* R/ |- n2 s: o1 D
  71. dma_addr_t dmaphysdest2 = 0;3 n' r+ d" o3 ?; x

  72. * _0 h$ z  Y' i; m
  73. char *dmabufsrc1 = NULL;
    # v. z9 O5 a- q$ X6 j. E
  74. char *dmabufsrc2 = NULL;- z! R/ s% C$ Y; y0 r
  75. char *dmabufdest1 = NULL;; {) E! o$ j  T* K
  76. char *dmabufdest2 = NULL;
    * e" Z1 S) F0 ^2 C/ E' B$ ]

  77. : Z0 K, L. g$ u5 _5 E, D1 p3 w; P
  78. static int acnt = 512;
    1 t4 ]: [: Z) [* x/ K: _$ T
  79. static int bcnt = 8;
    + y. l4 H' k7 Z0 ~5 v4 M
  80. static int ccnt = 8;
    * [& ^, j. V; H1 h( k1 C
  81. , M6 |+ n- x7 _+ F
  82. module_param(acnt, int, S_IRUGO);! W* D% F/ W4 n. K7 S0 t- ?! b
  83. module_param(bcnt, int, S_IRUGO);
    9 \5 x, E% }3 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' Z, h: p1 B; N# r( z9 [
  `4 m: k- o( j, Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" Y; p+ B! @' t2 I$ J2 n
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$ v7 H: M, v4 y; s  u' K! H8 R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: K6 l% ?7 Z& }, T5 l( k
6 C7 n% [1 V! W1 k' L
8 ^9 K/ w+ u8 n* a, C  E% R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 03:19 , Processed in 0.038956 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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