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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 R7 K) X, J1 Z) T1 X5 e6 N, T
  1. [code]EDMA sample test application
    $ B6 Y: I( z( f
  2. /*
    3 y$ E  M4 N- f8 E1 Z
  3. * edma_test.c
    0 ^9 P' r. y$ Z. s
  4. *! s  j5 J  t- g# ?
  5. * brief  EDMA3 Test Application
    ( R" F- H; B7 [
  6. *' W, v; N, t3 k; n8 p1 V) _
  7. *   This file contains EDMA3 Test code.
    , h; T! g$ K0 e' Z
  8. *9 R, {4 h6 C) @1 f" @" Q6 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 ^; \, M! _: d6 {! S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; z& y) {) ~1 N# x
  11. *         TO CHANGE.) {2 X) l: [2 e  B) z* U* I
  12. *
    % m  \+ Y: V3 Q+ ], U: B; e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 V) e$ F$ T* A9 W
  14. *" a7 t5 R0 m1 c* Q: i
  15. * This program is free software; you can redistribute it and/or% M, H8 O4 u! _6 U& E
  16. * modify it under the terms of the GNU General Public License as
    : B9 `! }/ C4 E: A
  17. * published by the Free Software Foundation version 2.
    5 \$ n8 A7 ]% B) B0 r; {/ C4 G
  18. *
    7 r' F2 y: C* x" M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . e; U& }3 B$ n7 G
  20. * kind, whether express or implied; without even the implied warranty
    * }& W: R! V9 U9 l7 l" l9 m! i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      P4 |3 e2 [- ]) X5 h1 H
  22. * GNU General Public License for more details.; X4 p5 S" F7 m+ q! U
  23. */
    - V+ L/ z( E- _4 [5 \

  24. 1 }* L4 \" ~9 V) q( Q4 g
  25. #include <linux/module.h>
    5 g0 q7 x. i. a7 \8 G' A5 }4 Y
  26. #include <linux/init.h>& K1 R$ g3 U6 k) h, b
  27. #include <linux/errno.h>
    3 V6 x* t3 d* j$ W7 \4 e. R/ A
  28. #include <linux/types.h>
    9 R; H- r; v5 S) B, _: [& Y, y3 j
  29. #include <linux/interrupt.h>
    3 o$ N4 {' H& e9 U( y
  30. #include <asm/io.h>/ O1 e5 t5 F7 A" B$ S; X
  31. #include <linux/moduleparam.h>
    4 N- f4 B4 X9 [9 l; S3 {' ]
  32. #include <linux/sysctl.h>
    & H+ \3 [) V% S5 G+ @
  33. #include <linux/mm.h>- `: Y( Z0 U0 [4 q9 T
  34. #include <linux/dma-mapping.h>
    % }  _& W- n! t+ d* E  A8 b
  35. 0 a  k6 c1 Z9 b' E' p. Y. w6 g) P
  36. #include <mach/memory.h>
    7 j' W" e8 W. |* @
  37. #include <mach/hardware.h>2 d$ g" z( G3 Z2 b
  38. #include <mach/irqs.h>
    ! _% k2 ]' ]: e
  39. #include <asm/hardware/edma.h>4 W5 V7 s: o9 V4 r+ Z, v: K
  40. ! y6 [  p: h! Z0 t4 m6 |) R3 N3 _
  41. #undef EDMA3_DEBUG
    ) M- p/ p1 }6 I$ v8 A8 C: Y8 f
  42. /*#define EDMA3_DEBUG*/
    3 i& w2 e" R+ Y; J3 \( T2 B$ z
  43. 6 F4 [& [( a; U1 `3 O
  44. #ifdef EDMA3_DEBUG
    . o4 Z9 ^8 ~& `' W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - c  T. z% s  U$ x+ p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ O5 _8 Q8 n" G: b0 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # }; Q/ N, S: s# f3 l0 k3 z. m. }
  48. #else
    3 A+ z: c% R' ?
  49. #define DMA_PRINTK( x... )+ t  ?1 ~8 A5 h' M+ c" ^: Z
  50. #define DMA_FN_IN) h+ f! Q1 }) ~1 [! ^
  51. #define DMA_FN_OUT  j' f% p' {3 I7 f% U7 `
  52. #endif6 n: ?9 U" f" T5 Y2 w

  53. 8 a* ~1 q& g. b/ {& ~4 l3 n0 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). Y2 ^7 x4 J- F* L" i9 Q$ ^
  55. #define STATIC_SHIFT                3' f0 c6 Q2 N. h! k3 B# Y
  56. #define TCINTEN_SHIFT               20; V' F( C7 I3 c9 F
  57. #define ITCINTEN_SHIFT              21
    6 U% S4 V: N) w# c, l4 `
  58. #define TCCHEN_SHIFT                22
    7 a+ ^, B! j5 B" i
  59. #define ITCCHEN_SHIFT               23
    9 c% K: l4 ^% L* i6 P
  60. 8 j$ X# |" b( F( Q+ D
  61. static volatile int irqraised1 = 0;
    # d3 S7 E6 R1 G& R
  62. static volatile int irqraised2 = 0;
    - F( G( j6 T& Y. K" ~) e' H
  63. ' W7 m& i/ S( e1 @: W9 M- r% Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. @! f0 s8 T. m1 d& G5 ?) K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " B& E/ _$ T. l  d; d" @8 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % |! V# E* e" t' {
  67.   G# C% B2 L4 ~/ ^& w4 P
  68. dma_addr_t dmaphyssrc1 = 0;* ?" s2 D) |: O  U( J
  69. dma_addr_t dmaphyssrc2 = 0;
    % F( `& }" ]' P
  70. dma_addr_t dmaphysdest1 = 0;) x4 Y4 x* J% p0 `
  71. dma_addr_t dmaphysdest2 = 0;3 f, D0 w; K% R' ~. A( u
  72. * j+ A6 B" E5 g  T' h0 ^
  73. char *dmabufsrc1 = NULL;; g7 e) b- f; |: b3 S" n
  74. char *dmabufsrc2 = NULL;. v$ U: q# Y  ?
  75. char *dmabufdest1 = NULL;* g8 O, r% ]6 s7 B$ e, Z4 B; n2 d
  76. char *dmabufdest2 = NULL;* N1 {/ x& Y2 @' L% I5 e/ j
  77.   K9 L: N( E+ j; n
  78. static int acnt = 512;
    ' `5 b& h+ l5 ~9 y5 O+ ~
  79. static int bcnt = 8;
    9 s. ~1 o+ I6 N4 N; @
  80. static int ccnt = 8;/ F' n# j" ~4 F7 x
  81. 0 H. S. {1 t3 w1 u$ v- i! N& i
  82. module_param(acnt, int, S_IRUGO);
    9 S( X. y" `" ^, p% }* f( T
  83. module_param(bcnt, int, S_IRUGO);
    1 c. |  c7 l2 F( z* ^1 o: O% e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ j0 W* r+ O" r; G4 V" D$ T( t0 _8 s* q1 u7 ~7 ]) W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 s$ f1 I& D0 v+ ?8 c! y3 F  p1 earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! c' y: K3 ?$ f1 {; `9 ]- o9 Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  E4 Z1 C  Z* _( P- s- a
. f+ j# R# \/ O( A5 i

5 i; [5 R/ ^4 I9 x) k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-16 00:50 , Processed in 0.037735 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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