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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   t! h$ q% ^! W# ?5 _
  1. [code]EDMA sample test application
    % H; ^4 s" ]. \4 L& s; b6 I
  2. /*
    ( Y( n5 q: [/ ?! S
  3. * edma_test.c" k! j" j+ `  S  ^
  4. *
    , V! A) `1 ]% P/ l8 X2 _
  5. * brief  EDMA3 Test Application
    4 T" ]. y- Y2 [# J% K
  6. *0 o7 F  p& k& e& c, \, f
  7. *   This file contains EDMA3 Test code.
    6 I- }/ M2 X7 Q3 B/ z
  8. *: B, o9 ^# H" ~5 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' \) S2 Y8 `/ \" Y7 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 A5 B4 o# `+ ~1 Q( ~7 n" N' S: k
  11. *         TO CHANGE.5 ]9 n: N6 l; N6 q5 }$ n+ [' s1 ~
  12. *
    ! J/ C3 j/ }3 o9 i: y7 C* T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( U8 A$ Y" l6 J1 r
  14. *: ^% F6 o5 h& J6 K( g) c1 I
  15. * This program is free software; you can redistribute it and/or
    ) I- `* ]& k5 Z
  16. * modify it under the terms of the GNU General Public License as& M' q! D1 F) {9 _; c
  17. * published by the Free Software Foundation version 2.
    + j! U5 W/ W9 D. V
  18. *
    8 ^' o6 B9 g6 `4 H8 T5 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + A  a# A5 M9 z  s/ E
  20. * kind, whether express or implied; without even the implied warranty# p1 o1 f# h& _' z4 z& ^$ ^4 a; ~1 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # Z- b' P3 {- R9 E7 s) h% b. e
  22. * GNU General Public License for more details.( k" d  ]3 c$ l9 C4 w+ c
  23. */
      z8 y1 H* j' l: N

  24. - |+ E, O6 D% ?; X( x1 W' Q2 g
  25. #include <linux/module.h>7 n3 n, I' Q8 Z( e6 G
  26. #include <linux/init.h>& F! R! |7 ?) c' L! L1 n
  27. #include <linux/errno.h>
    5 N& a6 l- I& Z3 d
  28. #include <linux/types.h>7 t7 A) C2 A: W. F2 V5 G
  29. #include <linux/interrupt.h>' _+ {; `% }: p; F! X& A
  30. #include <asm/io.h>
      G1 c. ?. D8 O- h2 M
  31. #include <linux/moduleparam.h>, e/ v. r* i* C' D: t/ ~
  32. #include <linux/sysctl.h>, B( A( K9 A6 m8 C, c
  33. #include <linux/mm.h>- D! }+ h% j1 k6 {2 P- w  }5 c% R
  34. #include <linux/dma-mapping.h>$ d- R" B/ z: `, ^9 h7 ~% I. ]
  35. - c9 \) Z8 S  _% u
  36. #include <mach/memory.h>
    % B; r( @" {/ b. t9 U2 ]. F
  37. #include <mach/hardware.h>
    6 s$ g) b% \9 i0 d
  38. #include <mach/irqs.h>: O$ t% s3 s8 ?6 f
  39. #include <asm/hardware/edma.h>  i% u2 U8 i; q; q! y: j1 c$ Z3 t
  40. $ Q( k1 A( q0 s) u4 C6 T$ O/ @
  41. #undef EDMA3_DEBUG- V  n! f3 i* l( [: U3 g
  42. /*#define EDMA3_DEBUG*/
    9 q. d/ e/ [9 N6 `- p' Y
  43. & g+ V; ^+ B# Y) P5 ~  J
  44. #ifdef EDMA3_DEBUG1 K1 f4 G* ]! w- X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 T5 D4 e) [- l( C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 e1 p" T" f1 A2 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # q1 p5 g" p; c/ O8 @& s
  48. #else" C4 |8 T3 H/ |; J* C' K
  49. #define DMA_PRINTK( x... )
    $ g; Q1 ?, x- V) c: ^* T
  50. #define DMA_FN_IN
    / _& [. M7 T7 J/ x& ^  U
  51. #define DMA_FN_OUT$ u7 ^8 c3 w4 z- t. W. X
  52. #endif0 s3 D3 W# u: E1 }# M+ D2 v* G! ]

  53. 7 E! n. S! u. X; L+ ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 ~: |9 U2 s4 Q3 u
  55. #define STATIC_SHIFT                3
    $ q2 _4 d: i4 y+ U* l, j
  56. #define TCINTEN_SHIFT               20/ J( |7 l7 c& a$ D8 n% y' S
  57. #define ITCINTEN_SHIFT              21
    ( g& d6 K6 Q0 @3 j) W
  58. #define TCCHEN_SHIFT                22
    . n$ W( f! r8 ?# e! Z
  59. #define ITCCHEN_SHIFT               23
    , _" A, `# u2 _& h9 n
  60. 2 Q3 m9 e  f& B# m  }& V) X
  61. static volatile int irqraised1 = 0;% E. A" e, H* n3 x7 L" ?% N9 |
  62. static volatile int irqraised2 = 0;
    : C, s0 Q. c0 I- |8 _$ r9 @
  63. ( f5 a8 b% b( P& O% z7 @; o$ X( A& W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 K& H1 i( x( U9 w8 p7 w* |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) h5 a- E& p, S& N" [; [5 I; w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 n8 ?. s5 P7 X. A  b
  67. 8 _( r1 H) p' X+ \
  68. dma_addr_t dmaphyssrc1 = 0;, o! C7 D8 t( Y* ]( V- P) ^
  69. dma_addr_t dmaphyssrc2 = 0;
    2 C* e' F) Q  y1 t
  70. dma_addr_t dmaphysdest1 = 0;
    ) ~4 \- N1 O  V% p, F+ d
  71. dma_addr_t dmaphysdest2 = 0;
    . z; H0 z! S# `) ]: j3 Q
  72. / A1 T& l% e% N8 K; B% Y$ q
  73. char *dmabufsrc1 = NULL;
    & T# Q/ w* M% T- s* W& p/ P4 N/ I8 W
  74. char *dmabufsrc2 = NULL;  ~; ^( V3 q0 d3 M7 z) {
  75. char *dmabufdest1 = NULL;
    - L! ~/ K9 y0 Z: _- D4 p# \1 x: X
  76. char *dmabufdest2 = NULL;2 c- |) a9 j. O6 S" d; m
  77. 3 Y- h; L( h; ^% R6 w& Y
  78. static int acnt = 512;
    # D. \# L' z! e* \7 ^4 O' s
  79. static int bcnt = 8;, G* f! R' ?: e- Q7 [
  80. static int ccnt = 8;/ f3 _( E. z% ]0 o* D( T

  81. 4 m7 ^* |8 U& Z' U
  82. module_param(acnt, int, S_IRUGO);; h# F# Z% Y* b9 o0 H4 e, ]
  83. module_param(bcnt, int, S_IRUGO);
    : B6 B1 h2 Y; L/ ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 s4 W& v! Q7 s: e2 i$ L9 |4 O2 L
0 f: Q1 j# I7 P+ E) h/ j! b+ D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, t# \6 D/ b+ u. W* F) @. A) j' |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; ~6 }& X9 d3 f9 T$ z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# v2 Z. c, [3 I8 D% y: ?+ ^

; @8 v4 l6 x) c& ~3 v& R8 t9 q4 g: b2 l4 Q- W" O, e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 08:34 , Processed in 0.038659 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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