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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 N" h1 @; t) ^8 U
  1. [code]EDMA sample test application; }. F. s) ?# f
  2. /*
    6 N$ @" q: {! E8 o, ]1 Y
  3. * edma_test.c
    6 r) a/ j) b8 e+ V# w
  4. *
    9 P0 y! Y9 M3 `: X! u
  5. * brief  EDMA3 Test Application
    ' }. N8 C! I" h+ q
  6. *9 c* D5 x+ E4 q$ D- i
  7. *   This file contains EDMA3 Test code.4 D2 X- w$ G: e( ~# S0 g
  8. *5 ?! v. H; V. `" w# F8 P8 }% H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) I/ V- E9 u" E8 |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : @6 ^8 G# I+ w! C6 r; X+ x
  11. *         TO CHANGE.
    1 U. A; i" h7 ?. ~$ u7 `+ A
  12. *5 k( K  d9 v7 }7 ^8 _& U  Q7 |( L( w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * V& `3 k2 j* ^
  14. *
    4 h5 E* x) p. S: [* |
  15. * This program is free software; you can redistribute it and/or  ~' w7 l( P* \) o8 I* P( m/ Y
  16. * modify it under the terms of the GNU General Public License as* }7 x! t2 u2 S8 Y( T
  17. * published by the Free Software Foundation version 2.* r  A" C3 f; F: v. r
  18. *
      s) {* X4 B8 ?" u9 _5 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( \$ f$ [* [6 _9 f$ [
  20. * kind, whether express or implied; without even the implied warranty" e; x4 f* B2 c( O( z% k; B( n( u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ m/ D+ s8 F+ x2 n" a. W3 x. Y: Q  x
  22. * GNU General Public License for more details.0 b* {; C: k5 l6 B: t, P) N
  23. */+ i/ E8 b- ^6 b- q* R
  24. $ ~+ }, M) D: V! f
  25. #include <linux/module.h>+ q/ V9 u/ H  R! |+ g
  26. #include <linux/init.h>
    " W- z6 ^% L0 i6 E, X. c8 M
  27. #include <linux/errno.h>
    9 o- }& a. Q7 X1 K$ k: M0 P
  28. #include <linux/types.h>
    # _; `9 y( c+ F4 M
  29. #include <linux/interrupt.h>! j( i5 ?6 ~. U
  30. #include <asm/io.h>
    1 v1 G$ T! r- v& p7 _/ I2 ~. z
  31. #include <linux/moduleparam.h>5 K/ y. Z' q: Y1 A4 s' ~) Z0 q. y
  32. #include <linux/sysctl.h>
    ' H; E3 c+ C5 ?9 s6 v& N6 _! A* ~' Z
  33. #include <linux/mm.h>% R( U  H9 M- }
  34. #include <linux/dma-mapping.h>2 H0 b5 D! n" C

  35. 2 _0 p. a9 _, \
  36. #include <mach/memory.h>/ ~% E% f( s" M3 G4 ?* Y
  37. #include <mach/hardware.h>
    8 `9 R0 c& P0 c7 k
  38. #include <mach/irqs.h>
    4 A6 N) _1 W! d0 k, ?! Q0 L$ J, p
  39. #include <asm/hardware/edma.h>
    + {; G9 K' c# |, D- l8 ?

  40. : n/ U9 J* [0 y2 d5 j* z7 v
  41. #undef EDMA3_DEBUG! F( e6 U/ \) D- t) P3 w) I
  42. /*#define EDMA3_DEBUG*/
    ) ]" [% c; q) L* ^1 x; Q& Q. K

  43. / h- g; x4 y) F
  44. #ifdef EDMA3_DEBUG  W8 E- X  `' ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- P. S  M9 U) ~& c5 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / Q% I) j6 Z: N: Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 [$ {) z2 U7 w; n1 E: q: C" i  O
  48. #else
    ' K. J- c( h+ ?7 y) z' I
  49. #define DMA_PRINTK( x... ), H6 Z& ]% H0 j9 b8 [* l# T( @
  50. #define DMA_FN_IN% o7 \& n; k( {( O- T" B- D% [3 n3 V( e
  51. #define DMA_FN_OUT6 z( T% o4 P: P0 A& B! Q# r
  52. #endif- h/ i- ~( T1 w: }
  53. ; V: Q+ }4 X" D* b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- _) J* N7 z+ A4 b
  55. #define STATIC_SHIFT                3
      ]- T( m, i6 T2 a9 c5 F. |% u
  56. #define TCINTEN_SHIFT               208 a, n4 |! t0 D  ^" A
  57. #define ITCINTEN_SHIFT              21. a% r' y1 F6 C- @8 `
  58. #define TCCHEN_SHIFT                22
    - \: U6 h( H2 z1 X& o
  59. #define ITCCHEN_SHIFT               230 k/ X3 Z: A- a3 Z  ^. X

  60. , ^& B8 W% k. u4 E1 P' T
  61. static volatile int irqraised1 = 0;
    " G) ]( R1 W/ H, F$ j! i: B
  62. static volatile int irqraised2 = 0;
    / O2 Y* L) T- b# w3 i

  63. 1 t" Z$ W: M/ X2 j7 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ~$ e/ d5 R9 O7 F: @' \4 ?$ ]# F' c! ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' a/ y( Z/ f, a2 i$ p% _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 v' I* Y7 L9 I5 c- B# s$ T- d
  67. + P) \0 N3 ^3 A  w% X
  68. dma_addr_t dmaphyssrc1 = 0;
    ) }: t, ?( s# B0 m
  69. dma_addr_t dmaphyssrc2 = 0;' V! d9 w' j% b9 q) V) n
  70. dma_addr_t dmaphysdest1 = 0;
    / r- e8 X6 `. x2 H' Q  v/ F8 D
  71. dma_addr_t dmaphysdest2 = 0;: Z6 O+ n+ d2 Z8 X) e# v
  72. 0 S- Z6 @7 ?3 _3 _1 o
  73. char *dmabufsrc1 = NULL;9 Q  o2 g7 v& {" g1 q
  74. char *dmabufsrc2 = NULL;
    . J' a! H7 O! i6 N2 g/ N, J
  75. char *dmabufdest1 = NULL;
    % p" n0 q4 b- f7 G; L7 \
  76. char *dmabufdest2 = NULL;8 O: O  K" A) t% \0 Z8 }! C" k/ U0 o

  77. . S: T$ G* W! m* B
  78. static int acnt = 512;* c* x  x4 e1 i. S, B. e
  79. static int bcnt = 8;
    , o7 |& H) k  f4 o9 L8 l
  80. static int ccnt = 8;
    5 ~; \1 d0 P, e, _/ u  M, M5 ~

  81. ; X9 b" B6 X% y5 r/ `. S2 _5 r
  82. module_param(acnt, int, S_IRUGO);1 W( ]; C+ w/ p9 q
  83. module_param(bcnt, int, S_IRUGO);
    , x  }" K+ t' Q1 @5 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! o- x1 N: F, }/ W/ q- r; I. k& o( s3 b' m5 I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. P! ?4 e+ n; d/ d4 yarm-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 P) w) _/ ]& P7 X  k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 U6 m1 R2 Z* t3 v9 @2 t
! R$ y. w6 V: x% |1 f/ `7 _. o( W  L
: p$ t  D3 T0 ~4 ?, S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-17 16:59 , Processed in 0.045007 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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