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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  i) X1 v8 g4 k# ]/ @0 R; b, I; [
  1. [code]EDMA sample test application
    ( B/ u. \2 k' Z, h3 U! V
  2. /*, F6 x4 V) L$ q! E; d3 d+ E
  3. * edma_test.c
    - [7 l% P& F9 Y: `5 M: Q
  4. *& J4 v  [- M2 ~" v& |% i
  5. * brief  EDMA3 Test Application
    2 ^4 N; Z/ k# H/ _: D0 |4 @
  6. *
    ( S8 F% a3 \/ a7 P0 \5 |( B0 V& k
  7. *   This file contains EDMA3 Test code.
    ) B" i2 X2 z5 L( P& ~( v' O/ I% G
  8. *
    ; r; p' E, g5 J7 G; r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& ^- _& [8 g0 d" L2 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 Y3 M, b& d, ?6 Z. W
  11. *         TO CHANGE.
    ; K# Y$ j; l3 E9 R0 T3 q! f& R/ K6 P
  12. *
    ! f  b' t* \$ Q( R0 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 K- e+ Y8 `  E( i3 R1 a
  14. *: y, Z8 \3 L5 j! M- m8 l4 N
  15. * This program is free software; you can redistribute it and/or6 a1 @$ t2 _, @9 w, Z0 L7 r! w
  16. * modify it under the terms of the GNU General Public License as+ O* V, X9 M  Z, \8 l# d
  17. * published by the Free Software Foundation version 2.
    ) k: t' k# D# L! {& k
  18. *
    $ V( S) z( Y( ^* a  ~( r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. F6 }% u/ E+ n' Z4 P
  20. * kind, whether express or implied; without even the implied warranty) W& n6 B( S8 ?0 C; }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. Q; Z; `! K* S7 o$ j
  22. * GNU General Public License for more details.0 I& C! t4 M" }7 @
  23. */7 Y+ q* @9 F/ S9 o
  24. 2 R8 x+ a& G6 f! l9 f2 q5 v
  25. #include <linux/module.h>
    & k/ Q; M% L  C' j) [
  26. #include <linux/init.h>
    % v5 R! P6 E5 r1 v" K
  27. #include <linux/errno.h>
    * v2 ?8 ^3 J7 [2 s9 H) X4 P+ |- ?8 N
  28. #include <linux/types.h>1 Q# {' J3 B5 Q, V0 p
  29. #include <linux/interrupt.h># h4 \7 I8 S  t( t) P
  30. #include <asm/io.h>
    0 c4 v- F: {+ U/ q% o# N6 ~/ Z
  31. #include <linux/moduleparam.h>
    - N$ l0 T- e. D
  32. #include <linux/sysctl.h>$ X& n1 g' q7 i. I
  33. #include <linux/mm.h>4 P, f8 J3 {& X2 ^' f- k& i; C
  34. #include <linux/dma-mapping.h>
    " b: y8 i6 H! _5 N5 b/ ~

  35. 2 p0 t0 _' n6 K+ l. m7 Q  _
  36. #include <mach/memory.h>
    ( i2 Y5 s5 M. U, x) ~* q" s" s( ]
  37. #include <mach/hardware.h>
    # @' ]' p7 O0 E
  38. #include <mach/irqs.h>
    $ Y9 p( i3 }. Q- [4 ^( x. O
  39. #include <asm/hardware/edma.h>
    4 Y  _, [" |2 H, _/ O+ Q" F

  40. 2 u& x4 R$ v/ r
  41. #undef EDMA3_DEBUG
    2 J; _2 P( o) h; }, i% Q
  42. /*#define EDMA3_DEBUG*/. _* F* f) l. z# @1 S2 {' F. H
  43. 8 ^6 M1 E+ f5 M1 d6 O- r; V# F
  44. #ifdef EDMA3_DEBUG5 ]0 h3 g+ O# s, k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  l$ i- A- ~; M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& Q9 d; \0 F% X0 m* L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " @: d* N3 v( t( M6 V! C" Y
  48. #else
    + F) E: e% |6 N+ {4 g0 ?0 b5 t
  49. #define DMA_PRINTK( x... )% D1 O2 p" T. Z5 e2 ?, l; [( U
  50. #define DMA_FN_IN
    ' s' }/ A- M) }, I' h
  51. #define DMA_FN_OUT: P. F, Y+ I2 p2 X& s
  52. #endif
    ( P$ ?  Q; a* _) h& i$ U4 @
  53. 1 t8 c( {) t7 j& U3 I% P8 J* x( y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 S( }0 t6 Z: j: v1 Q
  55. #define STATIC_SHIFT                3- B  R6 w. S- h" C; ^; {3 G
  56. #define TCINTEN_SHIFT               20
    , S8 M* Y. M4 p% q
  57. #define ITCINTEN_SHIFT              21
    6 Z! t- K, J% D. X! h2 ?8 u; ]
  58. #define TCCHEN_SHIFT                22( Q: Q' T# O5 q2 t: I' J) |
  59. #define ITCCHEN_SHIFT               23! a7 O% D" d9 l. e% l" `
  60. & ?* t- x' N% C0 A! j7 q
  61. static volatile int irqraised1 = 0;
    ' f5 T2 I( }% c
  62. static volatile int irqraised2 = 0;
    8 \% Q5 ]0 V  n# w/ J) E2 N# Q
  63. ) c  R8 k) Y. L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 r- d  y, O, ]$ l" A) T6 |* F" U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 u0 J+ U: p; f" E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; O  \7 Q4 S+ a7 d4 F
  67. 3 t  c; B5 e  q  N+ P) H1 O
  68. dma_addr_t dmaphyssrc1 = 0;
    3 Q- P: M; n9 p  Q
  69. dma_addr_t dmaphyssrc2 = 0;! b! V- a& m2 r; ]( Z/ u. G
  70. dma_addr_t dmaphysdest1 = 0;
    7 }+ @# _- Q8 X# }. o
  71. dma_addr_t dmaphysdest2 = 0;) F0 ~. ?5 r9 F" R8 c

  72. 4 `* `: `. n! ?" C) K- M+ [* ?
  73. char *dmabufsrc1 = NULL;
    ) L: q( ~! J& q  i( K0 Q4 c. e5 C. \
  74. char *dmabufsrc2 = NULL;
    ; K# U! B* ^- r/ {9 X
  75. char *dmabufdest1 = NULL;
    9 X" p/ q8 g7 D. k: @. l; u
  76. char *dmabufdest2 = NULL;
    * `' W; C* {, C, U3 D, _
  77. 6 k0 v4 X2 N! g$ t8 T
  78. static int acnt = 512;6 ]! \8 ^3 }5 K; Q; O9 z, h
  79. static int bcnt = 8;
    8 i  u4 U$ G, S$ X1 z& `9 X
  80. static int ccnt = 8;
    4 U9 m( [9 w" L3 ?: T
  81. & L. O; Q+ m! c* a
  82. module_param(acnt, int, S_IRUGO);& y3 F( U: E/ A; T8 D2 Q  O- I
  83. module_param(bcnt, int, S_IRUGO);
    % z4 ^! L' t. k4 \% a3 e' u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, l' p) D$ ~5 Y" O+ j) [3 \5 B7 z& T# e+ j$ X: s; L" }! V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 G2 [- c- R; Q- R8 j0 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" u7 b$ v6 I; ~+ k" H2 r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 p. Z/ A+ O' ~2 l) U! o

8 e6 t" h* s( v0 {" Z9 |2 H  v4 j9 o. x1 m4 u2 ?3 k! T4 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 20:00 , Processed in 0.038996 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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