OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 Q0 e7 I, S( O" G, x5 R4 G' B
  1. [code]EDMA sample test application
    ' _( `& _# f: K& t, I6 \8 k
  2. /*" ?( Y# {5 F- e# `# G" v9 N6 P
  3. * edma_test.c
    2 ~/ g6 m8 C0 w( v
  4. *( t$ G# a- h. L' C
  5. * brief  EDMA3 Test Application2 Z& c* X. s0 a) S
  6. *  W! X& W+ _- M0 ]  B3 E3 R
  7. *   This file contains EDMA3 Test code.* x% x) r: g( N6 v+ B
  8. *: j" b7 G" h4 O9 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 c! ?7 h3 z/ p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 d+ }, F( l- N* {( e8 N5 J
  11. *         TO CHANGE./ G4 m7 k9 Y" U) \% G( }
  12. *6 n$ G" g( V, }( N" d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # h/ H3 Y7 Z. F3 P  ^% i
  14. *
    5 v0 o* y* h0 `/ y1 `2 Q
  15. * This program is free software; you can redistribute it and/or3 {+ D5 u# j! E9 T
  16. * modify it under the terms of the GNU General Public License as
    & u7 a+ ~3 B8 f8 L$ v! b9 ^2 \1 b
  17. * published by the Free Software Foundation version 2.
    " U  b- d& F' K/ `- V
  18. *
      ^& |9 h- ^, X- D/ f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 J  ^' G6 R/ e" i; Z
  20. * kind, whether express or implied; without even the implied warranty" o  W4 P0 Y0 v0 m  o# W0 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 }1 @0 R3 v" @% l: ?7 Q5 K
  22. * GNU General Public License for more details.- {3 ?& i6 A  z* F! a4 G
  23. */  q# ~6 x3 s2 H$ ~3 M2 ^4 H
  24. * n. j6 ?8 [$ \( \  U( I
  25. #include <linux/module.h>
    ! P7 j; r7 f; h1 X
  26. #include <linux/init.h>$ X, d' t; p" e# _
  27. #include <linux/errno.h>
    ( @: b+ r( e/ W& e0 y
  28. #include <linux/types.h>
    4 g; J8 }5 {6 J. M+ d! M
  29. #include <linux/interrupt.h>
    ! U7 h8 g! a6 B- Q8 s
  30. #include <asm/io.h>
    0 E7 F& G) }4 w; L6 [9 Y
  31. #include <linux/moduleparam.h>9 O6 h$ O0 P! W2 x! y+ Q
  32. #include <linux/sysctl.h>
    1 k9 g0 N7 x3 N. \: f, [0 L) X
  33. #include <linux/mm.h>4 o" H* _! D$ Q* X3 G0 a" L  u
  34. #include <linux/dma-mapping.h>, g' F% k* D$ ^

  35. . ~9 d1 ~$ V# K" l( X" x3 f* Z
  36. #include <mach/memory.h>1 |, \6 U5 M" x, Y. i
  37. #include <mach/hardware.h>" A% t, i8 _9 L
  38. #include <mach/irqs.h>
    9 b7 f" C- @+ G
  39. #include <asm/hardware/edma.h>3 _7 A1 m2 u" d! o5 p7 {

  40. + L. M" x0 }  A% {
  41. #undef EDMA3_DEBUG/ W( R% x5 j. S& J; p2 O
  42. /*#define EDMA3_DEBUG*/
    9 I1 c7 V& {6 e. q5 A
  43. 0 |" T) P2 H5 `
  44. #ifdef EDMA3_DEBUG1 l  s1 o2 {" R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , _0 a6 Y( {! R9 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( j3 U" H" @$ v3 b; `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 Z# t; F0 h7 U& I
  48. #else6 m. d3 v& l; C  L
  49. #define DMA_PRINTK( x... )
    ' Z$ |* x# F& U% b3 |7 P! b- i
  50. #define DMA_FN_IN1 Z! R/ a1 i3 i8 a3 V" @( l
  51. #define DMA_FN_OUT6 {( @: s  w9 |2 u5 F
  52. #endif
    6 d; u/ X9 }* e' M4 E2 d
  53. ! o4 H, v; d+ B! S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* }4 b* G9 j6 e: h' m1 O" t
  55. #define STATIC_SHIFT                35 O5 N5 [2 A+ n" N4 t& C
  56. #define TCINTEN_SHIFT               20
    8 W1 X% a8 W0 K+ Q( A5 \$ P9 ^
  57. #define ITCINTEN_SHIFT              215 u4 s2 }% E% ~' p! T3 H
  58. #define TCCHEN_SHIFT                22* b/ c: p; A9 I
  59. #define ITCCHEN_SHIFT               23
    & }- Y+ \3 ~* h" X) Z
  60. 1 M2 _  Q& C) h! F
  61. static volatile int irqraised1 = 0;
    4 y6 w- W) o9 h9 }3 V& d+ [
  62. static volatile int irqraised2 = 0;
    0 S8 _) l$ p2 B" q8 x7 L
  63. 0 B, |% j; c6 t: W3 c8 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% z9 w+ f5 _3 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; p$ ?) n7 C7 k$ y4 s' ]: \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 V4 C) x1 |9 e1 g0 D1 Y  v' k; a
  67. : r. d* t- ]5 D1 Q$ j. `! c( R$ C8 q1 Y
  68. dma_addr_t dmaphyssrc1 = 0;
    3 X- e( k2 k  M: t5 ?
  69. dma_addr_t dmaphyssrc2 = 0;
    ( Q; ~6 q. P1 k3 ^
  70. dma_addr_t dmaphysdest1 = 0;
    / [, h  v6 ?4 R( i  J  o
  71. dma_addr_t dmaphysdest2 = 0;5 N6 N, t- W. B( S! g4 I/ |( O& Y% `

  72. ( Z( [! J# Y) ]
  73. char *dmabufsrc1 = NULL;) b( q( C6 w5 U( K
  74. char *dmabufsrc2 = NULL;
    & t, R6 K- L, F% t" D* d
  75. char *dmabufdest1 = NULL;, f2 \3 m; L* N- R
  76. char *dmabufdest2 = NULL;7 [, x: {7 G6 Q

  77. ; ?7 D, g2 r) [5 v
  78. static int acnt = 512;
    & ?7 o% C7 i( f5 v7 K& n
  79. static int bcnt = 8;
    ; x  N% X+ X: U- y/ S) K
  80. static int ccnt = 8;
    # w- G" v+ T* T

  81. 0 X* T' K' m" S- `. u) Y
  82. module_param(acnt, int, S_IRUGO);0 Q/ O; Q. [/ x: v( U
  83. module_param(bcnt, int, S_IRUGO);' W3 z8 H6 c7 k' s% T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" `5 V0 P* V9 ~
, |9 a* Z" l9 Z& @+ o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% n5 h, q+ z/ I+ ^9 \; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ M3 c* t6 @# X. i4 I0 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 ^) w4 A* h) U0 l: |) P, }2 H- ^. a
3 E( y: u4 |0 E$ o/ e8 j' r( V8 q' H. {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-3-31 20:14 , Processed in 0.043054 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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