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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# M$ n# p2 K* o( T( W6 e' t
  1. [code]EDMA sample test application
    & O/ Z7 Q8 w7 M9 g3 O
  2. /*
    7 w  n* v6 K1 V  P" A# ~
  3. * edma_test.c
    1 z: M! V$ H; W5 o6 j7 f1 _
  4. *
    ( u% H5 M9 R# n* H  v' c6 W
  5. * brief  EDMA3 Test Application
    9 n$ j8 G! e" n
  6. *7 `& p6 s2 w; B8 q, r2 L2 H
  7. *   This file contains EDMA3 Test code.6 U4 f* k& _+ y' I: l( j
  8. *) ^7 ]% y+ ~2 F6 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" m1 [2 q4 l- Z  E! ]5 t. v2 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 P; m8 x0 ~! H0 n) G4 M- }
  11. *         TO CHANGE.
    / J. {2 E3 J9 U8 C4 u$ A
  12. *$ Q3 j, G$ R# c) t# Z" W& |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; }6 i: L+ D/ E7 \- m& w: @
  14. *& T# X3 R- h0 P) f; M* ]0 L
  15. * This program is free software; you can redistribute it and/or7 p; d9 [3 v0 t6 I5 Y, n. f
  16. * modify it under the terms of the GNU General Public License as
    4 R3 L2 f* t1 C9 y% S- G
  17. * published by the Free Software Foundation version 2.; D0 C( }" N* O$ l; v; i
  18. *
    : @& x6 o4 f$ H" X: Y5 I8 }% f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , \) |' t, K1 Z7 ~6 ?( \
  20. * kind, whether express or implied; without even the implied warranty
    6 A: @1 o* [2 ]3 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 q; I; J' u3 H& R+ r) m
  22. * GNU General Public License for more details.# U) }3 Z# K- e, `* V  X
  23. */7 i0 g  @/ A1 S" [
  24. 9 i# E4 n' M6 i4 ~/ l
  25. #include <linux/module.h>, B: n8 c+ N/ J3 [% s/ |# {
  26. #include <linux/init.h>
    - Q5 _$ S5 L) C, K& S8 F! m
  27. #include <linux/errno.h>; Q- q2 c1 y1 \. I7 j
  28. #include <linux/types.h>( O  U! P$ S" B' d
  29. #include <linux/interrupt.h>+ @% O* Z7 |0 q) W% c0 n: b: S
  30. #include <asm/io.h>
    - ~  M+ g( M; Q8 R( ~& g
  31. #include <linux/moduleparam.h>+ k7 T* F7 O% w4 Z
  32. #include <linux/sysctl.h>3 S4 K) H2 {8 e' v  S/ n8 M
  33. #include <linux/mm.h>! p( ~0 m$ V' ?; q0 u
  34. #include <linux/dma-mapping.h>; V  p9 G/ |: M1 E' H: y
  35. ) X/ Q0 X; P- L# ?$ j. o
  36. #include <mach/memory.h>
    / a  z  D7 \8 i0 N9 J& w# ]* d
  37. #include <mach/hardware.h>3 n: o. a8 z# S: w
  38. #include <mach/irqs.h>- B5 L' v! s0 {$ X8 s
  39. #include <asm/hardware/edma.h>, W# u5 x3 a2 E- m' C, L# y
  40. ) c/ J# \7 ?4 u
  41. #undef EDMA3_DEBUG( O: i! q5 R8 ~" N; o* @8 w
  42. /*#define EDMA3_DEBUG*/4 {8 C5 w  m1 I& x

  43. ) i+ g1 {# A: J
  44. #ifdef EDMA3_DEBUG4 V, B: o# }$ a. W( @( A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" r- ~- c+ _2 i" r6 {0 y6 b' `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* s. U, m. B2 g2 l' {6 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! Q: N- [; X9 M. e# V0 ~7 `
  48. #else7 K. ~" l: E" X/ F2 x) {, l' l1 @
  49. #define DMA_PRINTK( x... )
    + m, t. h% w" K
  50. #define DMA_FN_IN
    * V  n) m3 g! w. N4 a; |& K
  51. #define DMA_FN_OUT
    / P4 b! j+ |0 ], p
  52. #endif
    + @+ c6 h0 h- L( {1 D- b

  53. ; z2 c4 c" h0 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), J& V7 ~$ T; ^  {. t) ^  G8 c
  55. #define STATIC_SHIFT                36 T  t1 I  z" _+ W: v3 }$ u
  56. #define TCINTEN_SHIFT               20
    + w0 z2 E" ?, }6 C
  57. #define ITCINTEN_SHIFT              21  J4 a( S0 i: b- A9 ?
  58. #define TCCHEN_SHIFT                22
    # y; e0 P" I5 O; c' U' U/ c5 d
  59. #define ITCCHEN_SHIFT               235 b) D, ]1 W2 F  ]$ f
  60. ) g: e( x3 }5 h" e2 R5 l5 v
  61. static volatile int irqraised1 = 0;
    4 @/ e3 K" r  n( J' Z2 Z3 m. e. Z# u
  62. static volatile int irqraised2 = 0;
    ' k3 V4 ]5 P6 w% ~

  63. , s4 R4 `1 ^2 u# u! l  ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) j# Z* D2 u  e( {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 y; b9 I( \% G9 ~5 ~; _, I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 Q' h9 |7 x0 F( C* p

  67. # F% D* x5 m4 T
  68. dma_addr_t dmaphyssrc1 = 0;
    ) Y$ k' t, n7 F" a. u5 F
  69. dma_addr_t dmaphyssrc2 = 0;
    . j5 E6 t9 a; \4 V! S) E* }
  70. dma_addr_t dmaphysdest1 = 0;3 E% b! u! r% M8 z; c0 Y
  71. dma_addr_t dmaphysdest2 = 0;
    # Q/ _+ }, |2 W- ^9 d7 Y0 F

  72. - C# p; S# H1 B( {
  73. char *dmabufsrc1 = NULL;% F/ o$ h' E2 B& K* y
  74. char *dmabufsrc2 = NULL;3 E9 d0 \; p  p  [4 ?
  75. char *dmabufdest1 = NULL;& D. \# ^* N' ~: _6 g2 J7 ?& \+ }
  76. char *dmabufdest2 = NULL;
    + |8 K& v5 L9 ^1 r; r

  77. ' r/ E" e/ D* a7 z
  78. static int acnt = 512;
    5 o$ j0 `" J# M% l( [" n
  79. static int bcnt = 8;
    / p' j, E! W' x
  80. static int ccnt = 8;
    : t( K& y( X- }7 Z& H

  81. 0 p. v1 F% k8 F$ `7 S
  82. module_param(acnt, int, S_IRUGO);
    9 f  O6 K: B$ x0 ^
  83. module_param(bcnt, int, S_IRUGO);% ]' b6 \  d6 }, d- S7 j6 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% q$ o8 N8 a- y& [6 q
* }2 A3 q: O) y* k( J8 W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& W- K; U7 S! X$ Y5 N+ j; parm-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! c% s  {; @* }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* X0 ]" c% D; W, G; {4 ]# Y% U4 v. I. l
7 ?# r( U* |% T  w  H' K; N

# Y& J- O5 A0 r; ^$ Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 20:42 , Processed in 0.038552 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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