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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   J& o% ~( x6 {$ c4 [
  1. [code]EDMA sample test application1 |+ [! J7 ?, J& Z! Z# J
  2. /*+ T) g5 v; J) R  f4 Q9 v7 Q& D1 i/ w4 E" |
  3. * edma_test.c
    $ O. t8 `  J* w* F, y0 b, j
  4. *3 P( Z( v& \! h& W
  5. * brief  EDMA3 Test Application
      J4 D  H  k* Q! C
  6. */ C- e/ z. s9 o" H
  7. *   This file contains EDMA3 Test code.! `* y$ n# V8 |. L# z
  8. *2 |! f# C' I! {! N/ b5 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 C+ ~3 p( k& q% s7 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 u1 {$ B" C/ ]$ @3 U
  11. *         TO CHANGE.
    * w( y+ j! x+ O0 d
  12. *
    ' \$ g1 d" y: T, i3 f) ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" c) p" E& N  Q. _; S' ]/ \! D
  14. *
    * O0 Y# V1 A( l
  15. * This program is free software; you can redistribute it and/or5 n0 W& U2 p; \9 G: A4 p5 L
  16. * modify it under the terms of the GNU General Public License as
    $ B# Z  B9 q5 ^6 N* Q
  17. * published by the Free Software Foundation version 2.1 K* M: h7 H  h. @
  18. *2 ]2 b/ g+ M. S+ l- s" G8 \: p2 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% Z/ j: _* {: q& ?6 I2 p3 o
  20. * kind, whether express or implied; without even the implied warranty
    7 b. K6 U# u- r5 L# X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 h1 w' q$ _7 S
  22. * GNU General Public License for more details.7 A# n) r7 m0 D( Q5 N6 K3 _9 S
  23. */* c% G, [) O1 [+ I3 t
  24. 9 Y. B3 E. G( C
  25. #include <linux/module.h>
    2 W$ \2 O  |! K- `
  26. #include <linux/init.h>
    ; z$ [8 |  ~5 N8 d+ h7 I
  27. #include <linux/errno.h>  }0 x" s* S: Q. L6 [6 a
  28. #include <linux/types.h>
    6 H7 s, V, J$ y# D; `& s
  29. #include <linux/interrupt.h>* @8 t( I& k- W; Z
  30. #include <asm/io.h>
    8 w" s2 Z4 M( ~
  31. #include <linux/moduleparam.h>* _6 U4 z. i$ N
  32. #include <linux/sysctl.h>
    ; q9 \" Z7 Q8 b) h" \  E
  33. #include <linux/mm.h>
    ( m" u/ Y0 |: n8 G4 B
  34. #include <linux/dma-mapping.h>
    , d, k- X3 T5 l" ?# I

  35. * u- B. Q3 W: [
  36. #include <mach/memory.h>
    % v; A) U) w. A/ c6 C7 D
  37. #include <mach/hardware.h>* O6 L, B2 W# c3 b( D3 o
  38. #include <mach/irqs.h>: K$ O, a) \  S  x4 P* v
  39. #include <asm/hardware/edma.h>: ]) X9 I  n" ~! X" D
  40. 6 K' l6 N& I: Y, n5 \/ h
  41. #undef EDMA3_DEBUG
    * c0 s5 A- D: S7 L/ b8 U6 j2 A! n2 N
  42. /*#define EDMA3_DEBUG*/* W( E; c( i% c& B# o4 O$ n" J( f1 A
  43. 0 I6 ]" N- Y3 Y& G( W4 ^% ]
  44. #ifdef EDMA3_DEBUG, P$ V" H5 q0 G5 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% q! r  K, c; X/ I; L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 J" C* f$ v( F) n- f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & r( x, f5 A  I6 C6 @
  48. #else
    6 ?. A  H5 R+ e
  49. #define DMA_PRINTK( x... )
    # u5 e0 @& \3 a, \
  50. #define DMA_FN_IN
    3 K3 b3 W: ?7 s. Q; k$ E6 R8 r6 F  M
  51. #define DMA_FN_OUT) z2 X$ M6 p( t4 f
  52. #endif
    6 T4 Y0 I) G2 b2 D
  53. ; V: D; `& }9 B* o$ Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ R& R& g5 {" I7 w2 ^
  55. #define STATIC_SHIFT                3
    ; J8 G1 |3 e5 Q7 }
  56. #define TCINTEN_SHIFT               20
    3 C5 w$ P1 J* T) w$ e5 b6 M8 d2 {
  57. #define ITCINTEN_SHIFT              21* G" k' b/ a# z& G
  58. #define TCCHEN_SHIFT                223 ]' O: ]  n, X, J- E3 t0 I
  59. #define ITCCHEN_SHIFT               234 g! P' P/ E6 M+ p* ]+ C6 D5 h% ?

  60. + q1 D& W# |+ Q# v7 x9 h
  61. static volatile int irqraised1 = 0;, v6 T* w1 n$ @- h! H
  62. static volatile int irqraised2 = 0;
    0 a! J$ |( `$ O0 {3 \

  63. * B& p& b! R0 |7 W: |' ?' `9 T4 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      T+ m  L5 I1 N+ i$ Y4 N7 g/ E# \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 @7 V& ^7 y+ U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 g9 m; G4 p5 L& f- ~

  67. ; T/ O- ^, I# H- M) h& c* b
  68. dma_addr_t dmaphyssrc1 = 0;% d; ]) A, Y# F; E  M4 V
  69. dma_addr_t dmaphyssrc2 = 0;- Q  K* |' o, L- r
  70. dma_addr_t dmaphysdest1 = 0;
    : i4 J9 g' Z! U' l$ ~7 B3 W
  71. dma_addr_t dmaphysdest2 = 0;
    1 m, N8 I! y1 U0 c! D
  72. 3 ?% V1 |5 |( g  T+ ]7 q
  73. char *dmabufsrc1 = NULL;1 D& \  N: w3 `1 h
  74. char *dmabufsrc2 = NULL;1 f: E: |, p4 L0 M- e
  75. char *dmabufdest1 = NULL;6 B8 t' W' f* ]/ {, F7 I
  76. char *dmabufdest2 = NULL;& D( ?. R1 X& a$ G1 z5 X
  77. " }) C. t) y) v# s  E$ L
  78. static int acnt = 512;1 @* m, _% ~$ k
  79. static int bcnt = 8;
    4 d# k6 U! s* W9 i
  80. static int ccnt = 8;
    ) c9 r4 U9 q6 V5 L; ]0 q0 f

  81. 0 @6 j) c  f7 Y! H& g1 i
  82. module_param(acnt, int, S_IRUGO);
    ' [4 J+ l7 C' E1 z, p8 K7 k$ `
  83. module_param(bcnt, int, S_IRUGO);8 r( _6 D$ d( q% J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) L% a5 R& n7 O8 P* e5 I# c) [" g7 K+ V: r8 t( Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 q7 Y2 y6 I& ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" }3 N! I, [/ s; m. K# |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ L, C( z, B0 B# x* @5 ^$ ^  S

) a" L2 `& z/ |1 ^
' c" f% t5 ?6 a" a( t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 21:54 , Processed in 0.047444 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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