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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * Q5 @$ B8 N+ h! G2 N7 e9 q
  1. [code]EDMA sample test application4 Y6 O# f; h4 ]" T; u
  2. /*
    ( g0 t+ Z. V4 v& N2 s# G
  3. * edma_test.c' X0 L1 Z. j0 h) X6 f- ?, d
  4. *$ a8 \: ?4 U9 w; l. X4 e
  5. * brief  EDMA3 Test Application* p9 K9 u: j# P( Y5 D
  6. *
      N/ ?; A% |* q% D1 ]
  7. *   This file contains EDMA3 Test code.
    8 G; a+ |9 D4 w- |3 j$ F, o0 y
  8. *
    7 }; ?$ D! A  i  w; N( c2 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 d* d; c7 A9 v  v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & I! _2 l' l6 B. `, }" W+ D
  11. *         TO CHANGE.
    + p' _1 k( x, B/ @5 t1 @" T. x7 N
  12. *& [2 I" {( u" r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 c2 J; n" S7 S
  14. *
    7 W3 ^2 e/ W2 ^! o
  15. * This program is free software; you can redistribute it and/or4 V+ f7 x% {* q! a/ ^0 O  b9 e/ ]
  16. * modify it under the terms of the GNU General Public License as
    & }6 {, g3 ^' I% U
  17. * published by the Free Software Foundation version 2.' }# p9 x) b$ j: G
  18. *
    3 G; p! J# L2 D. @5 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% z. U8 L$ B% a7 U: @* v3 k
  20. * kind, whether express or implied; without even the implied warranty) p7 y  k$ z9 m) n6 ]% U3 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ O4 q' W. N& _! d; R* C7 z
  22. * GNU General Public License for more details.6 U; {5 H# d+ E+ Q5 j$ V$ P2 \
  23. */
    # Y0 r: V: G6 v: u; C$ q- R
  24. - J! D; X. u- y( I; L
  25. #include <linux/module.h>
    7 c  p, U+ o9 L" K- a9 z6 y
  26. #include <linux/init.h>
    + `+ S$ a" k0 o# x4 f- Y$ B
  27. #include <linux/errno.h>
    " [# W; {* p! k( O  w
  28. #include <linux/types.h>
    0 W  z& `1 y5 D2 s5 I4 f& x
  29. #include <linux/interrupt.h>
    0 |! V/ j. u' s, E8 i3 `% j. W0 A
  30. #include <asm/io.h>
    2 D; U6 Y% N* a
  31. #include <linux/moduleparam.h>/ W+ }( S; k5 C* Q
  32. #include <linux/sysctl.h>
    ' p: {2 h! v* N$ j/ z+ ]- |
  33. #include <linux/mm.h>0 n" Q. O0 I# T; I3 D' o
  34. #include <linux/dma-mapping.h>1 E0 q/ f  G, E, ~$ A2 I4 ?! j

  35. * r2 d# @$ o5 j( \& m
  36. #include <mach/memory.h>
    " O! n7 Y: Y3 M8 X- g4 L
  37. #include <mach/hardware.h>, ?' {6 C& G1 e$ j& l
  38. #include <mach/irqs.h>
    8 I+ I7 H# b; }6 p, Q2 [$ c
  39. #include <asm/hardware/edma.h>
    ) k4 T- m  d& B7 X

  40. 5 A. m2 b* `$ @7 E  ?8 N1 O* T
  41. #undef EDMA3_DEBUG$ r6 q8 c6 |2 w2 R8 r
  42. /*#define EDMA3_DEBUG*/
    4 i: |/ c7 S" @' g- t0 n

  43. " K, F  w' {( x8 w* p2 c# f  i7 u
  44. #ifdef EDMA3_DEBUG
    1 I& Y. s7 e5 s( l, r. E* r( S- M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 M, Z) c$ j0 H1 ~: w% G. i1 n. d: Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& W, ?3 b; W/ n( @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 O  p" n( F/ x( N! A
  48. #else
    + `+ a3 |- ^/ i, I
  49. #define DMA_PRINTK( x... )
    ( H/ z7 t* E8 }! Q/ s' ]. D
  50. #define DMA_FN_IN$ O4 O/ ~2 X3 E. s3 l
  51. #define DMA_FN_OUT
    ( f1 p% N( M. I- w6 ~
  52. #endif
    ( Y6 _- C7 n2 z( H9 X' d# I
  53. 9 T% @- |! w' Z" r, @/ d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 W5 M! G: N* l5 l3 S; `& @
  55. #define STATIC_SHIFT                3
    " ~* U9 t; M: e3 y+ I
  56. #define TCINTEN_SHIFT               20* h+ }6 y/ B4 t) ]- x' E2 W
  57. #define ITCINTEN_SHIFT              21! \( i. `; x9 ^" X) e( \# `
  58. #define TCCHEN_SHIFT                22% X& B  L0 r& y: i7 ]2 a
  59. #define ITCCHEN_SHIFT               23# r0 r; p0 ~/ ~0 t3 B. F* \3 @

  60. 4 ]# u' M; {5 a4 O
  61. static volatile int irqraised1 = 0;
    1 C# U% `) A/ X! H- W& g0 e
  62. static volatile int irqraised2 = 0;3 O, M# u; S1 s# I+ C9 ?5 x; _6 H3 r- \

  63. * {4 l' z: j/ K- L7 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; p6 _/ Y9 T! \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 ^4 j+ P( f; O: ^+ A/ t  ~2 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 q% X3 F4 w4 `& E8 I; K' C
  67. & O( M: _2 [" K: s  W% a5 P
  68. dma_addr_t dmaphyssrc1 = 0;. l) V& W. `; T; M" H# G# {
  69. dma_addr_t dmaphyssrc2 = 0;
    ; O" W, a8 X7 z4 Y8 h' q
  70. dma_addr_t dmaphysdest1 = 0;
    + W' x2 K7 c8 N5 z  A; V9 d
  71. dma_addr_t dmaphysdest2 = 0;4 {1 u3 p5 O4 Q* J& X% B8 t

  72. - O; L( B$ T+ B% \" t
  73. char *dmabufsrc1 = NULL;  v2 C, o, N8 o6 X- l. ?8 f3 p
  74. char *dmabufsrc2 = NULL;7 y# Y2 L0 d3 J& l$ Z: X) E
  75. char *dmabufdest1 = NULL;
    ; C& Z3 m* @; k% F5 X' G7 `
  76. char *dmabufdest2 = NULL;  A1 D$ ]# t* o  q
  77. 5 Q) a6 s6 f) P1 D
  78. static int acnt = 512;/ r% T5 Y/ z( _) }$ o& ]
  79. static int bcnt = 8;- J8 p) ~/ V: T( M! I: v
  80. static int ccnt = 8;" |7 Z4 k0 @' l; {: ?4 o& k0 {) S

  81. : g6 G$ h& x* c( ?' E7 A- f4 l
  82. module_param(acnt, int, S_IRUGO);
    + a0 I! a& J0 L
  83. module_param(bcnt, int, S_IRUGO);1 T' [& a5 |) g: p' Y3 X) ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: y- l9 g$ n" t6 ?0 H  f% r8 X3 ]# k- w) }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 n& o0 W( k4 u# \  Q  j2 y( Iarm-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 m* b9 b# X2 ]1 W$ P- a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. h+ M& K) e9 X6 \6 o8 ~
! S1 E1 j# _' L, Z& s
/ ~. {4 i# Q: Q+ {% m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 11:41 , Processed in 0.040951 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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