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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 }" t1 c6 \/ ?/ x$ ^# `( A
  1. [code]EDMA sample test application+ y/ \3 L- c; _9 M, q4 m
  2. /*
    " e. l+ ]) f! c: B0 ?/ a& C
  3. * edma_test.c2 `7 t" N" Y3 j' D! G7 Z1 o
  4. *
    ! {3 m6 P3 s5 B
  5. * brief  EDMA3 Test Application3 ?0 y# Q; z% [  a( j
  6. *" Y4 A0 G. h& P  `9 w( z% ^
  7. *   This file contains EDMA3 Test code.- L1 ?. l; j6 {* ~
  8. *" F; _4 H/ j  ~4 Y" W7 F6 k7 T; G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  Z/ M5 V0 U4 P. W9 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / l/ y8 f- L/ y) o9 g" B
  11. *         TO CHANGE." y9 f# ?# q0 l' @4 I+ K8 f
  12. *
    1 e- Y( r# j1 }9 n/ q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 u. l) Z/ V$ K3 Y* I
  14. *
    " B- E7 G- y3 W; Z& q  z/ O* [6 B
  15. * This program is free software; you can redistribute it and/or
    - L' R8 i! Y: K, [
  16. * modify it under the terms of the GNU General Public License as
    ; v" g9 h! _9 f) Q
  17. * published by the Free Software Foundation version 2.. ^. {9 p4 O. _# R. Y4 T$ A
  18. *
    ! P# V) m- V& n: c  @' l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. J+ L$ n* j" U( Q9 C
  20. * kind, whether express or implied; without even the implied warranty
    . B$ l" P, A" b( q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , [9 ^1 t* i) g7 F9 I# U% f
  22. * GNU General Public License for more details.  v0 z8 m1 w9 O- K7 w6 f% d
  23. */
    9 W. C( H4 b1 z: i" V7 {% R  x- j

  24. + c3 |  d0 O2 v/ |& _
  25. #include <linux/module.h>+ V3 @) }( b: n3 x! c' h- E( G& [
  26. #include <linux/init.h>' b1 i1 d. w" A8 W& L  s9 i
  27. #include <linux/errno.h>. }7 M$ I+ U) j, p5 ^
  28. #include <linux/types.h>" [7 ^  V# U7 `2 V" ?1 B$ O5 ~
  29. #include <linux/interrupt.h>
    3 Q4 [; i, q+ U: D) i; o& h  j
  30. #include <asm/io.h>: i0 f- k& n' _3 w" r8 q4 i( o. s
  31. #include <linux/moduleparam.h>
    # i& ~& w- }4 n+ B/ [5 d4 P
  32. #include <linux/sysctl.h>0 A+ c, P! u3 k) M
  33. #include <linux/mm.h>5 Q) z8 p3 R% H. _8 O8 }9 X. H* _- {
  34. #include <linux/dma-mapping.h>
    # ~2 g) Y* |# A3 O+ D$ J# e' h
  35. ( }% C, J2 X; G2 ~$ R) w; k
  36. #include <mach/memory.h>
    , q. e( E& {0 M
  37. #include <mach/hardware.h>
    0 P0 ?4 z  W& t$ Y) z
  38. #include <mach/irqs.h>
    . Z/ D! j& E' Y! o6 g" {( ^
  39. #include <asm/hardware/edma.h>
    ) H/ A( ~6 s! n% c8 T* I& T+ U$ e7 P/ \
  40. : ]# H9 D8 X. E/ d/ O5 i, Z
  41. #undef EDMA3_DEBUG+ }6 f" U7 I5 @+ n
  42. /*#define EDMA3_DEBUG*/7 ], v4 y, k: ^0 {/ S/ u: N7 J! @; J

  43. ! F  U* x, L0 e; O6 Y  l9 a5 v
  44. #ifdef EDMA3_DEBUG: o- V& U8 b1 E# p3 |6 Z& U4 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : G! s- k0 t5 A  L. U4 C. g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 }9 n, ^% H# m" O4 P5 z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + u1 _4 l+ ]9 T4 o/ V7 O! E
  48. #else. ?1 G7 O  c' i6 a
  49. #define DMA_PRINTK( x... )% ?* p/ {; l: q/ f) u1 f+ F
  50. #define DMA_FN_IN; k. S3 h  ]0 \2 O8 O
  51. #define DMA_FN_OUT2 _1 l6 U& J9 p4 ]
  52. #endif
    / L' {4 H; d& o
  53. 8 z, k* M$ q" w& X+ r! m, q& c* w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" R; V+ H" H! f* w' _4 S% w5 e
  55. #define STATIC_SHIFT                3
    . c$ R6 @% J# A! Y' v+ H! B% T
  56. #define TCINTEN_SHIFT               20
    ! H4 n. P/ \4 n( q  g  r$ k
  57. #define ITCINTEN_SHIFT              21
    + g4 e  f. R' V& U" n
  58. #define TCCHEN_SHIFT                22
    & ?' ^4 S( O* s( x0 P, v( @# w1 P* v
  59. #define ITCCHEN_SHIFT               23; C* O% ~: z( X' Q- s; f& `
  60.   C6 u5 R- J" N3 g6 t# {
  61. static volatile int irqraised1 = 0;8 e  z# C3 Y3 x+ o( F
  62. static volatile int irqraised2 = 0;
    , z8 ^. A5 v. D; C

  63. " n/ {6 x  A1 a! d& B3 o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 g1 _5 E0 t2 |2 J: b1 u6 r/ I+ l. M# ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ?- ]" b* A4 S9 L2 D+ Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# N8 T! E9 b: A+ G& [
  67. ! i; X3 j  A% e! ~* ^
  68. dma_addr_t dmaphyssrc1 = 0;
    ) [4 Z7 t  _% v3 @, A2 N
  69. dma_addr_t dmaphyssrc2 = 0;7 |3 V$ H% |; r! L9 s$ }2 o
  70. dma_addr_t dmaphysdest1 = 0;
    6 n  v! }1 h: t: T9 e( M
  71. dma_addr_t dmaphysdest2 = 0;, l1 R3 y' b# R% `
  72. 2 u9 a' a* y3 k; Q: c% q
  73. char *dmabufsrc1 = NULL;
    ) ^+ X: A8 j) k) t5 x
  74. char *dmabufsrc2 = NULL;
    . d1 p1 J) T3 u' A0 W' U
  75. char *dmabufdest1 = NULL;
    # Y4 }4 L1 S& Z8 S! R: r/ U$ I  {
  76. char *dmabufdest2 = NULL;2 @$ w& q9 H  W
  77. 1 o+ z: j% `) }
  78. static int acnt = 512;
    2 Q$ s* h  j- ~: l) c0 Y( i& F1 a$ G
  79. static int bcnt = 8;
    4 T' V( n; Z% a' d2 z
  80. static int ccnt = 8;4 n9 a+ v6 ~- y' t, v

  81. " U8 ]' @; f* x, p/ M
  82. module_param(acnt, int, S_IRUGO);6 d1 Y8 Z7 o5 Y- v* J0 l
  83. module_param(bcnt, int, S_IRUGO);2 \1 o4 d* U  [3 s5 U7 [5 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ b0 w% L5 [4 I2 z1 e9 p3 i
) \9 w) I+ {! \$ c% N( F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' v6 |3 e; Y$ ?* A! y# v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( J6 U6 `; b7 e$ J7 H0 A- w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- D, [' _1 K* {3 H. D9 \
: H3 Z5 l3 u) u5 `9 [6 Z& P. v0 D! j& ^5 z6 k7 n5 v- z! O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-22 06:35 , Processed in 0.036186 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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