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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- W5 j/ Z( j" Y# s7 {7 \8 g3 B+ q
  1. [code]EDMA sample test application
    # r& `7 w( k* {
  2. /*6 C- [" d8 O& `9 s' J
  3. * edma_test.c
    # r3 I1 u  X$ T# Y3 B7 F+ J
  4. *
    2 t% ^* s1 J( D) Y& ]7 a/ F
  5. * brief  EDMA3 Test Application
    # g+ x, y6 s: a% J% {
  6. *3 T9 K9 H% F( L" h( T; E
  7. *   This file contains EDMA3 Test code.
    $ z, P( }6 s& t( f
  8. *6 `+ Y1 h3 {/ ]( k% z' }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* `7 p, A( o1 y1 k4 M/ |! K, @' E5 X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 [. G$ s9 t. S; f9 m
  11. *         TO CHANGE.- h5 {# M' T6 f2 X' I* d% W
  12. *
    6 T* v; ^) {) i5 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! C; z( S" W1 o7 J2 ~  ?
  14. *
    9 I+ m" D6 K4 m/ {  a9 n; g
  15. * This program is free software; you can redistribute it and/or
    4 ^1 ^; ?' J. j8 t# L+ a
  16. * modify it under the terms of the GNU General Public License as
    # [8 f$ d# J. }8 j. |' y
  17. * published by the Free Software Foundation version 2.8 t# L0 C) u! R3 Z/ a
  18. *
    # l  a! U7 i1 ^4 ~" H7 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , f: v) {1 b- p! l# r
  20. * kind, whether express or implied; without even the implied warranty6 H6 h. ~% e5 O. p" J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " F4 a" m2 M! |2 u  b" |
  22. * GNU General Public License for more details.
    * t. f* @& v4 _6 }" @, `, O
  23. */
      N; _% D1 C4 q9 K9 I2 b, J  o
  24. ) `5 |0 H( Y' k( Z0 j' R8 I" I
  25. #include <linux/module.h>
    ( w: b5 c5 K: l* F) Y6 b8 f1 s- o1 r
  26. #include <linux/init.h>1 ~$ J, W: z6 K$ N+ x( b% l3 |+ b* h
  27. #include <linux/errno.h>
    ' q) Y2 D% S5 E- g4 L1 r* P1 _1 J5 R
  28. #include <linux/types.h>% v: H- p* E: _/ _  ^7 D) y
  29. #include <linux/interrupt.h>
    , a* a3 t0 _3 C9 C4 e
  30. #include <asm/io.h>' E4 T6 v3 U9 V6 i( ], R! u
  31. #include <linux/moduleparam.h>3 c' R! p5 r( L6 n
  32. #include <linux/sysctl.h>" `5 b8 z" `2 p3 O) v+ g
  33. #include <linux/mm.h>: N; `+ N' P- p% M; h1 }5 ^# q7 l
  34. #include <linux/dma-mapping.h>
    ( }) O8 ]- v8 _$ L( K' h
  35. + Q. ], Z  x5 p: a- N0 W" M3 L
  36. #include <mach/memory.h>
    $ N8 i( Y. E; e
  37. #include <mach/hardware.h>6 u! T/ ?$ j1 B4 Q' g
  38. #include <mach/irqs.h>
    8 o! A: E/ i' x9 E4 m
  39. #include <asm/hardware/edma.h>
    ' z; w3 t0 }6 }7 f! s! a
  40. . R2 Z4 N" Z, a5 d$ y
  41. #undef EDMA3_DEBUG
    3 K, M, M" R% B. L" d2 A$ y1 w
  42. /*#define EDMA3_DEBUG*/5 q$ Z" R4 F" G+ s1 x: \! R

  43. . L- u! _' B4 O
  44. #ifdef EDMA3_DEBUG
    , F' w- A0 F( R$ g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 Q" j# ^  d) W1 d, M' v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 M/ }+ l/ `# d; o7 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 j5 M& }" a" T! j. O
  48. #else
    4 X6 H5 D" @9 _3 l6 u
  49. #define DMA_PRINTK( x... ): z  I: S: T6 n4 t9 z6 d; c
  50. #define DMA_FN_IN
    " _( c$ ~0 ], z" f7 d: ~  }
  51. #define DMA_FN_OUT2 h2 i) e: X3 X* G9 u  I
  52. #endif
    8 t7 L/ S5 }; i( r

  53. : S( ?" H6 q# R4 W) j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ x( K! h1 }4 _% c. x
  55. #define STATIC_SHIFT                38 j* ^7 l" Q2 z- V6 u( Y) j7 w
  56. #define TCINTEN_SHIFT               202 ]( i/ `# R$ B% x' {4 A0 H
  57. #define ITCINTEN_SHIFT              21* m1 P" B) j6 ~" N/ r; O
  58. #define TCCHEN_SHIFT                22  i/ C& q; \% K% S
  59. #define ITCCHEN_SHIFT               23
    : o2 V2 Y0 m: I5 X
  60. ; Q+ l* k4 S9 [: {- Y
  61. static volatile int irqraised1 = 0;( D6 P6 L6 w1 l* m
  62. static volatile int irqraised2 = 0;/ F7 @  y/ I2 T, j. Y

  63. # v1 E6 [2 Z2 \3 G9 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 i+ a, q' `6 M% F, r7 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ p* N" V2 w+ y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 C) Q* |5 v# g8 O2 U" i5 |0 N/ W

  67. " f' T% B* H# S+ j& N+ l! C
  68. dma_addr_t dmaphyssrc1 = 0;
    0 s2 w) N/ L; X3 u
  69. dma_addr_t dmaphyssrc2 = 0;
    - L+ }" }8 p& b" k& _3 B
  70. dma_addr_t dmaphysdest1 = 0;4 G% t- j8 m5 ?. M: Y: b
  71. dma_addr_t dmaphysdest2 = 0;
    ' H7 {' D# M2 M7 g- T: K
  72. & ~, }! k% A. H0 f
  73. char *dmabufsrc1 = NULL;9 n- f1 C) Y0 M4 T$ t+ H( x6 G2 l1 F9 T& f
  74. char *dmabufsrc2 = NULL;
      _  X. ^) q( Z
  75. char *dmabufdest1 = NULL;
    , r% s# q" x1 Y/ F0 l9 v
  76. char *dmabufdest2 = NULL;" z6 q( m: a& {! i8 y8 k

  77. ) q4 ^6 X+ h/ b7 q
  78. static int acnt = 512;/ A9 g( E( v% _! r, L: {/ Q0 A
  79. static int bcnt = 8;
    0 c: d' T4 a3 L
  80. static int ccnt = 8;
    9 H2 X/ e" I8 c2 g

  81. / }8 t. w# W' D7 d
  82. module_param(acnt, int, S_IRUGO);& c! @5 l1 W4 o* z% `$ g# P* C) ^
  83. module_param(bcnt, int, S_IRUGO);
    2 _( D3 n8 K0 ~. N% o5 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 V; p% j1 F# z( L* V
8 e4 o1 X& s4 A2 _0 C0 J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; J/ v2 ?8 ]+ l7 p. t8 x3 G5 H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- V2 F" N$ ~6 Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 o( S) J" |7 j5 e0 ^6 ]
3 u, ^+ o' Y3 t. ]5 t" E1 {% s7 y9 J* k: d) a) P8 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 16:38 , Processed in 0.038124 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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