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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 m1 C8 x8 |: J
  1. [code]EDMA sample test application  `7 a/ G5 F# O$ O% l- d0 i. F
  2. /*
    ) j, C1 Y2 k6 f3 C6 m* d
  3. * edma_test.c
    0 k; v$ d! M  N; r1 u" r+ @
  4. *6 ?2 w* D) b( E9 ]# B% J8 ?  K
  5. * brief  EDMA3 Test Application
    3 l- i; M# T1 v& L
  6. *" R+ G. M  ~9 N$ F* e' ^
  7. *   This file contains EDMA3 Test code.# v) m7 b1 G1 |9 P2 ~$ Y
  8. *% H0 W$ a. X% e0 u3 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 i: c, W5 Y4 ~5 r% \1 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) d: P  ^; C8 f& L) j/ |4 y) I% s: v
  11. *         TO CHANGE.+ i. Z* {5 V) T- ~, O9 l9 d
  12. *; l0 D* V" U) r  H. w. s+ r4 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 D: ?4 H) N- i/ N( L
  14. *
    * Y, p0 h( S& z5 M1 X. i' I& `
  15. * This program is free software; you can redistribute it and/or+ N2 U# l& D" h: g' U
  16. * modify it under the terms of the GNU General Public License as, z% ^  N" S! l8 n
  17. * published by the Free Software Foundation version 2.5 G% S( Q: }; V
  18. *- F' X9 N; `: \4 {# d8 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 C8 G, j+ y% |6 b: \
  20. * kind, whether express or implied; without even the implied warranty
    0 C& p- D2 u( L/ p0 I* {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: s! X6 x2 h/ |  G4 K2 j( `
  22. * GNU General Public License for more details." l$ T0 j, X+ i# j6 N
  23. */
    $ e$ L4 K1 V8 P
  24. ; [# q& i" ]5 n( L* n' a
  25. #include <linux/module.h>
    + Z' I3 D* ^6 U2 B( {) L0 \
  26. #include <linux/init.h>
    % n, ^' a, o1 ^/ C# t2 y9 C1 k$ M% S3 T
  27. #include <linux/errno.h>
    ; }. b. f9 W- P5 o4 U
  28. #include <linux/types.h>( B/ e9 T3 m# @7 g# ]# y
  29. #include <linux/interrupt.h>. T: l- U  r3 x) d6 w) R2 b
  30. #include <asm/io.h>; ?$ f: }! G4 O6 x7 @+ j
  31. #include <linux/moduleparam.h>* `" ~% \+ l3 Z( F# r# l
  32. #include <linux/sysctl.h>
    5 ?' b  G. s" u. R. Q. R
  33. #include <linux/mm.h>' v& |1 b5 K: _. i) E
  34. #include <linux/dma-mapping.h>
    # G6 R# C5 f7 }, V1 X

  35. & |/ Y. \" `$ {5 i. P
  36. #include <mach/memory.h>5 @) }* I6 L- W
  37. #include <mach/hardware.h>
    + s6 g3 U: J. m( m0 u8 F* _
  38. #include <mach/irqs.h>
    7 k8 z* v6 n& L/ U/ `8 R
  39. #include <asm/hardware/edma.h>8 h+ u7 |/ b* @( u
  40. * g" J+ c' S! s" t) J5 E- j
  41. #undef EDMA3_DEBUG
    0 I* a8 w( P/ ]$ p$ V; R
  42. /*#define EDMA3_DEBUG*/) Q0 n) G. B# }4 [) L+ O, N* ^
  43. 5 G* v4 c* S- j( \
  44. #ifdef EDMA3_DEBUG+ c* |2 y: S& M6 n+ Q3 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). B' P# J  F  K3 r. ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): r9 {  O! e! p+ p4 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); o* b, A8 c. P9 J( e; C
  48. #else" ^7 W, `' |- }% r& ]- I- B' S
  49. #define DMA_PRINTK( x... )
    : h) D1 k$ x. q! T+ s
  50. #define DMA_FN_IN) e( |; X; [: Q, G( C! T) R; |' }8 r
  51. #define DMA_FN_OUT6 d% J( R7 P, \7 }% ~
  52. #endif
    ; R6 G7 A- M- o/ y1 x
  53. 6 d5 A7 h. D+ A9 }+ Z; F+ x$ `" a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ @! ]* _/ [4 ~: w
  55. #define STATIC_SHIFT                3
    0 p' R0 A: _5 t
  56. #define TCINTEN_SHIFT               20
    $ Y; k% m2 b$ C! U" _/ B( J
  57. #define ITCINTEN_SHIFT              216 V! f: o: r1 W& P$ r% Y/ W
  58. #define TCCHEN_SHIFT                22
    # L2 @  l- W* d2 N
  59. #define ITCCHEN_SHIFT               23
    6 ?- ^" Y$ I9 R' J$ h% [
  60. ' H9 W5 `7 I0 \  c3 i
  61. static volatile int irqraised1 = 0;
    0 H) ^% M% @, S/ y. P- D
  62. static volatile int irqraised2 = 0;* a( r5 w( {; j9 C

  63. 0 _4 ~) ]. g. c" i( c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& w0 p- }7 V# p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ u- G6 T5 z2 p/ q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) K. g9 i" p; X
  67. - }# C* R7 k& h! a4 \5 Z& w/ u
  68. dma_addr_t dmaphyssrc1 = 0;7 S) k! \' U+ x  A' D; X( H
  69. dma_addr_t dmaphyssrc2 = 0;' E* S9 b* `( C0 j) o
  70. dma_addr_t dmaphysdest1 = 0;2 U! j$ ]1 G% s, j) s+ H+ g
  71. dma_addr_t dmaphysdest2 = 0;5 g$ v) H" T% G4 M
  72. ) l! R+ h" H" c0 F, L: y
  73. char *dmabufsrc1 = NULL;2 \+ I9 x  U3 z: V. \  Z% R
  74. char *dmabufsrc2 = NULL;
    , _3 b- Q3 a6 w  q7 i8 [) Q3 [
  75. char *dmabufdest1 = NULL;
    0 S- j- Q  i: w% n; H7 b; J5 G
  76. char *dmabufdest2 = NULL;9 K8 M1 _; H$ J6 q

  77. & e$ U4 M+ e  C
  78. static int acnt = 512;8 ?" d% `& V% [6 M
  79. static int bcnt = 8;/ n% v+ f) p/ l, i5 o! N
  80. static int ccnt = 8;
    8 _0 N( ?1 e& R8 t$ v

  81. : U/ |. N$ J# |0 p3 |# _) u
  82. module_param(acnt, int, S_IRUGO);
    + m3 B  m0 j. _( h2 x$ u# ?$ {6 L
  83. module_param(bcnt, int, S_IRUGO);
    ( A4 p6 p) T0 Z% l3 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ H. h7 @. j/ x4 a" O

4 A3 B; O" U. S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# X0 \, W5 S% W+ W# g4 ^# ?& [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 A! ?1 n) \) M  X$ o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 `9 j; r" B# T9 c* r7 K
( I: z  _+ T! b; g5 ^
+ p3 G) H6 f& I3 K* `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-30 01:09 , Processed in 0.044582 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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