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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   l2 t6 Y' a$ S: F
  1. [code]EDMA sample test application" M) j+ [! F5 D& w. ^
  2. /*
    # y! n1 m' a# O5 g, |( p
  3. * edma_test.c9 h$ M& J5 C" C) r
  4. */ F, g1 `. c+ V" Z; h
  5. * brief  EDMA3 Test Application, P1 [: b1 S% u& L7 S+ T' |
  6. *) h2 o4 `' c1 n9 q1 c2 b
  7. *   This file contains EDMA3 Test code.! s3 F& ]& i6 [3 L
  8. *( F, g5 J3 K2 @3 a4 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 ?  j9 n0 ^' l( N6 h) Y) a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' o, U6 x( _3 x8 L6 N1 M
  11. *         TO CHANGE.6 b$ Z, ?$ ~" `% P" [4 l0 A" h
  12. */ p$ P" a1 @, M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 z, {' T7 @0 U" F8 B+ Y7 p
  14. *& {: s8 t7 v, N5 K: S7 A+ M3 V* E
  15. * This program is free software; you can redistribute it and/or
    . z; V: b* m) b  b2 w
  16. * modify it under the terms of the GNU General Public License as5 B  n9 |# u6 f& t' ?$ L
  17. * published by the Free Software Foundation version 2.
    . I8 W' m* o. ^6 U5 z
  18. *) m/ i% I  ?# \" {7 ?0 q6 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . y5 l5 y$ G- X1 n
  20. * kind, whether express or implied; without even the implied warranty
    1 |8 }& i1 r" I+ ~5 z" H  o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ z1 r. W" H* @/ s+ q8 I7 k* I
  22. * GNU General Public License for more details.2 ]* Z! {/ b5 ]8 ?* c; @
  23. */
    & ~9 r& @3 C8 a6 P- O1 a# J
  24.   B: p1 m: x' r7 P, \! C( D. |
  25. #include <linux/module.h>: b! h6 v' K: p* F
  26. #include <linux/init.h>% p! J& V) r6 M5 N5 z0 ^
  27. #include <linux/errno.h>
    3 P2 T: L7 _: n$ q# Q" o3 K
  28. #include <linux/types.h>
    ) q' Z+ w" l! V! U' g( D
  29. #include <linux/interrupt.h>2 P$ C- ~; T% r' a7 H9 ?
  30. #include <asm/io.h>
    . b7 ~0 e7 D3 i& R
  31. #include <linux/moduleparam.h>; H' m* I' Y3 y( Q) H
  32. #include <linux/sysctl.h>3 M- t  i+ w! ^- H1 |' c3 u0 H
  33. #include <linux/mm.h>' a! i" B5 |  m8 S, R% r
  34. #include <linux/dma-mapping.h>
    + x" u( I  l$ i3 w6 H* |$ B

  35. ) G  T7 M# P' H  s1 I: Y. Q2 i. H
  36. #include <mach/memory.h>& W& ^/ g3 t" q, P
  37. #include <mach/hardware.h>" O( ^: G- }& Z
  38. #include <mach/irqs.h>
    * L, L4 a$ b& o- B$ t
  39. #include <asm/hardware/edma.h>
    ) t; y5 P" \% Z2 V8 D

  40. 7 ]8 ?9 ~" ]1 ^0 V% c* Y
  41. #undef EDMA3_DEBUG
    + r" O3 F, `7 U5 Q
  42. /*#define EDMA3_DEBUG*/3 P% \9 v, o0 E! O$ E9 a
  43. 6 I% h8 e& h; F$ @6 A. O
  44. #ifdef EDMA3_DEBUG% ]8 U' ^! e# e2 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * b: [. N! E# H# V$ E4 v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 m7 z" R5 t( B  B5 N0 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' R3 }$ s; f1 @6 O# d
  48. #else% ]) n' R7 w9 X. a: i! K/ h6 A" F
  49. #define DMA_PRINTK( x... )7 N( T0 f, d8 o% [( A% g( V
  50. #define DMA_FN_IN
    9 Y6 i- D/ @* d, ?0 e
  51. #define DMA_FN_OUT
    8 f$ @  f, _4 Z( ], ?. `3 G
  52. #endif
    0 W; `8 d' x0 n6 A& F. L3 @; h: A

  53. 7 m% y2 U1 ]) _7 J# |& y8 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % s- S* o& G2 Q9 |+ t  Q' T
  55. #define STATIC_SHIFT                3: i6 B. _' V+ z: F$ u; P+ l4 N  |
  56. #define TCINTEN_SHIFT               20/ J* }3 ^+ N8 s
  57. #define ITCINTEN_SHIFT              21
    ! A/ q7 @) j# L2 j5 p4 I
  58. #define TCCHEN_SHIFT                22
    6 O4 }& j0 O# d+ T$ _4 w6 B
  59. #define ITCCHEN_SHIFT               23
    2 T# T( v# Y! ^7 Q1 r1 Z
  60. - ]3 n1 w8 E7 `
  61. static volatile int irqraised1 = 0;
    % z  t6 F- l: a, B  K
  62. static volatile int irqraised2 = 0;
    " `4 _4 T% H* e) |' V. g

  63. * _3 V4 `1 i9 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . B! E  @* W8 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. d+ b+ H( H* d* |8 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 J! W6 N" J0 ^1 @: I

  67. , B8 H1 Q$ t" h
  68. dma_addr_t dmaphyssrc1 = 0;; @3 Z% J7 @9 A. j6 ~
  69. dma_addr_t dmaphyssrc2 = 0;
    $ N5 Q! N2 L  w$ h
  70. dma_addr_t dmaphysdest1 = 0;8 n9 g+ w* J. r& @  d+ J
  71. dma_addr_t dmaphysdest2 = 0;
    ; Q% P5 {8 h  o7 ]5 A4 K$ t

  72. ( L5 {6 |  Z$ e! R9 t# z
  73. char *dmabufsrc1 = NULL;
    , C9 |7 I7 g7 V! O
  74. char *dmabufsrc2 = NULL;
    : |+ @7 h  k5 }8 ~& H9 c
  75. char *dmabufdest1 = NULL;
    & }, g$ b7 I5 O
  76. char *dmabufdest2 = NULL;( r, S+ h" p! F: I  y* N% L& e
  77. ! N1 d, ^/ i/ {( \4 Z
  78. static int acnt = 512;
    " w  n# R" ~: \% l* d# Y8 [8 V2 a. V
  79. static int bcnt = 8;
    1 g+ c3 g) M" U% ]! \3 F
  80. static int ccnt = 8;) k" w; R. C% T7 j

  81. , c0 c+ _# _* a. h" ]) t8 X0 d& r
  82. module_param(acnt, int, S_IRUGO);
    ' n9 o) @' T2 |% A; ?$ ]
  83. module_param(bcnt, int, S_IRUGO);
    * v0 L! b# _! }, Z' l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" W6 q+ v: d; ^, }' T  E
6 ^( e+ O, Y/ B) x& f" N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 X& p& J+ L5 R  s% }3 a+ _' J: b. Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) e4 q! a: C2 I8 T2 U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( S  u/ _! a) u: U$ b, f0 j2 t
) k+ V. M, w: o9 P' Q
" f3 o9 f5 s7 C0 L/ A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 21:32 , Processed in 0.036538 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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