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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) w$ A9 j. U9 ?; R$ S) u+ N1 A
  1. [code]EDMA sample test application$ ^9 t; M  w8 f
  2. /*6 I& t& `$ ^9 `* m7 W( q2 _
  3. * edma_test.c. J* s+ H& \0 w/ \! r! ]* j5 q
  4. *
    ' L  _- G' R% t9 o
  5. * brief  EDMA3 Test Application0 I$ E) ^/ k, W" R9 q2 B8 [
  6. *7 ?: [( w$ `0 ]8 r8 m+ j. w
  7. *   This file contains EDMA3 Test code.
    8 a% ]7 q6 ~3 m! C/ K" }: R
  8. *  h; ~) K9 W/ y+ q) B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 J. \, j$ h, ?/ C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 I7 ]$ s; K. V
  11. *         TO CHANGE.
    1 u2 S6 o7 J* p* N0 W
  12. *( e$ J8 O$ h, j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * \: a1 `% X. [2 I# x
  14. *4 ?; Z; f3 d$ D* d) ]& W
  15. * This program is free software; you can redistribute it and/or
    7 d; g$ G0 l1 m* e- Q
  16. * modify it under the terms of the GNU General Public License as6 O+ n7 K! P, J# |
  17. * published by the Free Software Foundation version 2." Z% M' m8 g! O2 A4 o8 f6 s
  18. *
    6 {+ P5 T! ?$ ^6 k- |$ Q1 O+ u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( x2 v* n9 a: k& _/ g- E$ [
  20. * kind, whether express or implied; without even the implied warranty
    9 a9 w& J+ U4 U  X2 E! l1 T8 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 U& Y5 J3 g4 L- R8 X/ J% x
  22. * GNU General Public License for more details.: V  n7 Z+ I6 `
  23. */
    " {4 @* x. E4 g9 N
  24. + A5 x0 ^$ Y% q+ l
  25. #include <linux/module.h>
    ) C: [4 W: m& @& F3 M! e
  26. #include <linux/init.h>) T+ e9 Y: z; J( J- _/ n& Y' V
  27. #include <linux/errno.h>
    - ?" b. G; C2 v" [! K  V
  28. #include <linux/types.h>1 Z- M' g& b. V* s, z
  29. #include <linux/interrupt.h>
    8 F. f5 Q) I6 E; }# q
  30. #include <asm/io.h>
    # Z1 P  `6 d! [! T) ?$ c7 M# p
  31. #include <linux/moduleparam.h>
      w; [# v+ m0 ~% U9 v4 Z* C. e
  32. #include <linux/sysctl.h>' ~- o* G( w1 V: R6 A: L$ `
  33. #include <linux/mm.h>
    % ?' X% u, L& G6 S
  34. #include <linux/dma-mapping.h>
    $ m! W3 c# g0 n( v

  35. , f0 R% O! M. ?7 L% n- W; f4 V" u
  36. #include <mach/memory.h>
    6 B! I& B$ ?+ ]' m3 L% Z
  37. #include <mach/hardware.h>5 X2 @* N* O# f! V, T
  38. #include <mach/irqs.h>( X1 L  K' Y) L
  39. #include <asm/hardware/edma.h>) F- W( K" ?" G

  40. 8 D+ J* }- `. \6 D7 o6 V; C
  41. #undef EDMA3_DEBUG2 ]: G. o5 h; A: x1 p8 f
  42. /*#define EDMA3_DEBUG*/% |; Y+ z% v. ?7 K, ~9 k9 Z
  43. 2 n% u3 Q2 o2 M
  44. #ifdef EDMA3_DEBUG
    ) l! j: a8 B  ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), T6 h4 E0 P2 q. I% N! {5 K1 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & u& A5 ~( ?6 D' _5 \6 ~1 i, u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% X5 D0 M! l7 T) R/ k% u7 |
  48. #else
    , v" V, W' w7 X$ h) i2 _' I
  49. #define DMA_PRINTK( x... )
    4 J5 n6 z' y3 V+ F4 H3 o$ C' }7 n
  50. #define DMA_FN_IN
    ! A+ N3 b, Q0 o
  51. #define DMA_FN_OUT
      L2 u" ~0 l. L) K$ M: c* U# J5 b% Q% L
  52. #endif
      ?9 w  i; _. z  M; d( o0 v  E
  53. ' z& Y6 ~, L' f) b. I' Z( O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% p0 J: U$ `1 y4 B- M; P
  55. #define STATIC_SHIFT                3  S* A6 B9 v7 W/ R- ^4 K# T
  56. #define TCINTEN_SHIFT               20/ v' p) A2 W! O; G9 B
  57. #define ITCINTEN_SHIFT              21/ r+ N: P- u/ z9 p, l
  58. #define TCCHEN_SHIFT                22
    , i8 X0 g+ f8 ?* |4 p8 y
  59. #define ITCCHEN_SHIFT               23& ^: O3 N) V' L+ a

  60. + f+ |' z# V- E, A
  61. static volatile int irqraised1 = 0;0 ~$ e% j! ]3 \, C1 w3 B
  62. static volatile int irqraised2 = 0;
      w+ Q% M! p2 ^! m& i; X' X) p$ o

  63. 7 ~& R6 X  f  l/ m. E. d- b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # k7 n' v: \9 f: l+ m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' {7 K! L5 z; W; @9 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . J$ C$ `  r6 m. e+ {8 N3 g
  67. . e5 i0 r1 K2 N8 L3 r) U
  68. dma_addr_t dmaphyssrc1 = 0;
    ' U  z+ t2 E" _, d
  69. dma_addr_t dmaphyssrc2 = 0;- m  l' m- J( b0 v! t+ U
  70. dma_addr_t dmaphysdest1 = 0;
    " q! F$ @! x4 `! U( w
  71. dma_addr_t dmaphysdest2 = 0;% ]9 F' E! Z' O- X/ L

  72. ' V+ q; u. P5 U* x* }3 d
  73. char *dmabufsrc1 = NULL;
    ! C5 g+ K% e! Z+ B" P
  74. char *dmabufsrc2 = NULL;
    . p) n6 J. Z1 j; x! ^
  75. char *dmabufdest1 = NULL;
    - B4 E( Z8 F+ W) ~# v) e7 Q  p
  76. char *dmabufdest2 = NULL;4 {/ K0 D% y6 n2 T6 ]6 ~0 N+ s+ E

  77. / A# u' K3 L) E
  78. static int acnt = 512;
    5 l# b! w$ ?& R+ S& u6 f
  79. static int bcnt = 8;$ p" m! y' {" c0 u+ K
  80. static int ccnt = 8;
    7 w/ K5 o' ~  @: D4 _

  81. # u& d5 U8 h/ N7 D1 T- g. v
  82. module_param(acnt, int, S_IRUGO);
    / |) a% R3 X& Q7 T0 g
  83. module_param(bcnt, int, S_IRUGO);
      u- F1 t  `4 l, m+ B  O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- ~4 v4 F" L, ], u/ v( n) c+ ~; O

# Y7 x9 W8 G, E9 _( ~" \) S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* d. k% D( O' Z6 T+ S% A4 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) n5 c2 v4 ~3 R, ~% V' t' `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ M% d0 W! _7 q! r/ D- `0 o4 c. y" v) {5 H1 _  k- ?0 p* j

) o  u5 d" u4 Z3 T$ J, c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-11 17:48 , Processed in 0.038710 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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