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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 _8 _' x& j* n: z) f
  1. [code]EDMA sample test application2 T' h9 ?' D" l  s0 K
  2. /*
    ( J1 t& Y$ \  o1 a( `: V
  3. * edma_test.c
    ! E4 t8 d, ~( p4 j% @( s
  4. *
    ) m& Y$ k% R% _+ o% P+ {1 ?; b) a  V
  5. * brief  EDMA3 Test Application: u, q0 B+ s: U, c
  6. *0 o0 Q, W& T8 }& U  B/ c" V
  7. *   This file contains EDMA3 Test code.
    $ d9 O0 g& r* G& X1 V
  8. *: s2 _  \3 J) h; C+ j. m: G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 p# C6 ~; U) H. R, e9 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 n" R( k2 n2 K3 J$ W
  11. *         TO CHANGE.* a' R, _) z( T5 u" S4 [3 T
  12. *4 `! X" a" @9 x- _" m/ o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 o# h6 u8 R7 J4 q
  14. *
    5 s$ P. u' v2 E, q$ m6 x
  15. * This program is free software; you can redistribute it and/or
    ; b7 k3 ~# q3 F, f( l
  16. * modify it under the terms of the GNU General Public License as
    + W6 p6 s- Z) c4 N% i# f
  17. * published by the Free Software Foundation version 2.
    / c* @: \: j  ~8 i+ _( ?9 L9 I
  18. *
    * M. t+ S' T) C. Z. F( b( L) G' }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 ]+ [4 s8 I6 @9 m/ {
  20. * kind, whether express or implied; without even the implied warranty/ n! l3 p- T0 |$ r% ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 ]) a1 h8 A* w$ m+ y- {
  22. * GNU General Public License for more details.  p1 V6 r+ ^% B2 P" A! |  w
  23. */
      u% m$ J$ ?/ B* a5 s/ l. P: r1 i

  24. 2 x# c# e! n4 C  k
  25. #include <linux/module.h>: c' k) J) F5 p
  26. #include <linux/init.h>
    # p, `5 _- v$ w% F
  27. #include <linux/errno.h>! |9 }9 V2 {: G; K$ o
  28. #include <linux/types.h>
    ) N3 s+ n) Y$ C* |4 G$ Y* _: V
  29. #include <linux/interrupt.h>8 b5 k" K6 T# Z/ }
  30. #include <asm/io.h>( b5 u/ Y; a0 E5 Y" o$ E# A. {
  31. #include <linux/moduleparam.h># b& ~  ~2 f' e  ?3 H
  32. #include <linux/sysctl.h>
    4 B& K5 ~( u) t1 |( o- v2 q' ?3 f
  33. #include <linux/mm.h>. ?; s5 H; }) @( e0 v- H
  34. #include <linux/dma-mapping.h>7 W, T2 x: j# n5 A# B4 ^
  35. 6 j( K& a, H/ O' t
  36. #include <mach/memory.h>- R/ ]+ N1 f  \9 \5 B3 I- {
  37. #include <mach/hardware.h>+ g$ Y" z6 b3 U! p- D
  38. #include <mach/irqs.h>
    5 j: {1 W2 K: h* s9 d0 U( d# Z
  39. #include <asm/hardware/edma.h>5 g# Q  A  H% h* x  o) L

  40. 2 c& z. U/ U8 q/ t" D' `# d  x
  41. #undef EDMA3_DEBUG7 b% m7 R, N! x, P$ c7 v
  42. /*#define EDMA3_DEBUG*/# k; O+ ]. |: t; x7 w. M* H( W
  43. , i& Y1 Z! J+ E' q4 g3 I
  44. #ifdef EDMA3_DEBUG
    8 y5 h. V5 R$ h: a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - t/ w% p6 ~6 ?+ t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 `/ S  W, r4 T$ g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 R# R, l( m" u1 M. L
  48. #else
    ' \( s  B, x/ K5 s/ x
  49. #define DMA_PRINTK( x... )5 w) ?8 B5 a7 O0 C/ q
  50. #define DMA_FN_IN
    - f, Q7 c) z+ @" g4 q0 Q' P
  51. #define DMA_FN_OUT
    - V8 l, [& c- B% t* P0 j
  52. #endif
      i6 G( @% h8 i; i
  53. + H9 X/ }! ~0 L; G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). @' M+ L' \+ F1 ~% _/ s
  55. #define STATIC_SHIFT                36 g3 K3 ?5 L( ]$ s
  56. #define TCINTEN_SHIFT               207 p+ g5 b$ b1 N7 W" a4 |: M  E+ e
  57. #define ITCINTEN_SHIFT              21: T, {, X$ r: ^0 N- [( S7 a5 o) M
  58. #define TCCHEN_SHIFT                22
    & x# B; v1 X' s
  59. #define ITCCHEN_SHIFT               23
    5 u8 {6 o( Y! t: `4 p& J* X% V

  60. 8 f7 K$ d. B: X# o, y/ [5 R
  61. static volatile int irqraised1 = 0;
    3 Y, n2 ~) J: U/ @
  62. static volatile int irqraised2 = 0;( j' {1 v6 E/ t2 x& S; |
  63. 5 h. ?: D1 \! i- ~) g* D, D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ W5 |6 o( U& I% x  H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; X; }9 f+ w7 ?- T! [. k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' j) y% w) V6 x7 v# C

  67. / \6 P$ n6 j' r: z1 Y! l, x) C
  68. dma_addr_t dmaphyssrc1 = 0;
    4 [8 k( P0 w) P" X4 p2 E7 A' L+ ]7 B
  69. dma_addr_t dmaphyssrc2 = 0;
    ; B* r4 K- b0 s7 @
  70. dma_addr_t dmaphysdest1 = 0;
    / R$ V; _3 B9 j* D* n, N: t
  71. dma_addr_t dmaphysdest2 = 0;! [& |0 y4 F* L) Z/ C& ?: i
  72. * g  l1 b1 ?) R
  73. char *dmabufsrc1 = NULL;4 d% K+ W  O4 a$ q" z
  74. char *dmabufsrc2 = NULL;
    & ]) u+ Q' P$ M2 ?. g2 w
  75. char *dmabufdest1 = NULL;& T9 h" T6 W- l. j9 @
  76. char *dmabufdest2 = NULL;( o( c" s, O) Q; _& M0 x6 z
  77. 9 }6 V* h0 ^& Q5 d  |! \: r
  78. static int acnt = 512;
      d1 v' m0 T" z4 [8 k3 c" ~+ \
  79. static int bcnt = 8;
    7 c: p- q. G8 ~5 n
  80. static int ccnt = 8;! j6 Q) T  _3 A5 z
  81. 5 }( v( u4 q2 X% |* V* Z8 Z. `
  82. module_param(acnt, int, S_IRUGO);/ F9 _" e6 E1 F! s8 h$ C! ^
  83. module_param(bcnt, int, S_IRUGO);
    ' Q. k' T5 N4 h! X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 d2 _/ b0 u7 P- t; [5 H( J
5 z4 L( ]4 v5 n: p6 Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 L3 B- f: T; l1 z) Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% U+ \5 O- G% R8 C6 }* y4 m. L2 v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' f) v, _8 e$ g9 k# ?5 p( C# h- v
. [; h+ W( K# g3 |' ?

2 w( l' ~; `+ D, _6 u0 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 18:16 , Processed in 0.039137 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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