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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 ^9 W6 ^, l3 s
  1. [code]EDMA sample test application  W# s+ u, |6 p0 H. D# z6 D
  2. /*' X6 i( }' S3 L! N; t$ |
  3. * edma_test.c
    ! R: d9 Z8 G. \( f
  4. *
    2 ^: t# |; w7 e7 T  `# G
  5. * brief  EDMA3 Test Application; ]6 L% g- X$ ?& k4 a
  6. *
    2 s: O9 B! n' q1 c
  7. *   This file contains EDMA3 Test code.5 b* x+ M- N* b9 l4 G2 k
  8. *# U  \& l' B6 W5 H# ^3 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 i" ^, N7 X2 P9 b) r+ S. Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 D1 ~  i' Y, v2 n2 K
  11. *         TO CHANGE.
    ; L5 v% \0 i6 v* w: ^* K8 U7 e
  12. *
    * @& u7 Q, K- L5 G& \. X4 E* C  @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, L6 c- p2 M# Z: A$ B6 `
  14. *
    % M8 b% g" r7 h/ K5 w0 i
  15. * This program is free software; you can redistribute it and/or8 l9 U+ @+ K# D) E/ F/ H
  16. * modify it under the terms of the GNU General Public License as# w0 Z8 D# M; ]8 ?1 t
  17. * published by the Free Software Foundation version 2.8 H* {# _2 L$ ^, v$ W# }* J
  18. *
    : O9 i2 b* }  {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. A% r  O+ E) J* u% r2 `5 @2 q
  20. * kind, whether express or implied; without even the implied warranty% K! H8 ?/ E; M0 y5 f. _9 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 E; f7 t6 I4 o6 x9 z; P
  22. * GNU General Public License for more details.
    ! y2 h; W& o9 H2 R. @# e
  23. */
    2 B: F; ~  b( U8 F- V

  24. 5 ?9 e+ }; X8 w+ X' N
  25. #include <linux/module.h>4 |- ?( e' f  e- q% F: Y
  26. #include <linux/init.h>: B. [2 o! Y, V. s- x# j5 }
  27. #include <linux/errno.h>" X2 L2 L3 |) s* X0 Q7 M
  28. #include <linux/types.h>+ z, F8 e0 O3 b& u$ |; T
  29. #include <linux/interrupt.h>
    ' X. ^( o. R& M+ Z* g* y
  30. #include <asm/io.h>1 b+ `6 j) H  j$ q8 n( t( ^
  31. #include <linux/moduleparam.h>; F% Z0 x7 y4 W5 F/ M& E
  32. #include <linux/sysctl.h>( a. m$ ^, r( `/ T7 \
  33. #include <linux/mm.h>
    / M' B3 X  L7 s
  34. #include <linux/dma-mapping.h>
    - g! }$ o9 A8 u( |$ A2 Z

  35. - \' J0 m7 @- a+ \2 {
  36. #include <mach/memory.h>2 \6 i1 e1 S+ r, c) n* C
  37. #include <mach/hardware.h>
    $ d( a( h: ^2 K0 F: A. t
  38. #include <mach/irqs.h>3 Y( V) V- t' [: n
  39. #include <asm/hardware/edma.h>  G; o. l  ?- P0 z

  40. ' b$ e1 V$ K# o- v6 s) o7 Z
  41. #undef EDMA3_DEBUG9 |' x1 v' q  G, w; j# p& h( p0 V
  42. /*#define EDMA3_DEBUG*/6 h! P7 R& W  a
  43. . N- Y9 e; q9 H7 X7 B# r2 s6 g
  44. #ifdef EDMA3_DEBUG
    7 b, E$ {! _6 |) h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 Y! E2 g( v3 @# y9 j% H2 L- y* i9 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 G8 M/ p$ E8 D4 {/ H3 g3 h: L& X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 b/ E% j( v% N
  48. #else3 Z: N& K0 ^9 w; t4 p$ s
  49. #define DMA_PRINTK( x... )
    7 d' G) V7 W% V, ]0 L5 X
  50. #define DMA_FN_IN& U) u: v+ w8 A  J
  51. #define DMA_FN_OUT
    2 {# @* l2 d! l
  52. #endif
    9 w* E: j! c/ ]9 L
  53. ; ~3 |; C6 c* d7 y# \$ g; w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 c* g$ U. O" x( P
  55. #define STATIC_SHIFT                3% f+ K7 P+ h3 r
  56. #define TCINTEN_SHIFT               207 Z) B8 f: M; K+ \
  57. #define ITCINTEN_SHIFT              21% m1 Y+ P2 V7 C/ w
  58. #define TCCHEN_SHIFT                228 o* X( Y2 e9 p1 N6 |+ B! J
  59. #define ITCCHEN_SHIFT               23
    1 B1 s+ C8 E& A
  60. 3 F) B& g( Q4 \3 T& q( m: ?8 {
  61. static volatile int irqraised1 = 0;6 W8 _) U% c: Z
  62. static volatile int irqraised2 = 0;  I+ P! ?% u9 Q

  63. ; u3 {' P/ f& e. k' Y6 w9 k3 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 i- \; p- @  ^* M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 j9 k: K- X' z! H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; a6 F0 _8 A) d* Q

  67. ; ]# Z% i/ R* ]+ p+ L- @- d/ W# r
  68. dma_addr_t dmaphyssrc1 = 0;
    9 s3 Q! k0 o# q3 o$ B4 T& Q
  69. dma_addr_t dmaphyssrc2 = 0;
    9 O9 e1 Y, g  l  j+ a
  70. dma_addr_t dmaphysdest1 = 0;7 f: d( A" i( @9 X" I& k
  71. dma_addr_t dmaphysdest2 = 0;" S- u( ]; L% C# e1 @( }% r7 B* l5 ^

  72. * ?  d5 a. c8 y# t' J6 c; P' p5 A
  73. char *dmabufsrc1 = NULL;1 Y: v' U, F5 U' W" l
  74. char *dmabufsrc2 = NULL;7 W8 N+ R5 W4 P! N0 `  `4 S
  75. char *dmabufdest1 = NULL;
    0 d+ _! e1 e0 H! D( V3 g5 i
  76. char *dmabufdest2 = NULL;8 C9 J0 U4 \- _8 b  q

  77. & Q: ?# f2 k3 O3 Y
  78. static int acnt = 512;
    9 y0 j' v/ {3 t: I9 D5 w0 g
  79. static int bcnt = 8;
    : g/ r# B  b4 G3 y- L
  80. static int ccnt = 8;
    % h, T2 r% J( l" g- q8 M: R9 i+ n" g

  81. ) ]6 _& M5 N! F& L+ N/ O% x9 c
  82. module_param(acnt, int, S_IRUGO);* z1 V7 j4 ~/ B7 Q
  83. module_param(bcnt, int, S_IRUGO);
    - x  [2 b3 u/ W) z: y, x# S( ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# L) \/ U: \1 B$ P: _3 g7 q' [; T: v
1 S1 l' }, m9 f4 [- T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ _1 Z2 d1 m& X- N4 M- ^  Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: A! }" O) Q* {: u" S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( _' I; l6 @" F/ C

1 R! p0 X  a5 y6 P5 ^2 y9 t% m6 z" H% O" r5 n- A: O7 E  A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 09:24 , Processed in 0.044396 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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