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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; C2 J/ z' F2 v
  1. [code]EDMA sample test application# K: X% P$ L. M2 N$ X
  2. /*
    - C( T- z7 Y7 s4 h& W4 w
  3. * edma_test.c" b4 S" t: j& B) Y& d& q( }- s, G: [% W) E
  4. *# h* U' X' M% V( y. w2 m( z
  5. * brief  EDMA3 Test Application" e" e  `0 F1 H" J9 H" W: v
  6. *
    . K3 p& K) W$ }  g' Y
  7. *   This file contains EDMA3 Test code.
    ! ?  l+ b+ i* o
  8. *' H1 y$ E% k' ^( c% {# z4 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - B) @2 s# j* `( X2 B+ w' A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 ^% O3 _+ {& V% \5 E6 m8 c$ }$ X/ J
  11. *         TO CHANGE.1 [( e/ B$ ]+ z7 n/ u5 h3 Y: ]
  12. *
    5 K# e. |0 ?+ Q  n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , z7 o% e( m' g  ]7 u8 @2 A
  14. *
    8 a, q, R8 V% V# o9 b4 v" t
  15. * This program is free software; you can redistribute it and/or, c6 g" b; U) r5 b+ h: y, `% j7 x
  16. * modify it under the terms of the GNU General Public License as3 H) m7 D3 @% M7 o4 k
  17. * published by the Free Software Foundation version 2.
    : L1 {! z( z0 f2 R
  18. *+ g& f6 w% O/ F. @% Y7 y0 ~: S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; _, A) m! h; n) q) S
  20. * kind, whether express or implied; without even the implied warranty
    + H6 C$ S: q6 @. v' w6 o& A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. f" o6 A2 {) A
  22. * GNU General Public License for more details.! B6 Z$ S( U6 V+ e+ w6 f1 J  B
  23. */; a/ k4 [' q" }! r' P* A7 e/ h
  24. + k. {2 s4 u: N' F
  25. #include <linux/module.h>5 U1 X* N$ r" @& V$ ?2 K
  26. #include <linux/init.h>& H! m3 L1 p' o' R% u6 k
  27. #include <linux/errno.h>- Q, F8 g6 |& R7 U, B7 ]
  28. #include <linux/types.h>" U2 T1 u" p6 }3 b) a
  29. #include <linux/interrupt.h>9 q0 @7 u8 [  v0 }6 C, S, p
  30. #include <asm/io.h>" V' o( B. G+ i' O+ A" u! v
  31. #include <linux/moduleparam.h>
    & D, ~, m9 P! o9 ]7 P5 @$ D" W; |
  32. #include <linux/sysctl.h>/ Y( ]3 t, _' P# X1 F7 p
  33. #include <linux/mm.h>- Y. D4 T7 t/ X1 _* a
  34. #include <linux/dma-mapping.h>) E# A# \5 ~0 D  h, N

  35. ! F: G) z/ c1 H: x$ P
  36. #include <mach/memory.h>2 E, D. T( G/ E+ Y( b, O) d$ B( F
  37. #include <mach/hardware.h>
    2 M5 j) U1 R7 y
  38. #include <mach/irqs.h>
      ~/ h9 R  Z+ B7 O* W* F0 }/ _# X
  39. #include <asm/hardware/edma.h>
    $ j5 Q5 I/ k: [4 @3 T7 C2 V( C5 r6 g

  40. 1 p$ c4 Z! k& K' b
  41. #undef EDMA3_DEBUG" o. p4 M' c6 ]# H- T
  42. /*#define EDMA3_DEBUG*/
    " m! i. {7 \1 I# e$ M2 E$ S, d; x! m

  43. 7 n  j0 i2 \  h0 B* V
  44. #ifdef EDMA3_DEBUG. o& [1 m; `" h. m- n  }: P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 W2 |/ p9 I$ A& f7 }: z4 J5 e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 u( H4 t& e# j/ E/ A) ?- |1 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 Q1 B" L5 D) E7 h
  48. #else9 G( v/ [) s& I8 l
  49. #define DMA_PRINTK( x... )
    , U8 c9 Y/ P/ ?% |3 A/ v
  50. #define DMA_FN_IN+ v& T. M4 j4 Z
  51. #define DMA_FN_OUT5 X5 S  V/ D9 O0 n+ @3 T7 `* V
  52. #endif
    % ?: M" e5 O: C( z

  53. 7 A) }! K% _; N* z, d2 [& y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . }9 T/ q% G) w+ ~0 g2 m
  55. #define STATIC_SHIFT                3
    * i3 l7 y  S/ Z0 `  O2 t; i; I
  56. #define TCINTEN_SHIFT               20, V4 N. A+ s( @1 i1 g
  57. #define ITCINTEN_SHIFT              21
    / a; w2 F3 u7 s$ O6 z
  58. #define TCCHEN_SHIFT                224 E8 M, @2 }7 _" C3 ]$ J
  59. #define ITCCHEN_SHIFT               23( _, A7 U4 @8 j5 V$ G
  60. ( G2 D' u( ?0 F4 u
  61. static volatile int irqraised1 = 0;
    ( X* m+ r% h8 h7 s4 P* H
  62. static volatile int irqraised2 = 0;" r3 d8 T- K( E7 o+ R, r/ H2 I

  63.   h$ n; O( i% \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 _6 A* G! ^$ T% V9 j* u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 E$ v  X1 _8 o) s( y& d, v/ }  V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . _. q/ X$ w  W$ R( o: ~
  67. 9 O& V; @6 M- L+ X, k, ?1 K* z1 Y$ c
  68. dma_addr_t dmaphyssrc1 = 0;3 I! p; ~$ n2 a, Y" ?
  69. dma_addr_t dmaphyssrc2 = 0;" I' m, H3 ?0 E; w
  70. dma_addr_t dmaphysdest1 = 0;) V5 A# L! I' ]$ a2 P
  71. dma_addr_t dmaphysdest2 = 0;
    6 k( ~; L" g* g& Y6 ?3 Z3 S! T

  72. ! Z2 A. n8 [3 q: x' j  d
  73. char *dmabufsrc1 = NULL;
    - v) i1 d7 C( q, h9 [* R" o; h- U& g
  74. char *dmabufsrc2 = NULL;# q0 ~  t; _9 c0 {4 B1 h6 K# O3 b
  75. char *dmabufdest1 = NULL;
    & C* {) Z2 T# S$ `8 _
  76. char *dmabufdest2 = NULL;
    2 b- n' ]$ [8 B/ V

  77. 1 r4 F9 h8 J2 C' v7 S' b; ]: E
  78. static int acnt = 512;
    ! [; R$ t, P( _- d; [1 |& H
  79. static int bcnt = 8;
    ! \+ R8 ~# A0 W3 F: |
  80. static int ccnt = 8;- A% O3 a4 J5 d( x/ j
  81. $ B! N& N- m. |. ]& R' n2 B* k
  82. module_param(acnt, int, S_IRUGO);
    ( m1 N2 O1 s: z& I
  83. module_param(bcnt, int, S_IRUGO);6 ?, ~: |8 ?, Y" e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 s$ y) R! R' s: ~6 G4 D/ T* _( a: g& b' M4 N9 e7 a9 c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" f  k) H/ K9 n' {) @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ @# y$ A* W* d, [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 t+ D7 R. q0 E" u5 N; X. o- ]

6 E% \( v2 @& V! M% C' |% s& x  r) j0 }- y5 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-12 06:53 , Processed in 0.046187 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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