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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # c! ]9 |& _) Q7 B+ o
  1. [code]EDMA sample test application
    . V; [7 a' y$ ^( Z
  2. /*
    4 [2 D/ x% y) C0 o& F2 S6 e2 X
  3. * edma_test.c- m# q( z1 a! `7 l& b9 ~. a4 V
  4. *
    2 k( f. Q. O# ]1 r5 Z
  5. * brief  EDMA3 Test Application
    / q& c+ f( E3 f* P
  6. *
    ! h1 S; V& K7 I- M# t9 R
  7. *   This file contains EDMA3 Test code.9 \9 ~) `. f. y; g6 L9 B# ]' }
  8. *, w  Z# e6 \8 d& }/ _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! m$ w( u1 r: H7 `) r# z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% i( |0 v& f4 @" F1 p
  11. *         TO CHANGE.0 m  ]1 ^& ]: G+ i) V  c+ h
  12. *, r( G% [7 e8 I) ~/ @# S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 f& E0 a$ z# ]% q
  14. *9 `+ X' m3 ]  A0 l# T0 g* F
  15. * This program is free software; you can redistribute it and/or3 Y3 D( A) @. V; A
  16. * modify it under the terms of the GNU General Public License as+ v5 i0 L' o  Q7 E: K& y3 C
  17. * published by the Free Software Foundation version 2.( q5 \* n/ Z; g1 H7 Y- X
  18. *$ C4 G% O' {7 `& M0 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ L' s6 |8 \' _
  20. * kind, whether express or implied; without even the implied warranty
    . l  A& j# i9 d. R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 [2 P! I3 N( U  V" Z# Y8 R
  22. * GNU General Public License for more details.! @6 w* g% K$ W
  23. */
    ' ^* r; r6 S- R8 w/ t0 N5 i  x

  24. 4 E0 V  p2 N9 J5 D/ g, M8 F
  25. #include <linux/module.h>
    ) L. q$ [4 D# h
  26. #include <linux/init.h>
    * u% L& _+ {5 ^' @
  27. #include <linux/errno.h>! x- a  J$ P1 k* W' U
  28. #include <linux/types.h>8 T9 x, o; ^# ]! q3 Y( e
  29. #include <linux/interrupt.h>- I& ?9 m6 c5 }" k( U" g4 w
  30. #include <asm/io.h>
    " x) Y. T/ Z0 D; d, p
  31. #include <linux/moduleparam.h>
    : Z9 [! X! @- y+ \2 @5 I
  32. #include <linux/sysctl.h>
    * I/ h/ U9 M6 J7 y3 P
  33. #include <linux/mm.h>
    ! |* L4 e0 u8 @# l3 b. H. L
  34. #include <linux/dma-mapping.h>7 S; h; f' |- U- Q
  35. " N. A/ Z0 M8 v8 a
  36. #include <mach/memory.h>
    ) ]2 D: L7 X8 p$ j
  37. #include <mach/hardware.h>
    4 a/ d9 N( X6 J$ s$ S- |, @: E
  38. #include <mach/irqs.h>
    " x3 ?6 U$ w; I9 u8 d# n3 {
  39. #include <asm/hardware/edma.h>
    ( ?. s! L+ Y  l1 X$ W$ S; R

  40. ; ]# @3 U1 \0 l8 E4 \* O9 E& w" l: a
  41. #undef EDMA3_DEBUG
    9 _5 I: i" N) W& F' f! q
  42. /*#define EDMA3_DEBUG*/
    , m7 {% ]7 n5 ~+ j  O
  43. ! {( j* w& r$ e! w# A( f. k! o
  44. #ifdef EDMA3_DEBUG  F3 c1 k2 T1 \2 z! z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). h7 C" b( s, t" O  O! l: {) k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 P4 y1 l5 G* Y2 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 c# `# c3 o) l
  48. #else; Z( e' T0 y7 Z5 r2 m% w
  49. #define DMA_PRINTK( x... )
    5 I% c- a3 w; E( D- O  ~# w
  50. #define DMA_FN_IN5 _' {  j7 j* G5 z, t# L" o
  51. #define DMA_FN_OUT
    9 B$ c# W. h4 C" |: _' f# x. x
  52. #endif/ @+ R0 O& W7 L
  53. ( F- k7 W! O# o9 R, a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) c& x, R! G* s; ^( n  `
  55. #define STATIC_SHIFT                3  a0 w$ K7 z' e0 C$ D% n
  56. #define TCINTEN_SHIFT               206 g8 B9 m/ A' h
  57. #define ITCINTEN_SHIFT              219 R7 L* p* j9 |, r) w4 b) {. a1 z7 T
  58. #define TCCHEN_SHIFT                22$ b3 y* |, h3 D4 W, P& {' M8 R7 i
  59. #define ITCCHEN_SHIFT               23
    1 H- m4 ?. V9 A$ t/ F- w

  60. 6 h9 c! j$ O8 ~, j' @
  61. static volatile int irqraised1 = 0;8 t1 y( N6 V, \5 x2 `/ \, _: ^8 F
  62. static volatile int irqraised2 = 0;
    / ~% v0 I2 {; }4 }5 e
  63. 8 e) `, r2 H6 o* M, C* [5 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) U" ?3 X9 b3 @4 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Z: z' x( L$ t1 m& p$ p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 b1 p5 d& M& Z0 J- }
  67. + U- Z% \5 c9 y' L6 E
  68. dma_addr_t dmaphyssrc1 = 0;9 A6 M/ c" S+ d# Q% O- s- G
  69. dma_addr_t dmaphyssrc2 = 0;
      o! @. C2 d' S7 ^5 n3 g; Z! r
  70. dma_addr_t dmaphysdest1 = 0;# w$ z- ~, W# ?3 _
  71. dma_addr_t dmaphysdest2 = 0;2 g( ^- Y7 |4 O
  72. & m$ E3 h+ J  s7 P/ z8 c
  73. char *dmabufsrc1 = NULL;' A+ A" g2 h4 q  D7 g5 M" O
  74. char *dmabufsrc2 = NULL;  S! Y/ W% S% v7 d! F
  75. char *dmabufdest1 = NULL;) Q( @) `+ f# w/ M
  76. char *dmabufdest2 = NULL;7 I" d1 R. b# c6 m* c& v

  77. - ~1 ~( V7 @/ u6 F( ~
  78. static int acnt = 512;
    2 C' f/ |: ]/ k; p* i
  79. static int bcnt = 8;7 f5 A4 d, C, K) c
  80. static int ccnt = 8;
    ! z4 ~1 |! j2 U3 b( u

  81. ! P0 X5 T5 x" r- f# R4 B
  82. module_param(acnt, int, S_IRUGO);
    # Z) E! P9 Z2 B1 a, F3 C
  83. module_param(bcnt, int, S_IRUGO);
    1 e0 N! h1 N# p  X" A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ D0 Q6 z& r* |5 K
" W$ N) |) `. F) w/ M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  o, w" S. O6 y# H! }& U: v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- s& n7 s3 ~* `! K. I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 S+ B2 r9 r2 x" ?( [4 p% Y6 C3 s
( l, |2 d  a& O

) U3 }# T, N& J0 ^) l' P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 11:46 , Processed in 0.035810 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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