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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 g4 n# s. U8 v6 y) t% y
  1. [code]EDMA sample test application6 B5 \5 ^$ v: c( z- O) _
  2. /*
    ' l( s8 x6 E5 S  Z7 e6 V
  3. * edma_test.c) C: X/ V; f. ^2 G% B
  4. *5 g4 l1 z6 q1 A, H0 u5 ]; h( R' J
  5. * brief  EDMA3 Test Application8 f3 O# x2 E+ u; l7 x
  6. *
    3 Z5 M& f5 j8 w# W
  7. *   This file contains EDMA3 Test code.
    3 N  w& K' j0 K
  8. *
    * x( N8 K) d' S$ o" v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! f/ z! e3 y4 n# s, n+ J! a# E) f8 Q. S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! V! @& _7 M3 Z8 W) J1 v! ]7 F
  11. *         TO CHANGE.
    ; V" i8 h7 s$ f! c) h( |
  12. *' U7 i3 Z: S- [2 E3 }( l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: L2 I/ z; }. \6 F& i% E
  14. *
    + u9 i; Z4 I& s3 [2 \0 u
  15. * This program is free software; you can redistribute it and/or
    , O( U! O3 m  Z
  16. * modify it under the terms of the GNU General Public License as
    - C/ A' o* f. ]/ W$ Q
  17. * published by the Free Software Foundation version 2.
    8 l7 `  A6 T; ~( o: Q; i* M( A
  18. *& b0 u, ~& ^/ S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 d! x3 O/ m4 Z1 _
  20. * kind, whether express or implied; without even the implied warranty
    ! m7 R  K* l' i/ E$ P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # p* y4 s' v( u, L% t
  22. * GNU General Public License for more details.
    0 s0 N6 \% J+ J! r3 `
  23. */
    ; ~8 X( r- ^- L% ~! f) m
  24. * k# R9 O* r# b
  25. #include <linux/module.h>
    # l2 w. B0 l4 F/ w2 C) I
  26. #include <linux/init.h>
    ; J3 W/ X* ?0 R) i8 b* D2 ^& t, F
  27. #include <linux/errno.h>" W8 i3 L  @# X4 n( t6 ]& r
  28. #include <linux/types.h>
    ( I3 C* a( H5 l6 U* p8 |$ G
  29. #include <linux/interrupt.h>
    2 y* C% Z, a' h- a
  30. #include <asm/io.h>
    . b! k. K6 W; f4 @
  31. #include <linux/moduleparam.h>9 m/ X6 J0 W1 Z" k# f/ [( o$ J3 G
  32. #include <linux/sysctl.h>
    ' e# a& ^* F! Y& G! K: c4 Z7 f
  33. #include <linux/mm.h>
      Q+ M# p9 g$ ?. u: V) c1 k9 f: Z* B
  34. #include <linux/dma-mapping.h>9 b6 B" i6 P$ \" ]# d  Q! B( S6 J
  35. 5 L6 Q) |2 G5 L9 Y2 O+ T) y6 w$ ^
  36. #include <mach/memory.h>
    5 @3 @0 v6 ~/ s: P8 \5 j6 t
  37. #include <mach/hardware.h>. e$ L5 z# O0 ?- X2 n/ V! R
  38. #include <mach/irqs.h>
    ; c, R. b, n) n/ l& n
  39. #include <asm/hardware/edma.h>
    ) y$ d$ j, N5 k9 Z; v
  40. 0 _1 j8 Z9 `7 z- P
  41. #undef EDMA3_DEBUG( e) a( ^& d3 Z5 \! j$ ^5 `3 l
  42. /*#define EDMA3_DEBUG*/
    : k: m" o  G6 C7 {
  43. 4 |+ L1 b% ?- @8 H+ C, g$ S% B
  44. #ifdef EDMA3_DEBUG$ s% `2 d) c0 z( r5 }/ M6 M( r/ ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); R4 [3 k; c+ |1 E; r. [( H6 V7 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # {$ O* p# {1 h( ], V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 [. i1 n. m, H
  48. #else4 ~% ]/ x5 E2 Q* g9 s
  49. #define DMA_PRINTK( x... )
    ! x8 _' k! N* @- l, p. t
  50. #define DMA_FN_IN
    ' U) F( _0 P4 h8 U# |+ v0 ]
  51. #define DMA_FN_OUT
    * q4 I4 ?8 \% c$ k1 ]: n, w# O
  52. #endif  r. G8 ]9 d7 V8 z, m2 _5 F

  53. + ~0 n# l2 C# \' T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 H! _4 {+ {( f) L1 {2 N2 o- j
  55. #define STATIC_SHIFT                30 s0 u# {) G7 K% u7 H% E: v
  56. #define TCINTEN_SHIFT               20
    : W# Z, E' l9 P- R# x- _
  57. #define ITCINTEN_SHIFT              21
    ( x. c, Z  B3 S
  58. #define TCCHEN_SHIFT                22
    ) [+ K( l2 h/ [; W9 M
  59. #define ITCCHEN_SHIFT               23
    / c8 G. r* Q! j' l* X+ l5 Z

  60. # J) m/ ]4 _- p% u& ]3 C7 G4 ~, V
  61. static volatile int irqraised1 = 0;& }) R0 c5 V6 y9 k; X" t
  62. static volatile int irqraised2 = 0;
    8 i: {+ u0 g0 U) Q' j! h* i
  63. " U. I$ X; W) k* o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 j7 K) O: r) F( D4 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # z4 m2 \/ R* S( ]; ]7 s6 e% Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 \# D' C7 M1 w1 B
  67. 8 {5 r  C6 T; b" C# m4 b
  68. dma_addr_t dmaphyssrc1 = 0;5 {" |( K2 p) }( s6 o
  69. dma_addr_t dmaphyssrc2 = 0;1 _3 l( Y: Q4 t/ p; U/ M( z6 ?
  70. dma_addr_t dmaphysdest1 = 0;. Q2 L1 `1 Q& s) j
  71. dma_addr_t dmaphysdest2 = 0;
    - n9 U$ _* l* S$ k' S4 E
  72. 4 O8 \6 R- h& K2 ]% c' t5 T4 {5 w! t  N
  73. char *dmabufsrc1 = NULL;
    0 W, g* l# b  ]
  74. char *dmabufsrc2 = NULL;
    0 U  }3 D8 g* t8 Q8 e% m% u: D
  75. char *dmabufdest1 = NULL;
    $ H; V0 u9 v+ Q: x7 Q6 s
  76. char *dmabufdest2 = NULL;
    ! J* g+ n+ p3 U# o1 ?4 |6 S
  77. 5 ^  y+ T/ p7 S% r0 |6 K$ _
  78. static int acnt = 512;
    % r2 [3 y" }: \' R; e
  79. static int bcnt = 8;. N3 J, I! p& i$ L& W* R0 n( y/ v
  80. static int ccnt = 8;& E9 q4 T  O$ @8 O2 B
  81. " J: H- z! z0 z) V' l4 ~
  82. module_param(acnt, int, S_IRUGO);
      E+ l! K* D! p6 g$ y$ H  }
  83. module_param(bcnt, int, S_IRUGO);
    7 m7 r3 H( W# {6 s, G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. k9 W  r# b/ e# p- U% F
2 Q4 \0 h- v9 ^2 C* V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& T! j9 @% L. n+ x' n. B
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 T/ ]8 ?! D: w+ F# n! ~, ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 |4 \) |! w' Z  m' g4 m4 W& w2 A7 y. y0 b

& j4 r- K: U' r# W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 01:02 , Processed in 0.039462 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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