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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# R& J6 a/ u$ O- D" w
  1. [code]EDMA sample test application
    ( f4 `  M. C+ Y% L& c6 x$ b* q
  2. /*
    4 f$ Z$ x- L* J
  3. * edma_test.c  U# {! u/ T$ ?
  4. *6 N& p4 @" p/ `& b* d
  5. * brief  EDMA3 Test Application
    4 V3 V8 x0 i3 X6 q
  6. *" x" _* P* q7 {& k2 V1 p
  7. *   This file contains EDMA3 Test code.
    * F2 `3 L" b+ F5 O
  8. *
    / Q$ V" T; m1 v5 D& k5 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  l. Y( H0 @) O0 N( r7 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' A! O0 V2 n  ]/ E9 R5 U% A
  11. *         TO CHANGE.
    , k0 _( ~% Q  N! k' H# W
  12. *7 B# @% c1 s- K" b1 t9 |* W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 _/ ]3 ?# t6 l! e5 q) |/ P7 q
  14. *! _. a9 M% y  I1 n, o6 V
  15. * This program is free software; you can redistribute it and/or
    ' q( P) I: I  m
  16. * modify it under the terms of the GNU General Public License as2 R4 |0 y1 r2 |
  17. * published by the Free Software Foundation version 2.0 x& H. k( k) t
  18. *
    2 V4 k: K! F- ^) y9 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' r& Y9 V! r2 C. L$ z' A& t- @
  20. * kind, whether express or implied; without even the implied warranty" Y$ I2 s: `* H  f# u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- y" W0 m, W8 F# W% J' p
  22. * GNU General Public License for more details.
    4 O' q/ {" a6 n# c" Z( k
  23. */
    " l$ l% A. Y7 C0 l  W8 P, m4 t2 I+ H
  24. + E# ?! a, B, ~5 X
  25. #include <linux/module.h>
    ; b0 y, k# m/ q9 z" p9 v
  26. #include <linux/init.h>
    4 k4 m2 p- \* J. e: y) M8 g
  27. #include <linux/errno.h>+ }7 y# |# {% ?
  28. #include <linux/types.h>
    0 C2 Y9 `$ M- H0 D
  29. #include <linux/interrupt.h>6 H5 c* X7 u* p2 P
  30. #include <asm/io.h>) F5 T6 b3 t- q( S% S  x/ [+ R2 h
  31. #include <linux/moduleparam.h>
    * o' x/ u7 z. O$ ?; o
  32. #include <linux/sysctl.h>
    8 p% |8 l2 F, b) |
  33. #include <linux/mm.h>
    1 S! f) t$ d% ]. R, G/ R& u
  34. #include <linux/dma-mapping.h>
    8 V5 ?& l0 u, v0 }
  35.   T4 `% n( v% I) v
  36. #include <mach/memory.h>" j& j( M+ R$ R8 Q. c+ C
  37. #include <mach/hardware.h>0 ]) d7 I$ K. k0 Z2 H
  38. #include <mach/irqs.h>  M0 H3 w9 Y3 `* \; T
  39. #include <asm/hardware/edma.h>
    6 {8 ]: N: d2 n( M
  40. ! A% T5 Z1 L( x9 E, o8 ?  u
  41. #undef EDMA3_DEBUG4 w0 x$ P5 v4 x! l* y7 S
  42. /*#define EDMA3_DEBUG*/: s0 w; A2 W- T% w1 c3 E

  43. ( i! c9 F$ |1 Z) a# ?' ^
  44. #ifdef EDMA3_DEBUG  ^/ C" G) d4 ?) M* ]$ ?* U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / h' {5 r/ W) f7 w- c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * E0 Z/ ?/ b! k! r9 M/ q% ^1 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- y& C1 h3 _6 N% o' D
  48. #else2 Q9 M5 }+ _- ?
  49. #define DMA_PRINTK( x... )- }, V) I# j7 l! I; B
  50. #define DMA_FN_IN
    0 R1 _3 V) r  M- n; T0 m4 g
  51. #define DMA_FN_OUT
    , d+ j1 e& {8 C( g" ~9 f) ~
  52. #endif3 J4 t1 Q( b0 Q
  53. & ^% s1 ^+ s3 {' x8 W0 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- M% w' l* v' ?! I1 l
  55. #define STATIC_SHIFT                3
    6 _- N2 C+ K& ~
  56. #define TCINTEN_SHIFT               208 P7 F; w: x, _, |+ F! A5 Q
  57. #define ITCINTEN_SHIFT              21
    1 f! P0 j2 G' B) h( g6 D* `1 W/ b
  58. #define TCCHEN_SHIFT                22) y( ?: O1 @9 g0 Y6 ]
  59. #define ITCCHEN_SHIFT               23# \, B" {3 ?  w3 {

  60. , K$ [9 \8 j3 @9 v1 Y( I' m5 r; i
  61. static volatile int irqraised1 = 0;" k% g1 q) _4 E4 k, U6 {
  62. static volatile int irqraised2 = 0;6 k# a& ?' L5 M- L

  63. 8 o2 |# W3 p5 i' {2 v2 {! @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ u1 ^" I; f: G: i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ~- C1 d* R7 u7 F$ Q, p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 i; f& l5 ?! N" K& p
  67. ! V. ^7 u3 A& g5 H# s
  68. dma_addr_t dmaphyssrc1 = 0;8 ?, ?( K+ K" S) G8 w: m" {  G
  69. dma_addr_t dmaphyssrc2 = 0;
    & k( ^3 o/ s9 N$ V7 ^
  70. dma_addr_t dmaphysdest1 = 0;& A  a1 d- u5 N# d: l5 N
  71. dma_addr_t dmaphysdest2 = 0;
    $ V% x) e, ?, S/ D4 ~
  72. - a; d/ A8 c- O9 E! S
  73. char *dmabufsrc1 = NULL;) Q& t+ q2 j9 W$ E3 [
  74. char *dmabufsrc2 = NULL;! s! c+ U: _0 O0 F9 M1 ~
  75. char *dmabufdest1 = NULL;
    : o  l$ f+ f+ h/ O, s& i
  76. char *dmabufdest2 = NULL;" i' B' l/ G. B. b* T2 z
  77. ; D  V6 O) K' M% {4 W8 ]% j8 o
  78. static int acnt = 512;& `2 a3 a* N) k
  79. static int bcnt = 8;
    2 f1 L# f; o7 N% y9 e. c! K3 i4 ?
  80. static int ccnt = 8;) E( [+ s" G, Y3 C( v
  81. ( t; [2 ^' k. U- E& B* {  l
  82. module_param(acnt, int, S_IRUGO);
    % D. p) y" ^. Z5 K5 K, q
  83. module_param(bcnt, int, S_IRUGO);
    9 k0 W7 [, C  @8 j' y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ d4 Z3 t+ k4 V! V7 u" }5 Q
$ G8 P! T7 P  J7 B( z0 U5 P! u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  G0 I# _- K/ J- E
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 D: j- ~" I% f! e+ n+ r* v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! ^' s5 e" u' F$ B( z" F

8 R; V# N% ^' u2 F8 m  ?2 f# U+ \, P5 j" \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-5-10 16:19 , Processed in 0.037141 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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