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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 k4 L) V/ }# T+ R) Q( g
  1. [code]EDMA sample test application
    % |8 R+ m6 Z, T0 Z: R
  2. /*
    / {4 u% V3 O1 d2 Q( Z, f0 ]
  3. * edma_test.c" H7 a4 V$ F: B3 d/ @4 \
  4. *  G: Y6 A1 A1 T9 c. v
  5. * brief  EDMA3 Test Application* H9 Q% N' d1 p: }5 }
  6. *3 i) O# ?- ?# X3 v; }
  7. *   This file contains EDMA3 Test code.' F. v( I4 ~- q7 b: ~2 N
  8. */ `" g2 Y+ q* ?# B% @; u/ W& c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 \' ^7 L" O1 n: y  ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 V6 [  s$ c) n7 U7 ^% V
  11. *         TO CHANGE.
    9 R- W! n( q9 E" t9 ^' W
  12. *
      f0 ?3 _* N) r( m! u) B1 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 _& |" h( h9 \
  14. *1 M7 x8 T- [8 j2 T* X. y1 e# @% w
  15. * This program is free software; you can redistribute it and/or
    " y9 `0 Z+ f* [+ d( J7 v
  16. * modify it under the terms of the GNU General Public License as
    : I4 [2 K' ]* r2 b$ C
  17. * published by the Free Software Foundation version 2.: }& l7 D, z% H% ]7 P' M& x: v. R9 T
  18. *
    & {. u* |( O; O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 r% f" |, B; y- N  w% T
  20. * kind, whether express or implied; without even the implied warranty
    % e/ z* X( s: I) b( n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 k$ u  K/ N8 y5 }& h
  22. * GNU General Public License for more details.% i3 T2 b& i- M! N* J8 J
  23. */
    . ?( F8 s+ d( v/ L" n

  24. / z3 M- c! |' l0 x/ c' ~) C
  25. #include <linux/module.h>) p4 a( E  W; e
  26. #include <linux/init.h>
    ' _" V: q; ^- A6 P# V8 s7 ^
  27. #include <linux/errno.h>% u( ~. \* y" x+ r" C; ~& f3 H
  28. #include <linux/types.h># r! ?+ `+ L2 ~. T# R( i0 r
  29. #include <linux/interrupt.h>
    . v. a) K6 ]: W8 I
  30. #include <asm/io.h>
    # [6 S: u4 g# N7 `: u
  31. #include <linux/moduleparam.h>1 @1 M* ~" v# M- C( S/ W
  32. #include <linux/sysctl.h>
    5 u' x1 P& W$ Y4 q  E- `7 n7 z
  33. #include <linux/mm.h>' Q9 Y  P) e$ ?4 i$ M
  34. #include <linux/dma-mapping.h>
    , d0 a9 b9 T* J/ Q8 M; L( X! @+ }+ z

  35. 4 h8 h& G. {. m2 {( @; k) z
  36. #include <mach/memory.h>: R8 h: d2 F9 B; ]
  37. #include <mach/hardware.h>
    & c" h0 B2 U4 L7 U) A1 q/ t
  38. #include <mach/irqs.h>
    9 n% l0 e( F4 p# F/ b/ c5 V
  39. #include <asm/hardware/edma.h>2 L2 a9 |( l& e8 V, A, k. c% I

  40. ! J+ Y  n: ?) [# t6 p& o+ R
  41. #undef EDMA3_DEBUG, c8 ~9 j3 M- T5 A
  42. /*#define EDMA3_DEBUG*/
    - F! H. T5 w' U  K
  43. & T  n( Q8 x9 N5 M$ U( D7 w
  44. #ifdef EDMA3_DEBUG
    - O" C) J! K% f3 a- C  x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); Y% ?7 E# L. M# Y  i7 O" t  O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & f8 G% K7 J1 f4 M. i  n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 N+ ]" }# ?4 q' }4 a# n
  48. #else
    5 W# X- S# B* q+ b! O3 W
  49. #define DMA_PRINTK( x... )
    " C: \; D( a$ C
  50. #define DMA_FN_IN; _8 C0 ]' n7 i7 q
  51. #define DMA_FN_OUT( J; v0 Z* ^7 G
  52. #endif1 T7 I2 ^6 R# s8 G

  53. 4 p* ?; I; ~: V: X/ K( @2 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( o, L3 y! H! s# t) Y
  55. #define STATIC_SHIFT                35 A0 F+ o: {6 ~" @- U0 K5 p
  56. #define TCINTEN_SHIFT               20
    $ X, Z" h% A' x! T9 [" Z
  57. #define ITCINTEN_SHIFT              21! c& A: I- c: N! x
  58. #define TCCHEN_SHIFT                22
    4 Q9 y& e6 G8 Y9 }. z2 r# P
  59. #define ITCCHEN_SHIFT               23
    8 R' U9 I) X( {2 P1 [7 ]  m, [7 N
  60. 9 {, C1 p) j9 t0 x
  61. static volatile int irqraised1 = 0;# W4 J  `& o# f2 Y
  62. static volatile int irqraised2 = 0;
    - A8 d3 X& ]7 W7 C/ J

  63. 2 m. o" a& |- G# a4 i8 O$ K% a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% i$ H3 ~" d! |) b% v8 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 w$ i- `1 w& x+ k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 k( _$ x- g+ G0 Y( }  h+ U: e
  67.   L" E) S1 l% [8 t. H+ |* b
  68. dma_addr_t dmaphyssrc1 = 0;
    3 K- ]5 K5 p* o- J3 [8 b
  69. dma_addr_t dmaphyssrc2 = 0;
    : T8 u; D' `# F: J+ T, i
  70. dma_addr_t dmaphysdest1 = 0;* I1 M2 ~& i5 H/ r. P4 S, A5 b
  71. dma_addr_t dmaphysdest2 = 0;4 U$ i8 G9 \$ P9 w# A

  72. 6 I3 @* A! o. y" H: ^* u" O9 g/ ~
  73. char *dmabufsrc1 = NULL;
    4 l* M  P. T! U+ i
  74. char *dmabufsrc2 = NULL;6 ?  [# q/ @/ x: |- h8 a$ @
  75. char *dmabufdest1 = NULL;: {( K) Z; \7 {8 }' S6 ^# D
  76. char *dmabufdest2 = NULL;; l& B! C4 w% t
  77. ( G4 U6 Z0 X: L0 o" p6 ~
  78. static int acnt = 512;
    9 T4 v- l) {$ t" w8 X
  79. static int bcnt = 8;! x, G# F  A0 K
  80. static int ccnt = 8;3 R' R7 L8 G$ ]- r& D  {3 c

  81. 1 Z& V6 k' G+ E0 n  j
  82. module_param(acnt, int, S_IRUGO);, D! O  N+ F! a7 I, {. ]
  83. module_param(bcnt, int, S_IRUGO);6 m7 j. o9 `5 z9 s/ c' h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; p, {. Y" U" O; U0 ]& I' I5 h, y+ x( ]: K# h; m, c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* ^# s6 ^7 b6 Q/ ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 H0 ]; Q2 L# q  I9 K4 l2 E, m1 O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 F/ O. p! I; x- A. U
1 A% t$ s3 C) q6 l- ?' h

  M+ Y8 R$ H# N2 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 14:05 , Processed in 0.037766 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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