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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 x  n% a3 D- g* N) l" x6 W
  1. [code]EDMA sample test application
    ; E2 ^6 Q- m/ g5 r! V, B2 T/ O0 ]
  2. /*
    . ]6 u0 B1 A% I. M6 `4 Y
  3. * edma_test.c
    ! p% s1 _$ d9 r8 G9 p1 C
  4. *
    7 |' _% A4 V2 N% c) v# r8 `7 p
  5. * brief  EDMA3 Test Application0 r: h3 _8 A4 m
  6. *- I) q1 E! p4 e; Y; {
  7. *   This file contains EDMA3 Test code.
    / E+ R; U8 R1 D( ?; S5 Z! e
  8. *1 U0 \  {8 |7 `0 v- o5 \1 _' i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 a4 \* v7 f" z4 k4 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 y( [: y8 c- B0 p
  11. *         TO CHANGE.$ @7 o+ }  y. T* [. r2 I. \; z
  12. *
      \- m7 L! G9 e+ w7 T& Q+ U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 v- M# l3 f2 z/ a$ B; L
  14. *
    & Q, z- I8 C1 S5 ^) b( d5 K
  15. * This program is free software; you can redistribute it and/or
    / u( c2 P' o4 g5 H% b
  16. * modify it under the terms of the GNU General Public License as0 F5 F" S3 A! T2 E7 [3 ~
  17. * published by the Free Software Foundation version 2.
    % B+ m& L4 h8 m! r2 Y$ t( b
  18. *
    7 ~' q) }. b0 D5 Y5 B# H% b/ N5 K' @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  J# o3 }8 Y/ E7 L2 ]; j% B
  20. * kind, whether express or implied; without even the implied warranty
    6 C+ Y7 _, n% z! E& O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 S  C+ g- o3 d2 Q2 e! n/ d
  22. * GNU General Public License for more details.
    5 I/ X) A( e4 b: Q. u
  23. */
    ( T$ D/ k- |" X' D6 B9 v
  24. , |$ \* ]" [0 t
  25. #include <linux/module.h>
    3 R& u/ V, N0 t4 V0 m$ X
  26. #include <linux/init.h>
    8 q' [7 X' V' u& u
  27. #include <linux/errno.h>
    - z  [3 k+ {3 J& z
  28. #include <linux/types.h>
    + V  i$ [: F# b/ P- L0 J' b% |6 Z
  29. #include <linux/interrupt.h>$ k1 t( v- S4 v; x% ?
  30. #include <asm/io.h>
    , m: A0 M* \4 g0 A0 q+ g6 M& P
  31. #include <linux/moduleparam.h>
    ; i; l2 `: ^8 r8 n0 l: P2 D9 k
  32. #include <linux/sysctl.h>
    * H7 P/ K) O2 C/ E5 P
  33. #include <linux/mm.h>
    ) _- F. J# _' d# K
  34. #include <linux/dma-mapping.h>% p* K/ A8 t& @# B( h4 e

  35. # S4 m( |( {) D# J0 t0 k
  36. #include <mach/memory.h>
    5 t9 `9 O* Z/ b: Z. T/ s" v; I
  37. #include <mach/hardware.h>
    , V8 l9 C1 D2 U$ d. U4 n7 y
  38. #include <mach/irqs.h>( ^( i! ]$ f- n" T
  39. #include <asm/hardware/edma.h>
    8 ^8 k1 i' B/ O0 |* z

  40. ! H. W+ ^7 F9 x9 Y( ?6 g% n
  41. #undef EDMA3_DEBUG
    7 @* x1 d5 n7 B7 C) y5 [, p
  42. /*#define EDMA3_DEBUG*/
    1 ^/ t# k  P( V

  43. / j6 \0 B+ Q% c6 M' q4 B
  44. #ifdef EDMA3_DEBUG
    " X6 f5 e8 Z! j" `, o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 @6 c! ?" B6 G) c. D* N/ s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * h' _: M+ Z7 o0 ]) p/ O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # E4 N# Z4 [, d8 [4 v
  48. #else5 a6 u, f2 l0 G2 W
  49. #define DMA_PRINTK( x... )& o6 R1 i  b1 d
  50. #define DMA_FN_IN
    , {  Y1 a2 I/ Q' G4 Q
  51. #define DMA_FN_OUT4 O8 X( P9 n' e/ {" q  b7 R
  52. #endif
    1 R; x$ q  W. a* w0 N% X! _
  53.   {# z  a% i! H" B  @0 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . f: K. d, F$ ]! z2 A; m$ w% c
  55. #define STATIC_SHIFT                38 Q7 ~$ s4 o  [6 P& C8 ^+ }: u
  56. #define TCINTEN_SHIFT               209 U  B& A1 R1 N  [6 z
  57. #define ITCINTEN_SHIFT              21  K9 H0 M! \5 P" @9 z7 R& p# O& p
  58. #define TCCHEN_SHIFT                22
    7 `- b% `' _  Y! w
  59. #define ITCCHEN_SHIFT               23
    7 l5 t1 c# ^0 U5 U5 D- A. Q% ?

  60. 8 K; V8 f7 ]7 r1 O0 P
  61. static volatile int irqraised1 = 0;+ B) h7 P! W/ n% I
  62. static volatile int irqraised2 = 0;
    7 k) i! C8 @+ E1 t% l! h. P
  63. 1 E6 V$ S5 m7 @* x. c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 X+ Y1 I) b; c$ l! c8 V: X! V9 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) q$ a/ O, o  D. U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 K9 r# W6 l/ q  K0 g- q) m% I

  67. , e' x, y: Q, F2 n) U& A
  68. dma_addr_t dmaphyssrc1 = 0;0 n  J9 S, J: T4 Q5 A
  69. dma_addr_t dmaphyssrc2 = 0;
    3 y" Q" @0 f, b0 `, x
  70. dma_addr_t dmaphysdest1 = 0;
    ! `6 c2 ~. E3 J! Y; A) \
  71. dma_addr_t dmaphysdest2 = 0;
      b( l. @! m# e& w% @* G
  72. / {  A% N! S# s
  73. char *dmabufsrc1 = NULL;
    6 \7 O/ _$ b. N( S( f3 @; o- J4 L
  74. char *dmabufsrc2 = NULL;$ @9 d- v% j5 j: X0 R+ l" L; d
  75. char *dmabufdest1 = NULL;
    , P6 {# Z1 r3 K
  76. char *dmabufdest2 = NULL;
    3 ~8 r6 d/ }& {0 T
  77. ) _, y& d( O2 g9 n% r3 O
  78. static int acnt = 512;
    1 O, Q' [+ ]$ ?+ m0 M9 D
  79. static int bcnt = 8;* G+ y$ X# _& w3 J' L! V
  80. static int ccnt = 8;- ~) ]; V$ e4 E* F
  81. 2 q' X6 O$ o: g, K) v
  82. module_param(acnt, int, S_IRUGO);
    ; \# V9 H4 {# `+ @3 P
  83. module_param(bcnt, int, S_IRUGO);, p6 w# L0 B2 e0 |0 g0 Q' p# j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ H1 w/ C$ Q5 x: {
1 k2 A, W) e0 _+ y0 D( N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ @1 A! y1 A9 t' m- rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( r9 q- @: C5 Q& r2 ?) o$ x" `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# r3 k# X$ B* `6 |1 y

/ K8 _/ L; p2 U
5 E, L# Y" H# u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 07:48 , Processed in 0.038809 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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