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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* q2 D2 N$ e4 \( r
  1. [code]EDMA sample test application3 q5 v8 P( n, E' Y- z
  2. /*% D* r+ N" ]$ Q" ~
  3. * edma_test.c
    & v5 E7 I  @# {7 i
  4. *
    6 u3 M3 b) y5 `* `6 j( P; S+ s
  5. * brief  EDMA3 Test Application
    8 Q' H( _; a4 g8 c! S8 F
  6. *7 z; b& i* Y6 X! \0 _# L' @
  7. *   This file contains EDMA3 Test code.
    * M6 c5 Y$ R6 q( Z; c
  8. *5 Z/ C# ~7 U% k# j5 G/ N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; \8 x0 b4 v2 }5 f4 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( T* d  X) R: w  _# Z
  11. *         TO CHANGE.
    & |$ ?8 U- ~& V. G
  12. *8 j6 [: s$ |; X6 R4 \4 _5 x3 U, C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 u' K3 T- _5 h, t$ m
  14. *% s$ X; M2 T& I6 d/ v; L8 |5 q# M
  15. * This program is free software; you can redistribute it and/or4 K; Z& M+ J& K. a4 T
  16. * modify it under the terms of the GNU General Public License as
    0 E$ o' ]7 c8 h( k
  17. * published by the Free Software Foundation version 2.! A( c+ X0 K) G* S8 @1 b6 u% z
  18. *
    7 g) N4 l2 |5 D5 W8 @9 I# F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) p/ M  ^- d5 u. k! R9 l! }" A
  20. * kind, whether express or implied; without even the implied warranty# _0 g* C; g2 X1 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! K' z* |9 n  W4 q2 H7 v8 i
  22. * GNU General Public License for more details.
    : o2 L& [9 _3 y& o: _
  23. */
    ! \& @& O7 C, I

  24. + c( I; B2 ?, g4 n3 ]( |7 f0 }
  25. #include <linux/module.h>( a& u7 h- i% R+ z( X9 C" X3 j
  26. #include <linux/init.h>
    - c1 f6 [( n0 R: z5 ?5 I
  27. #include <linux/errno.h>
    ) F# L2 y! `- Z
  28. #include <linux/types.h>
    8 O. E0 N8 d$ J) N& m' x
  29. #include <linux/interrupt.h>( j$ i8 h0 [5 W6 r
  30. #include <asm/io.h>% j' V: x. B9 F" c- ]8 n1 e. O
  31. #include <linux/moduleparam.h>
    9 n. C4 a: C8 J' g
  32. #include <linux/sysctl.h>
    ' I& B  W' ~4 w5 F& G$ t
  33. #include <linux/mm.h>+ o  L  O! k* m; \6 u4 `0 S+ Y
  34. #include <linux/dma-mapping.h>+ {7 G: s7 h+ G% s* B

  35. ; t9 W2 I7 y/ L1 u0 C! }0 y
  36. #include <mach/memory.h># m# L6 z5 O3 W
  37. #include <mach/hardware.h>
    0 i: }1 J: n6 {+ v
  38. #include <mach/irqs.h>
    * _9 B  z; i' h# p4 I8 e# J9 |
  39. #include <asm/hardware/edma.h>- y. X! Y, H! A1 B

  40. ' n2 x6 d/ ?9 X2 Y8 G% H
  41. #undef EDMA3_DEBUG) e( h" x' ~# O1 @0 @, d6 Q3 [
  42. /*#define EDMA3_DEBUG*/
    ; H3 T* u% Z# _6 a/ \" e

  43. " _" g; ~- Y9 n# I8 Q: ]# S
  44. #ifdef EDMA3_DEBUG0 j+ j% ^$ N! y6 \) r3 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 R1 Z7 t: m0 B% S' p9 C# b' N$ r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 S2 t" u' [& c+ V# R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      @% C/ E5 b/ O% \& D; g: |
  48. #else5 Y- Y6 d! |) k/ }3 _
  49. #define DMA_PRINTK( x... )2 h4 F" J/ V7 C5 K
  50. #define DMA_FN_IN% ?8 A! Z- N+ B2 I. i4 D) P. b
  51. #define DMA_FN_OUT( D% _7 W) s3 @9 G+ y
  52. #endif
    7 i; ~3 D( X' a* U6 L

  53. + M9 z* p) V0 Y$ P. [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ p# l. O  Q* I" u
  55. #define STATIC_SHIFT                3
    , l3 ], _8 n4 h8 c1 I- n
  56. #define TCINTEN_SHIFT               20
    ! O" m! \1 s  i9 G
  57. #define ITCINTEN_SHIFT              21# X) ?) }  I- v$ \
  58. #define TCCHEN_SHIFT                22
    ) E# I, x6 q* i$ Y1 G
  59. #define ITCCHEN_SHIFT               23
    2 K  F( \( l! {. e% ?
  60. " u; \. L' h3 Q- a
  61. static volatile int irqraised1 = 0;+ `. A% w! g% ]6 e
  62. static volatile int irqraised2 = 0;3 I3 ]9 Q7 x! O7 b6 s

  63. . k& h6 {' O; O0 s4 Z; K; B6 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ p7 I! d- F* o: T( {8 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 [9 U# B# h0 [) X7 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - j6 F8 l0 I# ~& L
  67. , ]& S0 R4 r% b+ b0 B
  68. dma_addr_t dmaphyssrc1 = 0;
    2 g4 r" U( t. K' g( w
  69. dma_addr_t dmaphyssrc2 = 0;
    ; Y& B9 x0 w: H3 u9 B
  70. dma_addr_t dmaphysdest1 = 0;$ g1 n, U, C/ J& w/ g
  71. dma_addr_t dmaphysdest2 = 0;
      F: [, `7 |3 ^& c- i; C- b
  72.   Q- t" k7 H" S
  73. char *dmabufsrc1 = NULL;! e; M/ e+ D9 _% m) ]" ~
  74. char *dmabufsrc2 = NULL;1 k- {$ p' K" g* J2 e
  75. char *dmabufdest1 = NULL;- d- g8 r4 ~8 G+ y  x5 o# p% S% J+ j
  76. char *dmabufdest2 = NULL;
    ( l7 I$ E6 c3 a/ ?" N
  77. / e. l- e3 S1 q. X! _
  78. static int acnt = 512;; A- l! t5 e3 w1 d+ o. q, G
  79. static int bcnt = 8;9 J1 x. ^; D2 J! G  Y. V
  80. static int ccnt = 8;
    3 q& B! Q9 c2 Z/ B! y

  81. 0 o- T! S6 Y! P
  82. module_param(acnt, int, S_IRUGO);% r7 Q, B  Y: b3 I/ i
  83. module_param(bcnt, int, S_IRUGO);
    1 G- D4 Y9 E/ p  R& U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 L6 G/ @& O! y5 T& O: W2 ?
1 p+ B% u  Q- B5 l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# \4 a' N6 _2 L) i4 _  r' H1 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. ~7 a* c7 E, |9 i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 F9 L" l- x1 b( J  P9 }- X- |& O
+ e- O8 P* W0 e$ P& D1 P3 D* u4 q
! s9 a9 E7 q% c, M: {4 f5 V$ {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 08:37 , Processed in 0.037863 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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