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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 h8 E2 p, P; a; h( l
  1. [code]EDMA sample test application8 _) {$ D! H+ L+ M" D% U+ P' K
  2. /*
    6 a+ [3 e( b! H" m5 G. ^
  3. * edma_test.c
    . R" `1 k9 m6 E: N
  4. *% T6 S9 b* o- ~( P6 p6 ?% t
  5. * brief  EDMA3 Test Application
    6 g( w* O6 i1 L1 f
  6. *; w1 w7 F6 k/ b
  7. *   This file contains EDMA3 Test code.
    7 y, Q1 \# L$ S$ h$ [) [
  8. *; p! C: ~( K) t: e# r, x/ I# X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" }$ u' p' \+ {8 p# A' |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! |  H+ g( P; Z+ X: s
  11. *         TO CHANGE.8 F/ z# V/ F; a5 W9 Q
  12. *8 t( R/ Q4 J) i; I% p2 ?' F9 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 W6 f2 Z1 P: M1 V
  14. *
    7 z' p) L3 M' z" y* @7 d
  15. * This program is free software; you can redistribute it and/or8 y1 e) @1 k) U) d
  16. * modify it under the terms of the GNU General Public License as/ W: \# v% i: p9 Y& G# y' N
  17. * published by the Free Software Foundation version 2.
    9 Y* o2 Z& n# Z3 f
  18. *) S9 z  ~, l9 l5 C! c: }! U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, Q$ v" a' h% w1 d" o) {+ z+ r$ Y8 \- Q6 R
  20. * kind, whether express or implied; without even the implied warranty
    - t2 U9 C: }6 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# K4 f! b* }$ U
  22. * GNU General Public License for more details.
      w- ]9 M' {, f2 h5 N
  23. */& N+ W. l3 k/ Y3 i# K+ @

  24. 3 m/ C1 x" ]/ D0 A+ r% l
  25. #include <linux/module.h>
    5 p  Z; a5 V, h8 @+ [& k2 A: O
  26. #include <linux/init.h>( }" D& }: X- F3 @
  27. #include <linux/errno.h>5 y: l1 Y1 u6 q0 S6 V7 y
  28. #include <linux/types.h>. X* j# U, X0 D. D$ E2 T
  29. #include <linux/interrupt.h>7 M6 e' p9 h7 S
  30. #include <asm/io.h>0 w% f: t9 x5 h
  31. #include <linux/moduleparam.h>
    . g  j/ Z' K/ W2 ^1 m' ?6 @: m4 Q, g
  32. #include <linux/sysctl.h>
    0 H" [$ E4 x, G! e$ n1 G/ n& q
  33. #include <linux/mm.h>
    2 B3 K7 w1 x7 N) j% A
  34. #include <linux/dma-mapping.h>
    1 f  h* q3 a6 M3 \. t9 L, C# @

  35. & f1 ^5 T% U1 E7 L( b) V
  36. #include <mach/memory.h>
    0 s2 Q  o& {7 `* n5 P
  37. #include <mach/hardware.h>
    ) h% w+ ~3 d/ ^8 c
  38. #include <mach/irqs.h>
    9 u' ^: U2 m0 H
  39. #include <asm/hardware/edma.h>
    4 H2 C6 p! z2 b* H* _

  40. # [4 ?  ^4 [# w' ~
  41. #undef EDMA3_DEBUG
    + b& H/ d0 g1 F5 U$ Z# I
  42. /*#define EDMA3_DEBUG*/
    % H9 z" K/ ~/ D2 |7 M$ O5 w

  43. 5 S* o- o9 c3 O4 C. p$ b
  44. #ifdef EDMA3_DEBUG. P1 x) ^$ w& m4 U; f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - {1 ~8 T3 e) ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / X3 X% j! l  B% r. k4 W: h$ h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) O5 I1 P- o' T
  48. #else
    " e, r$ |( d* G  E
  49. #define DMA_PRINTK( x... )* ?8 O2 Z* Q  D6 ?% N) m7 v
  50. #define DMA_FN_IN; x: m# M# o$ n" m, O/ P8 j* r9 s
  51. #define DMA_FN_OUT
    # Z, x7 q9 g1 O& a, p3 H
  52. #endif7 m/ {, S: ?2 E2 y* k
  53. ' Q) @5 p# y, w; O6 p1 O( Y6 l% w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # _- n2 o% K+ s6 b4 I# c
  55. #define STATIC_SHIFT                3
    * g2 @, x* z8 B0 v, X  x$ e+ g
  56. #define TCINTEN_SHIFT               20/ s% l: ~0 X1 b4 b
  57. #define ITCINTEN_SHIFT              214 y& a( t3 M2 ~3 {( S. I* e
  58. #define TCCHEN_SHIFT                22
    7 q' t8 N% a4 F6 ^( C/ Q' X2 T
  59. #define ITCCHEN_SHIFT               238 X6 A3 {7 ~( k) B

  60. - H8 X3 E, f' ?- n* i2 ]& }
  61. static volatile int irqraised1 = 0;
    ' k5 L" q$ m  O" @
  62. static volatile int irqraised2 = 0;3 k' [  M& t2 _& ~7 ?+ G
  63. $ P! X' `7 z. m! Y& ?  W+ L. F, D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 \( B  k( @7 a" y* R& G3 L) U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 R# O# |1 b1 }& y$ F0 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / j+ h" X6 ~: a& A& I

  67. $ W) F; T) E) Q" u8 S% J8 S
  68. dma_addr_t dmaphyssrc1 = 0;" x- j! K: d* M
  69. dma_addr_t dmaphyssrc2 = 0;
    , g0 [. ?2 ]& P5 U  b/ Y- i& M
  70. dma_addr_t dmaphysdest1 = 0;
    # ~4 x9 Y( B% V
  71. dma_addr_t dmaphysdest2 = 0;8 H. z$ U- I! a

  72. . j  D" S2 H9 L; n' D5 h
  73. char *dmabufsrc1 = NULL;, b4 N9 k" t/ O2 r* [1 t
  74. char *dmabufsrc2 = NULL;! U2 B, l9 X( f0 _! u* s  J
  75. char *dmabufdest1 = NULL;
    9 `' {. h+ l$ P; v& L3 R% L: t
  76. char *dmabufdest2 = NULL;
    # R% y2 `8 f2 w+ h! e! J  [  y* K

  77. * Z. `* H# M2 M9 e1 Y% e
  78. static int acnt = 512;
    ' Y- V' L( R' N" B* m
  79. static int bcnt = 8;
    2 G( d! _! D* I- _3 y
  80. static int ccnt = 8;. O+ k5 _5 G: E. x
  81. : h, W5 C1 [' l# F' k4 O, B) g- w* P3 s
  82. module_param(acnt, int, S_IRUGO);
    , s5 F* T+ S% {( |# L
  83. module_param(bcnt, int, S_IRUGO);; w! b7 t5 [/ e8 o1 y0 G! N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) P7 j* `, d* t: A! r% |/ ~. `; `
* {* ^- [  [2 }7 D6 W. H2 g9 b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ ^6 F- b( p; G4 P: oarm-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 S' ?; s& B1 Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- i7 s. |8 M6 s3 S/ }

- J6 _4 y, A% V% F# g) E  ~+ B  ^% `" b2 Q" e$ g. c& Z4 P; _1 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 04:03 , Processed in 0.047281 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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