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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  D0 C! A* Y" c$ E1 w- n" A. K$ v, j
  1. [code]EDMA sample test application
    & q" q0 v: d- r' s2 [& q8 \/ m
  2. /*
    9 \4 z$ ?. z7 ?0 T: `7 d" q
  3. * edma_test.c1 s' P; f5 ^1 ?$ D! u7 E
  4. *" q/ |* w. \; g" L; x! w
  5. * brief  EDMA3 Test Application
      \2 {, e4 B/ s0 k/ U
  6. *0 d8 ^  c7 F2 \" m; n
  7. *   This file contains EDMA3 Test code.
    9 X0 I5 X' h2 v+ F( Q: v! k* V! K
  8. *. c" }: d1 G' Z& Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * t/ e0 n; ^6 T8 c0 ~! m4 I2 W! ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 w. h& R1 ?+ L2 U0 |" Z
  11. *         TO CHANGE.9 H$ @  i( k) w1 M/ h
  12. *
    " E" w  S* V* z& E9 O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 A" i: ^5 u! v/ E4 z& O+ L
  14. *7 r( h! O2 y+ d; R8 ], [
  15. * This program is free software; you can redistribute it and/or
    1 F* d; E- ~. H2 z: Y
  16. * modify it under the terms of the GNU General Public License as8 M, _) N1 j  v, n  c
  17. * published by the Free Software Foundation version 2.
    ' H) {( F; T- ?4 s
  18. *- z: l1 ~5 t+ {2 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 S9 k) D' `" u) l# a+ Z- i8 ^" `6 @
  20. * kind, whether express or implied; without even the implied warranty
    7 B' s; K0 @  ~4 J; T" X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- K8 ^! n8 b. z
  22. * GNU General Public License for more details.
    # s5 D. g# a% l4 D4 I7 Z
  23. */5 N# Y" i- u# g

  24. % J2 L8 V) c( C2 i% G' f
  25. #include <linux/module.h>
    $ s( f8 s" v% o* f0 C  k
  26. #include <linux/init.h>
    8 D8 w  E7 V; H
  27. #include <linux/errno.h>
    0 ]/ d4 `  H! }/ N! _* a
  28. #include <linux/types.h>
    3 g3 F$ ?. h1 O1 [0 t
  29. #include <linux/interrupt.h>( |% D& ~1 P5 a) ^& ^. i
  30. #include <asm/io.h>
    3 A. W; L/ M3 ?9 ]2 M
  31. #include <linux/moduleparam.h>7 {; d3 ?& X7 O% m- i8 W# h( U
  32. #include <linux/sysctl.h>
    2 ]4 F: q. @% E: r1 K
  33. #include <linux/mm.h>
      S' f$ M; V1 [8 {  [$ l
  34. #include <linux/dma-mapping.h>
    - V- y: r% x) O' v1 S
  35. - V' r% u- j. o( l* `2 V& P
  36. #include <mach/memory.h>. j( [% M9 ?+ L8 o" J, b
  37. #include <mach/hardware.h>0 J& u7 a+ d" E
  38. #include <mach/irqs.h>( k- b( S0 g4 E; h; f/ L
  39. #include <asm/hardware/edma.h>
    * Y3 r& f2 r4 v
  40. 3 Q% F$ x; R: v( j1 G5 y" _
  41. #undef EDMA3_DEBUG7 T; D  e$ |! {' ^. r7 `$ U  R: g
  42. /*#define EDMA3_DEBUG*/
    7 R0 V" p# ]/ F2 ^" ]- H
  43. 8 O, I! @% W- j. K8 ?3 {+ j
  44. #ifdef EDMA3_DEBUG4 Z: Z2 i" N0 T/ M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , t  ]9 w3 {: L' m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- N; _3 `3 f& G/ V% Z- V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), p. l% N! T* G& c  t
  48. #else$ \  J8 _6 ?$ D& @; K6 L$ Q% G
  49. #define DMA_PRINTK( x... )
    6 H# m5 c, N, Z7 O
  50. #define DMA_FN_IN
    8 B0 A6 e+ w2 a. S! K6 Y$ X
  51. #define DMA_FN_OUT
    ( ^# P4 @- D& B, a* B) j7 q& k* ?! b# o
  52. #endif
    5 [  G6 U% ~0 o) m5 s; a

  53. : O) T+ a- w0 C0 V4 n; z" b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 L/ l9 m6 B* l
  55. #define STATIC_SHIFT                3
    : b5 E5 g8 q, d- M% f( i$ J
  56. #define TCINTEN_SHIFT               207 C6 L8 f+ D' B# ]3 b* S! j9 r
  57. #define ITCINTEN_SHIFT              21* K$ T1 _5 V* y8 O* D/ g7 C
  58. #define TCCHEN_SHIFT                221 H- h' a! m7 V9 K8 O  @- }  C9 n
  59. #define ITCCHEN_SHIFT               23, t  n, M, b" I9 r; ?  k

  60. : v( e* K# K8 `2 R* |. l' a
  61. static volatile int irqraised1 = 0;
    * B) a4 x/ Q2 ^; K! r9 g! T
  62. static volatile int irqraised2 = 0;& V5 n: ]( ?) R/ z" Z; |* O# c
  63. 2 F0 Y; }7 C: w) D+ [8 ?$ [3 B* Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " ~0 l* s: w7 i! U( C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: X$ S1 E+ B' y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ V9 u' M  P. P  r$ ~- c5 Y
  67. ) @. h3 z7 E& i" K
  68. dma_addr_t dmaphyssrc1 = 0;
    4 h$ m- r, N- H. n
  69. dma_addr_t dmaphyssrc2 = 0;: _. ]% A9 `8 y8 c( Y  O% ~
  70. dma_addr_t dmaphysdest1 = 0;
    $ D/ L* r, [9 ]) m* l, U4 u- `: o! j
  71. dma_addr_t dmaphysdest2 = 0;
    4 u6 V8 G* ?+ x* U
  72. 5 \8 A6 w8 z4 K/ }8 X" A& G
  73. char *dmabufsrc1 = NULL;( [; p/ S7 n% x2 o3 y# k
  74. char *dmabufsrc2 = NULL;' g, N1 O/ V/ h' K. G
  75. char *dmabufdest1 = NULL;
    ! c$ L# a( [* f( ?1 C0 C$ g: F3 [
  76. char *dmabufdest2 = NULL;) t; H! }6 X9 s! S" `
  77. : M5 }) r& Q0 ^
  78. static int acnt = 512;
    6 ]0 M; H$ V1 `* G- S0 o8 Y0 J& B
  79. static int bcnt = 8;4 ^+ [9 k9 N' U' n$ P0 R
  80. static int ccnt = 8;: E- T" |, f( Y: V; m
  81. / n1 _7 F- z8 K$ y9 t" J2 @
  82. module_param(acnt, int, S_IRUGO);
    % L; `0 ^) Z! V8 G% r" _4 ]' w
  83. module_param(bcnt, int, S_IRUGO);
    * f5 r0 a& ]  ~7 H+ T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 _. t. O+ j+ f8 c5 q, |( A/ m) |; ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' F( I" g9 _# y- M7 c2 n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 Z0 u1 V# T- ~  J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 `$ p, x- j3 ~/ V5 M. n
: ]9 \- E4 r4 e$ W9 F; A
: K- ]4 Y! ~& h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 17:26 , Processed in 0.040146 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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