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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 Z' a- J8 y. X9 V: h, h+ y% e
  1. [code]EDMA sample test application  |- A% D% P' J) p
  2. /*
    + K0 P  A7 H4 j1 b. v: u
  3. * edma_test.c
    , n$ E- H/ G3 [+ ?
  4. *
    ; ]: C+ M1 A  z+ S; ]( d
  5. * brief  EDMA3 Test Application7 s  ^! q# \" j9 w3 Y# l% r4 s
  6. *
    + H! {7 K: ^0 W& N+ q, m
  7. *   This file contains EDMA3 Test code.+ h8 W1 [) P: C* b- u$ p" n% R% J
  8. *
    ' U1 ]  ^" ~3 l+ W5 j% S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! f4 u% ~. L- R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! ]$ ^: T, h0 ^
  11. *         TO CHANGE.: a6 y# g1 g7 `4 S, _  E2 ]
  12. *
    ! r  M+ Y; O, p7 }( R: V9 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( n8 Y% y# Z0 y" C: A, w+ e
  14. *+ K; I# y, ^  e1 @% m
  15. * This program is free software; you can redistribute it and/or
    + I5 }! E; i* u" t9 v9 c
  16. * modify it under the terms of the GNU General Public License as
    * W" p- T9 m$ i/ D5 V
  17. * published by the Free Software Foundation version 2.
    # k+ u/ g1 y$ i2 Q+ `. d& M
  18. *
    + m; ]- @5 X% Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 F+ Y; R; O+ _) l. E/ @9 ]
  20. * kind, whether express or implied; without even the implied warranty* i$ p% H3 W2 Q6 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* o( \4 F4 L/ }1 _
  22. * GNU General Public License for more details.3 i' C& P& @( a+ w
  23. */
    ! O! ]* v6 r+ Z, L3 C8 A  a

  24. ( U9 q& ]* A. h, p5 E
  25. #include <linux/module.h>/ i1 o4 f5 z- u6 ]8 E' N+ h
  26. #include <linux/init.h>
    0 e, x! k4 G  y1 ~& M5 \& {
  27. #include <linux/errno.h>: G1 q8 v1 b8 y1 k1 B! A
  28. #include <linux/types.h>
    3 T& ~& |; h7 ^0 c, s
  29. #include <linux/interrupt.h>
    ; l8 D/ G( y% D6 g9 e" M
  30. #include <asm/io.h>
    4 H1 D. U5 T+ `: y& T
  31. #include <linux/moduleparam.h>
    . P% Y! m. @6 @' [
  32. #include <linux/sysctl.h>, b! v1 c5 ^" U8 T% C; w$ m/ V- `
  33. #include <linux/mm.h>
    ( p6 R1 `- u8 D) u& w+ h
  34. #include <linux/dma-mapping.h>$ ^- m' J2 ?; L
  35. . a3 R2 l2 X: u2 m2 J1 K/ Z. B4 h
  36. #include <mach/memory.h>
    ; q( ^4 m8 z- C* q: |5 m9 ~6 v% N
  37. #include <mach/hardware.h>; K8 \8 I' Y% l3 i' X0 X0 {; @. t
  38. #include <mach/irqs.h>% x) T5 v; \3 |1 a# R, t0 y
  39. #include <asm/hardware/edma.h>
    - B1 N+ P  T. g8 w

  40. + A) |$ X6 B0 }9 o4 K' E
  41. #undef EDMA3_DEBUG; i5 t- ?% ]% }$ ~& Y' v- j
  42. /*#define EDMA3_DEBUG*/
    9 B* k" M. J7 w+ q# r; t% d

  43. 7 {5 s* p! h7 B+ L
  44. #ifdef EDMA3_DEBUG0 V. W) o9 U; i" S2 U! R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 J0 D1 g, X! L5 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ X1 g1 S+ A, C3 ?8 h" ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 U/ p5 F# h; h5 ]- e
  48. #else/ s4 @6 M- P1 \! ?
  49. #define DMA_PRINTK( x... )
    9 L1 j& F6 h5 j
  50. #define DMA_FN_IN
      d/ t9 j6 }  t
  51. #define DMA_FN_OUT6 x2 @4 w( T% _7 `5 e5 a; U& z
  52. #endif
    3 ^9 k, D" o6 t4 [

  53. / Y' L, N8 d4 w. G! R' w4 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* {: q! J) u! ]0 k+ R* u
  55. #define STATIC_SHIFT                3
    % y+ r' J# g& L# a4 t* u/ H
  56. #define TCINTEN_SHIFT               20
    $ B( T8 ]1 d4 B  C. a- w
  57. #define ITCINTEN_SHIFT              215 E, J( `) C* Z
  58. #define TCCHEN_SHIFT                22# j+ i: [- w/ `7 Q; \6 T
  59. #define ITCCHEN_SHIFT               23. b- M9 K4 G* p% f4 l# C

  60. ) L; ^  I; `& Q" d
  61. static volatile int irqraised1 = 0;7 a4 E9 W1 n. O
  62. static volatile int irqraised2 = 0;* n; P- Y$ }* Q/ s
  63. & z! Z! Y7 P1 ~# e: g1 u! I6 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ]9 z1 }: k& g1 S* g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: x  ^8 U! F4 c% r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * Z; T" g$ g( |; c+ b& F, I4 D

  67. 3 x$ c3 k: m% o- y( I+ L
  68. dma_addr_t dmaphyssrc1 = 0;
    & n* J* B; A( _3 B
  69. dma_addr_t dmaphyssrc2 = 0;
    - U. f. G( K1 b9 a! h
  70. dma_addr_t dmaphysdest1 = 0;# M. V  q/ b" q+ z: W0 G
  71. dma_addr_t dmaphysdest2 = 0;
    ( S  P, j) l( K8 T  m) [# |

  72. 0 p5 U+ q9 Q* b; s$ [. j
  73. char *dmabufsrc1 = NULL;
      r. q* K$ ^! s7 E% H
  74. char *dmabufsrc2 = NULL;, U6 ~/ _# e/ U5 _
  75. char *dmabufdest1 = NULL;
    ; x5 l$ [: \4 [+ _3 ?5 C' g
  76. char *dmabufdest2 = NULL;; U' h& b( F' r" u

  77. 9 m: f* l9 _, \9 J3 j& J% D
  78. static int acnt = 512;& W0 b8 r: u# j. {7 F4 u+ b
  79. static int bcnt = 8;
    1 k- V& J5 h& K
  80. static int ccnt = 8;
    ' f* I( x& r/ M8 u

  81. ' O7 R7 V' S: K# J* N8 I
  82. module_param(acnt, int, S_IRUGO);) b! d/ M: j1 \* ~# }& y: F+ |. K
  83. module_param(bcnt, int, S_IRUGO);
    + u; s4 y4 b0 T! A5 U- O# h" q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 O) Q2 Q* I7 N1 ~+ M% T0 p( D( I* U) z! y7 z, O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  t6 n2 o4 ^2 R) zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 Y" E" D$ ?/ L$ t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, U/ R  C0 f8 X  {1 `# s; c- Z) w: k7 F% X( a' T
2 u) n1 ^# a( k# |( {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-16 06:11 , Processed in 0.037698 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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