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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 Z4 s2 W8 n3 Q0 W3 u! }1 {* l
  1. [code]EDMA sample test application1 G7 V" H# o/ C
  2. /*
    7 v( k% l. T7 B) z
  3. * edma_test.c( L( l8 Q% h) t" i  z
  4. *7 C/ V1 @& K; E. A! k# n
  5. * brief  EDMA3 Test Application4 A7 M( v+ b8 n) ]. d
  6. */ ]: g  T: X' d; R
  7. *   This file contains EDMA3 Test code.% s6 h9 R1 @) k9 H. i6 Q% L7 E( q
  8. */ h; p+ ?1 Q$ T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ |: C% w2 V5 U- h% x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # n1 G- |& a$ T5 D
  11. *         TO CHANGE.
    ) c" n4 ^6 B+ C6 X+ G
  12. *
    ) r3 K3 u) `* Z. E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, `, t1 R. S6 }
  14. *
    2 ^) l: b! c/ d$ v; X* b
  15. * This program is free software; you can redistribute it and/or, k" O& T8 ^; Q4 A
  16. * modify it under the terms of the GNU General Public License as$ d. R: _# B& P! y% {0 g" G! X
  17. * published by the Free Software Foundation version 2.
    # w8 e5 a0 [; Y2 a# J1 @: p
  18. *
    : p4 T( ]5 C) ^4 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* }0 L3 }; D) ^7 e
  20. * kind, whether express or implied; without even the implied warranty: {& b) r( p8 C/ G$ r% ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / \! r$ M* {- ~- F2 \1 @
  22. * GNU General Public License for more details.& t3 T5 n# O% |# j1 `  P
  23. */
    # y# y* v" P$ e  c/ v4 P, l
  24. / a4 R+ P' w( w0 w/ T! J' M+ Q
  25. #include <linux/module.h>8 @  j9 \  W6 Q  g
  26. #include <linux/init.h>, E0 j- b/ v2 M. J* c2 A
  27. #include <linux/errno.h>$ c: T. `3 \+ C( [1 p9 ]
  28. #include <linux/types.h>
    3 |5 v' {/ D( ?3 W! |
  29. #include <linux/interrupt.h>. X( `1 H  w0 A1 i7 @! w" e7 G) {
  30. #include <asm/io.h>: }. A1 w7 ?- P9 i0 Z- @
  31. #include <linux/moduleparam.h>
    9 B( _% o+ ^& U! _& `+ f  E1 I% W
  32. #include <linux/sysctl.h>- ^* j( F; ^% \- p$ m) i/ c' {+ I
  33. #include <linux/mm.h>
    . h9 h- ]6 y6 F
  34. #include <linux/dma-mapping.h>) @) E, Q$ T* w: N' R. H/ e! z. Z. C

  35. 7 a3 s1 d4 U7 S3 T. N6 {
  36. #include <mach/memory.h>
    4 d3 I% n% ^2 M
  37. #include <mach/hardware.h>9 C' N3 S3 N  I$ x
  38. #include <mach/irqs.h>! T" y& g9 P& j) d
  39. #include <asm/hardware/edma.h>
    " @; A& _" V+ Z8 N- Z

  40. 4 p. S: n  M/ X
  41. #undef EDMA3_DEBUG
    8 w2 \' y: q& n! s( E
  42. /*#define EDMA3_DEBUG*/
    # v) D" P+ x$ s$ K& Q" o9 Z
  43. , ~9 L" D; ]& O0 a: O2 p3 Q9 m
  44. #ifdef EDMA3_DEBUG! }% x" S: F1 _: p, p' X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 ]$ V. ^0 v- B* F: h- J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' Q2 h, J* q/ [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 U& q  ^1 k3 s  ?& q, w8 O- [
  48. #else- r' J4 |& f2 J+ F8 y& [+ G$ l; E* ~
  49. #define DMA_PRINTK( x... )% J0 W2 ~9 ?) x3 P& t
  50. #define DMA_FN_IN
    0 Y( i% Y$ E# e
  51. #define DMA_FN_OUT; Q# C  i. B. A, k7 H1 w
  52. #endif3 ]8 A) |2 E- Q7 C# A9 B

  53. - U5 E( j- z; a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): v- x& l2 r9 Y7 H5 f5 A; Y
  55. #define STATIC_SHIFT                3# a' f. M$ W4 L5 w) B
  56. #define TCINTEN_SHIFT               20
    + K& D* N! Q$ g% F0 }
  57. #define ITCINTEN_SHIFT              217 ~6 F- T# f5 @" n$ N7 ]
  58. #define TCCHEN_SHIFT                22' w9 D8 s; ?. \8 c  p$ w% s5 y
  59. #define ITCCHEN_SHIFT               23
    # i+ A0 T- Z  Y$ \$ o" g

  60. ; R! a+ Q0 y5 S6 c$ f3 g! Y. R$ {
  61. static volatile int irqraised1 = 0;& n6 \! J) k0 s6 V4 T
  62. static volatile int irqraised2 = 0;
    0 V. g( h9 f6 ?0 K
  63. $ _! M7 d" B% m6 p# Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 E, _' S. k+ m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + X+ j  g- }+ G9 E% r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) i$ O$ y8 Q' ^
  67. . V) q9 j! ^+ v+ U' R
  68. dma_addr_t dmaphyssrc1 = 0;( U' ~- I6 t2 S) ]- J: S% L
  69. dma_addr_t dmaphyssrc2 = 0;
    1 w5 V3 x$ O& y% r* m
  70. dma_addr_t dmaphysdest1 = 0;
    / A, l8 b  p" x- O3 b
  71. dma_addr_t dmaphysdest2 = 0;: x& V' w8 y. l# A9 |2 ^" [
  72. - a. v$ g$ }' A
  73. char *dmabufsrc1 = NULL;
    : z# x( I2 P5 }
  74. char *dmabufsrc2 = NULL;, Z& x3 c6 {) [2 ?' l
  75. char *dmabufdest1 = NULL;
    ( M: Y, Y3 ~" I; Y% U: Q* P2 c
  76. char *dmabufdest2 = NULL;" F5 j  G7 i1 L. n* p
  77. / P  l+ G+ v3 D& P! Z
  78. static int acnt = 512;, L0 B: h# B6 E( Q8 {
  79. static int bcnt = 8;  z! s2 E: C" X' t4 p- V0 l! E3 o
  80. static int ccnt = 8;
    0 s7 ?* s9 [. Z2 I( a

  81. # @4 s- J2 R; I) D
  82. module_param(acnt, int, S_IRUGO);9 D. d' T: A+ b9 S: u0 Q8 `
  83. module_param(bcnt, int, S_IRUGO);* P9 a& y- S. h2 x, V, |) {* u! V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 ?3 [" h0 `/ g- J$ [! G0 M7 V% L" Z+ z8 j& {# a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% k/ U5 i- b* {% y, C! Narm-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 ^1 W# M/ a7 x) v: o, @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ ]" S# @- A* ]' R# P% u  V5 e
- R# p! F9 R/ a2 O' ~  F7 |! v& N4 B  y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 00:50 , Processed in 0.039641 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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