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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : L! B7 @7 s: }. ^% e
  1. [code]EDMA sample test application
    # s) i, c& U+ H5 R% u/ \1 [
  2. /*) g: y0 [7 d$ B- X
  3. * edma_test.c0 W$ j. ]# i) Z$ n
  4. *
    3 i3 B8 w) [( q
  5. * brief  EDMA3 Test Application
    2 M/ M+ o7 m$ K! z8 N, H/ N$ ^
  6. *
    ; ^* O; `9 X$ k) m+ N) u6 g
  7. *   This file contains EDMA3 Test code.
    ' L9 A) P( C5 I
  8. *2 @! z! j! O# V6 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- ^; E( q: K9 t# ^5 a" T$ ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 v, d6 G# W- c5 b- N, F
  11. *         TO CHANGE.9 f) c* Y8 E' {- ^( T: U8 ~. F( Q2 n
  12. *% k7 q* G$ b3 ]! p, p3 i- f! ?4 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ m  Q1 a( A# y* Y' d) q
  14. *& U" d6 J; x) q. W. I  I
  15. * This program is free software; you can redistribute it and/or
    $ Z6 r: ~; _1 {* a! f8 i% ~; G: ?/ z
  16. * modify it under the terms of the GNU General Public License as- ~" H2 o) l( w* {6 c
  17. * published by the Free Software Foundation version 2.
    . k: U+ r& x5 o
  18. *
    5 q, v, o7 {" e( j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 d/ C; g3 r$ D6 l
  20. * kind, whether express or implied; without even the implied warranty! t3 b) c" I5 g: \5 G3 a2 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 j, u1 N9 A. ~3 [) z4 ]
  22. * GNU General Public License for more details.- A" T7 y- F. f' Q; K' j; X) ?
  23. */& T; ?# {( ?5 J2 h( p5 m8 J9 I

  24. 8 O+ m  H* j. z! R4 n. A: ?
  25. #include <linux/module.h>! _2 n0 {# ]* h1 o6 ^3 F6 U$ X* C
  26. #include <linux/init.h>
    % x* A6 k9 H4 f! Z& x! \" Q! Y$ k
  27. #include <linux/errno.h>2 [9 ]9 o3 b0 v3 D4 c9 K
  28. #include <linux/types.h>( g7 u1 L) @2 l
  29. #include <linux/interrupt.h>) ?, p2 a2 d- ~6 g$ |8 ^$ h
  30. #include <asm/io.h>3 r* U6 j2 ^0 N$ X' j3 I
  31. #include <linux/moduleparam.h>2 C8 p( X7 u8 n' i4 C, U
  32. #include <linux/sysctl.h>
    & g  \3 q  I) z% B8 n- P
  33. #include <linux/mm.h>
    , W$ N, ]% b7 B2 p  g, n
  34. #include <linux/dma-mapping.h>
    $ G4 j4 A  M3 q
  35. 5 J( V! v  t& I7 N1 b. W/ q% [
  36. #include <mach/memory.h>( |8 o8 {- W8 i
  37. #include <mach/hardware.h>
    ; ?' I6 ~2 B0 m1 x1 ?0 M# b
  38. #include <mach/irqs.h>
    % m: W/ X% _6 p$ f
  39. #include <asm/hardware/edma.h>3 c4 R  t$ `8 X% y+ E7 H" c. N
  40. 9 D: c* ^1 ]7 E) N) f
  41. #undef EDMA3_DEBUG
    ) v4 v$ ~/ h3 F2 P* V0 f
  42. /*#define EDMA3_DEBUG*/$ ]6 R+ M. |- s1 G: Q1 V

  43. 0 T4 Q9 [5 I/ v3 V% w7 o8 f
  44. #ifdef EDMA3_DEBUG
    & Z2 W* y/ ^7 Z+ r+ t0 x! Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . w8 Y/ v; q+ i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 k( R7 U9 }; X6 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - H" k; h0 Z/ ?8 _' x, D
  48. #else8 {8 m/ ^! ^9 Q$ a
  49. #define DMA_PRINTK( x... )
    # i# n( M$ U' Q! U
  50. #define DMA_FN_IN
    5 d, x: o9 |3 F- `2 f0 k# n6 U/ l( K
  51. #define DMA_FN_OUT
    + Y: E4 \  L  g3 ~0 w& M
  52. #endif
    4 x7 f7 m" t% S# K0 q9 d$ _# o! \
  53. - q% A; S! T$ D  C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * f, v8 G: d( `
  55. #define STATIC_SHIFT                31 P- g, {$ {! g' o+ }* B
  56. #define TCINTEN_SHIFT               20. |) C5 s$ ?0 t
  57. #define ITCINTEN_SHIFT              21
    3 x- @* L' f6 j+ L
  58. #define TCCHEN_SHIFT                227 T+ @, l: N7 V
  59. #define ITCCHEN_SHIFT               23+ C* ]- C" }& T; H; `
  60. 0 N' B* @  f0 t8 k( D/ L
  61. static volatile int irqraised1 = 0;0 W3 C3 S! [+ {2 Z
  62. static volatile int irqraised2 = 0;
    3 S! o$ Z" h* W4 j
  63. , Y, A. ?& h3 h% Q; {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * v# y; E4 b& Q$ M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # D& S5 ]1 ]* V" ?3 U: U6 r5 x# G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , T+ Y9 `" l' w9 A

  67. 7 w% w6 s) k, H
  68. dma_addr_t dmaphyssrc1 = 0;2 B( V' }1 z$ v8 l: }; d
  69. dma_addr_t dmaphyssrc2 = 0;
    % ]0 W' h  L+ [( v$ s
  70. dma_addr_t dmaphysdest1 = 0;6 `6 |0 L9 M# ^! H/ Y
  71. dma_addr_t dmaphysdest2 = 0;) }9 e3 ^. B; e: b$ s

  72. 1 c' N6 r; Z8 `8 d, H) S& f
  73. char *dmabufsrc1 = NULL;4 \2 ~1 }/ [/ E3 R/ n
  74. char *dmabufsrc2 = NULL;0 q! G. X; i4 [& I
  75. char *dmabufdest1 = NULL;
    . m& b: K6 C2 ^# ^; U
  76. char *dmabufdest2 = NULL;7 l5 x" a4 F9 ~( _: G
  77. 1 S1 r* K5 u! l
  78. static int acnt = 512;/ }5 r( x7 S- s' C+ }9 V
  79. static int bcnt = 8;/ v% _* ?: h. C8 i
  80. static int ccnt = 8;+ d# o9 f, ?! b4 v+ P4 @
  81. ; ]; l2 `7 u: G1 u+ k: O5 P
  82. module_param(acnt, int, S_IRUGO);
    ) Y. q3 g( ~: X2 _0 _* J- M  x
  83. module_param(bcnt, int, S_IRUGO);
    8 N2 P4 E3 Q6 l5 d7 A' C5 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% y4 d2 g/ S" R, K( j9 Y6 n8 w# ]( X; O. Q# F8 l. ^: p% f% B5 x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" _# Y, h0 b" Q/ j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 v- C5 C* {& g, W1 f7 {# X9 _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' n  H7 o1 j; f" A: M: T/ ^

( g6 S+ b. B% U  I. S' D& `( W: P0 Z  @: x/ L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 23:05 , Processed in 0.038714 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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