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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 v7 \; v+ {9 W* ?0 X
  1. [code]EDMA sample test application
    ' F0 ]) o5 J! @5 S) a' p; O1 Y% X
  2. /*
    : R% x6 _- a8 b$ {$ K
  3. * edma_test.c/ ]& M* m! q- Q  Q
  4. ** _: j2 G9 ^. M: l& s
  5. * brief  EDMA3 Test Application$ T* f. ]: A9 I# y7 M) F0 `5 @
  6. *
    , R  B9 {( W9 N" x1 O
  7. *   This file contains EDMA3 Test code.( r5 N5 x. U* v, A  w3 b
  8. *
    8 [* V5 o# h# B& @  k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ E: Q( g  G; N% J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - d: N& u3 O  ^  o# s% R
  11. *         TO CHANGE.. F+ h: t* I6 ^# i6 @: H! \( n
  12. *
    . q# u$ z. f/ h% J( g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! T! ]: W# [) D$ a4 M+ q. i! t$ N$ d1 X$ M
  14. *
    + ^2 l4 Y9 S2 h! X2 D
  15. * This program is free software; you can redistribute it and/or( g) ]2 `- g( C6 {& E% a
  16. * modify it under the terms of the GNU General Public License as% D# r1 L, Z( A, W- Q$ {
  17. * published by the Free Software Foundation version 2.
    8 x+ r) G/ K4 W+ a8 Z4 Y( H
  18. *3 ]  V+ v$ d, I! ]! v# l. [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 s3 l! \; a- f6 l$ _
  20. * kind, whether express or implied; without even the implied warranty
    ; X3 ]* J1 X) T$ x1 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 j- {! J* P' i2 B5 C
  22. * GNU General Public License for more details.
    : h+ P3 D" @5 g& \& K4 M0 |' d
  23. */, D5 H! O& G3 E- m# c8 Q

  24. 5 _0 r6 p: }2 W. h& z9 |
  25. #include <linux/module.h>: E( _; w' j4 R4 i( P4 F8 @
  26. #include <linux/init.h>
    + o9 G  l7 L# S. K0 C
  27. #include <linux/errno.h>
    , ^1 Q% J% Z- Z4 M% X( Y$ {4 z; T- a8 x
  28. #include <linux/types.h>
    8 N* E# S( a: [8 d1 ^2 r! N
  29. #include <linux/interrupt.h>1 o$ h& S' H2 q6 D
  30. #include <asm/io.h>' O3 O0 ~) K& ]% ]
  31. #include <linux/moduleparam.h>& d- d! g& b9 v$ l, u5 W0 D, L
  32. #include <linux/sysctl.h>
    3 h+ q  M* U9 e# F. _% \
  33. #include <linux/mm.h>
    , K$ m9 f: x. I0 ]8 r; \. d
  34. #include <linux/dma-mapping.h>1 N6 p- y2 _' i+ ~7 d
  35. - b& B8 A2 D9 M
  36. #include <mach/memory.h>
    - o/ ~/ W+ k9 q
  37. #include <mach/hardware.h>
    ( m7 H2 |0 B: s1 G4 ^$ K
  38. #include <mach/irqs.h>
    4 l' G) q9 }6 a" ]0 C
  39. #include <asm/hardware/edma.h>" y6 {, P6 D; I& ^

  40. 4 s1 }9 Y. {0 W$ A* a
  41. #undef EDMA3_DEBUG
    $ k3 Q0 G2 _: s1 \. ]  s2 O$ U
  42. /*#define EDMA3_DEBUG*/
    ; ^) y$ C" S7 \. s' ^" L/ L) ?" A& ?

  43. : Q% b: G$ [* d5 w2 f
  44. #ifdef EDMA3_DEBUG
    4 t) K! _' s7 N/ C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 n/ \7 _" h/ n5 a  a7 j$ ^( j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / t4 k1 A6 Z7 O: z8 }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 |9 B/ O% r+ ~$ D" q, F
  48. #else2 r( N& P3 v) _' _
  49. #define DMA_PRINTK( x... )* L8 c( s8 x  n3 D" s% W0 b) {
  50. #define DMA_FN_IN0 f3 f" X, p; v0 t3 f
  51. #define DMA_FN_OUT( o, g9 M8 j5 r. [2 [2 g
  52. #endif
    & ]; L, j: ]( U3 f3 a6 g0 M9 o
  53. & q) ^: P! B) o* Y% B& s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # Z* H" P. `/ F' o8 v$ M
  55. #define STATIC_SHIFT                3
    . e  r3 w7 J: ^  V# H# y3 q
  56. #define TCINTEN_SHIFT               200 q5 G1 k5 {0 B9 e
  57. #define ITCINTEN_SHIFT              21* U" Z$ v: w  K  w9 M
  58. #define TCCHEN_SHIFT                22
    + q( k9 d' Y* w, Q5 d2 a
  59. #define ITCCHEN_SHIFT               23
    * m! n- t. H1 }6 r5 c

  60. ( v2 B4 @/ ^/ J; ]4 j: B5 j
  61. static volatile int irqraised1 = 0;
    ! A5 g; a. J. D
  62. static volatile int irqraised2 = 0;
    7 q. I5 ~) a; u3 t8 d4 C8 u, Q$ N
  63. % ?; b5 |6 H: K' z! t8 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - v  _8 M6 y8 L; H6 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 ?( e7 ?! A& j+ }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * D' h( `! k: u, o! _9 h8 Z: j! K

  67. ! \) M9 J& u. O. @6 k+ s
  68. dma_addr_t dmaphyssrc1 = 0;
    ; n" d/ L% X: h' P) @2 v
  69. dma_addr_t dmaphyssrc2 = 0;
    1 Q! T3 M5 B0 }, E+ y( `6 q+ W( O4 ^+ s
  70. dma_addr_t dmaphysdest1 = 0;" T! ?7 s! X( ~# h$ G
  71. dma_addr_t dmaphysdest2 = 0;
    - O$ p9 V: i; }/ ^9 `
  72. # L( z2 Q  f! M( s/ `7 X9 j
  73. char *dmabufsrc1 = NULL;
    8 v; g  z/ e8 L$ K! J# _
  74. char *dmabufsrc2 = NULL;
    ' m/ C0 I$ y$ k" [; d
  75. char *dmabufdest1 = NULL;. ^: x; x% p( q, g
  76. char *dmabufdest2 = NULL;+ Q9 z3 Y# ~! Q" V
  77. / G( n, I. B" h2 l# P9 ~* |
  78. static int acnt = 512;0 @& g0 o7 _  @( Z' `
  79. static int bcnt = 8;
    7 ^  |) `7 @& Q0 ~1 X" x
  80. static int ccnt = 8;% x6 `, u* |& k, y" i1 H) \: T

  81. & G; u- N9 ?+ \" o' |5 `1 |
  82. module_param(acnt, int, S_IRUGO);
    9 Y$ E8 y1 X" F& O+ L& z& i
  83. module_param(bcnt, int, S_IRUGO);
    % @  g( B1 X2 ^$ O2 l  I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 b, C, ?. s: K+ R  t( Z

1 F: K( Q, u' l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 |# X7 r. z$ i/ G0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ v2 R- a/ S1 O: C* \7 ]  w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' B' S9 N, v: M* j9 N6 w7 m) P0 |7 W4 d9 W

! E* A6 Q/ j! r% c: _7 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-14 12:05 , Processed in 0.046659 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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