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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 \$ l  R" O) N7 Z  J
  1. [code]EDMA sample test application* |7 U4 C: ?5 K4 t- r) }9 d" W. I
  2. /*
    - `/ h; t- C0 k! Z8 s
  3. * edma_test.c
    ( @, A: g' L& v( w7 Q
  4. *
    , {  V" c) j; x# \) \6 i
  5. * brief  EDMA3 Test Application8 Z1 ]2 u& P; `# R2 \7 U
  6. *3 q0 J! [" F6 ]' n0 E* e8 _
  7. *   This file contains EDMA3 Test code.- B7 r( e1 C. {; Y
  8. *3 f8 \6 G  k  U* ^- m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / u1 X# \' S. A7 g" v, ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( \0 m$ h! v; m8 S. c1 o5 e8 A
  11. *         TO CHANGE.4 ~$ `& j, ~2 S
  12. *3 x7 L: _3 n& F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - u+ i3 m& l7 Z
  14. *1 v: u1 D9 F% Z# q: [
  15. * This program is free software; you can redistribute it and/or
    $ N7 |9 M8 g9 i1 L, m( T2 W
  16. * modify it under the terms of the GNU General Public License as
    " E$ e) C1 S( o1 \
  17. * published by the Free Software Foundation version 2.0 {* G& T  I4 q& A# I+ G5 B
  18. ** P" [! I, ?, g4 U3 g, ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: E- a: M* y) ?$ s" `6 i
  20. * kind, whether express or implied; without even the implied warranty8 X4 e7 M; |! [8 G. X6 \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! e' @" o8 S& S8 Q  K' _; C  Y
  22. * GNU General Public License for more details.8 B7 Z& K* n8 s. h
  23. */& R4 _7 |* m0 z; d- x( j0 ^

  24. 3 z& |4 X/ `4 E$ c, h& Z2 P
  25. #include <linux/module.h>2 L; c, i$ v% C. {( @
  26. #include <linux/init.h>
    : {, _2 t- [- U+ b4 I' u, C
  27. #include <linux/errno.h>
    / T1 S- w- v( I: P) {" `, m
  28. #include <linux/types.h>" a  b, J1 ~$ C! y) n6 B/ g
  29. #include <linux/interrupt.h>$ J; ]; a6 `& g2 e
  30. #include <asm/io.h>
    , x0 E: t/ a2 t5 m
  31. #include <linux/moduleparam.h>
    % V! S0 \- \( U0 S
  32. #include <linux/sysctl.h>
    # h0 u# h9 @/ U$ _2 e) @7 G$ v
  33. #include <linux/mm.h>; M. A" n' P" Z# S/ k! y2 p
  34. #include <linux/dma-mapping.h>
    ' j4 Z7 K# I  L8 `9 I4 u& s( T

  35. 5 e7 P( E0 q5 n) |) R0 A
  36. #include <mach/memory.h>$ W7 F2 T0 ^* L9 C/ w% R
  37. #include <mach/hardware.h>
    2 s" u4 T! B# Q* v6 T
  38. #include <mach/irqs.h>
    ) {. F) w5 h1 d7 Z7 p
  39. #include <asm/hardware/edma.h>
    + H* M* E3 F$ n) F
  40. . v$ G( \9 \' G+ W# L( [6 {
  41. #undef EDMA3_DEBUG
    # A/ z# p. L% i. a: k
  42. /*#define EDMA3_DEBUG*/" x% n7 _# }- n" [. O* j

  43. + A& Z( h! ]6 i3 [& V
  44. #ifdef EDMA3_DEBUG
    - n3 q% B- Q) O% B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 A6 G8 `, |) l. M7 J' w; c" A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : @; G; P" U1 u$ m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 q' k. H" u5 a6 n; ]; w
  48. #else
    2 V/ `; S7 h% ]" B+ b
  49. #define DMA_PRINTK( x... )3 `- E4 C: S" j" `' j4 y
  50. #define DMA_FN_IN& b1 `, V" u# I$ S8 T* \/ d
  51. #define DMA_FN_OUT5 _- t8 k4 M: A2 _. ]
  52. #endif$ J* T. h6 T& U* d
  53. 4 w% B1 b: x% }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 p$ R  n5 h; O' {
  55. #define STATIC_SHIFT                3% Z# ]9 A2 f. q' m( b9 z. b
  56. #define TCINTEN_SHIFT               20
    1 D" C9 l4 p/ K
  57. #define ITCINTEN_SHIFT              21
    * _* l1 g9 b  D0 C/ y% W
  58. #define TCCHEN_SHIFT                22
    ( [! P3 O: A* G7 b; v2 ^
  59. #define ITCCHEN_SHIFT               233 u: U4 [/ z8 e! I/ N! c
  60. 5 Q/ s* V0 j1 C" B5 N8 R
  61. static volatile int irqraised1 = 0;
    ( E- `* A- A. S: B1 n8 z) C; s
  62. static volatile int irqraised2 = 0;4 {6 L" @, ~/ |% f
  63. * {* A* @& P  D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) o- }" ]9 n: R3 ]' T3 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 ^" R' R6 `8 i2 v9 g& N/ v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : I6 B/ ]6 }3 v9 B7 @
  67. / z% f# T6 q4 s; x$ Z) n. H6 c
  68. dma_addr_t dmaphyssrc1 = 0;
    9 W9 Z  @) J6 x9 ^) H2 H' f
  69. dma_addr_t dmaphyssrc2 = 0;5 ]# U& h( G1 l- V( c
  70. dma_addr_t dmaphysdest1 = 0;
    2 Q' F* ~/ ~0 O& u$ a# d- S3 |4 [" N7 {
  71. dma_addr_t dmaphysdest2 = 0;
    6 d- \( z& r3 l8 k4 N( `! _

  72. 8 {# Q8 u2 A" U& [) h
  73. char *dmabufsrc1 = NULL;
    5 @$ b6 F. }) D' d
  74. char *dmabufsrc2 = NULL;6 X! n3 O, T  _, g' u& }$ G' F
  75. char *dmabufdest1 = NULL;2 D7 Q( m: \, a/ X2 X# {# ]- l
  76. char *dmabufdest2 = NULL;
    8 i1 W! x: X/ R! M+ M

  77. " d1 G# J; G. e- m" ?! |$ J
  78. static int acnt = 512;
    ) `' B" K1 c5 O2 y$ a$ R2 F
  79. static int bcnt = 8;0 T$ X1 c  g8 L$ a8 N
  80. static int ccnt = 8;7 j$ x9 d- H; X# k& x* l- \

  81. : e* i- s% z9 w  s2 |
  82. module_param(acnt, int, S_IRUGO);
    4 J9 r  X  }% \3 K# W; p* m
  83. module_param(bcnt, int, S_IRUGO);* ~, R, E. B9 k: S; d9 a7 H* J3 p3 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. O  e5 q5 {9 w5 O7 u. O& b- V3 `( `" u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# G3 `+ l0 p+ e2 Q8 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. U$ Z8 u* ^2 t: I4 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# X# T+ M2 _) V0 R$ V+ ?  q. n- J" n0 W6 v" z( X

6 D! [8 M: ~/ x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 00:31 , Processed in 0.040878 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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