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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( a$ @" r( d1 R& ]" X7 v
  1. [code]EDMA sample test application
    & k6 [. D7 |: {" K# t
  2. /*
    3 M9 ]+ x! {1 `' |+ I5 s5 ?
  3. * edma_test.c. P3 N1 g' v9 P3 ~& _1 m
  4. *
    & y: T0 a" F- @0 q8 {
  5. * brief  EDMA3 Test Application" J& w  y3 @) h% K" g' b
  6. */ r$ Y8 w8 [! d* `$ A. N4 W4 ]
  7. *   This file contains EDMA3 Test code.. u! \' Y- c& g9 o
  8. *# ?7 [0 A: {- k2 x7 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 d0 y4 q# f! w3 t" y" A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# p* x% Z( J6 ]1 `5 O7 g
  11. *         TO CHANGE.
    7 J+ H* H. d) s- t2 ^
  12. *
    2 |0 ^# l4 s  v. ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: j6 {4 k: _. b7 Q9 q& x
  14. *
    8 {4 n% H7 L4 d1 ~. ~; H& T' j
  15. * This program is free software; you can redistribute it and/or" {3 H) H- n* r
  16. * modify it under the terms of the GNU General Public License as2 ~: H3 y: u4 B2 z' Y- s. f" o% c
  17. * published by the Free Software Foundation version 2.9 g2 t- N6 @* ^4 k( G3 P
  18. *
    & a  F7 [& ]& o* C# |) G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 d+ Q5 ^  H" r  s4 g# ?
  20. * kind, whether express or implied; without even the implied warranty8 B/ }5 R/ u. a) C% ?. n$ ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ L) @1 J; _; D. G" A2 p: }
  22. * GNU General Public License for more details.. N- p4 k4 t: e9 e4 N
  23. */" V4 ~1 ?' ]( h! b$ b! v8 v

  24. 3 {6 P% E$ t( Y, V  l- B
  25. #include <linux/module.h>
    ) t$ A3 q. o' I+ E! m0 G* W
  26. #include <linux/init.h>4 e1 f2 T6 }9 `( p8 m! h( ]
  27. #include <linux/errno.h>
    " y- k4 S% T& m1 g$ g& e( I
  28. #include <linux/types.h>, v% w2 |2 S$ W% H  \% c
  29. #include <linux/interrupt.h>
      }  t. [& {- j2 W! b3 J  x
  30. #include <asm/io.h>$ T9 t! G2 V! P
  31. #include <linux/moduleparam.h>5 E3 P7 P. Q: W! `/ V' s
  32. #include <linux/sysctl.h>
    ' V- H1 c9 {! r7 ^! v2 }- J
  33. #include <linux/mm.h>9 d; M6 G9 k0 _
  34. #include <linux/dma-mapping.h>3 }0 Q% X, {. K, H/ m9 m( {

  35. 2 ~" Y/ s) w3 [1 {: g2 Z. i& f
  36. #include <mach/memory.h>% N) U& J( \0 v: Y
  37. #include <mach/hardware.h>
    : Q9 g( G5 ~* l
  38. #include <mach/irqs.h>' B: u1 t9 y* W# w" j( k8 W7 V! R2 _
  39. #include <asm/hardware/edma.h>9 Y  t6 p' v6 U- l2 A+ e
  40. 8 Q' y4 u/ k+ [( x1 I
  41. #undef EDMA3_DEBUG
      D! J6 J8 E) V
  42. /*#define EDMA3_DEBUG*/
    3 H( ]$ g+ J3 c% I* h6 O3 R

  43. ) {$ S4 P0 f5 `" h# Q2 U  ]
  44. #ifdef EDMA3_DEBUG1 a- H2 A5 }6 c- t. U  ~5 x9 h8 |+ ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" X+ P( M8 U( Y! c5 }8 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 \( Z2 `) L0 L9 T! q# F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). M" a, l- Q' \7 z0 z& X% n
  48. #else& Z, S. ?, G4 G" }$ F: M+ H
  49. #define DMA_PRINTK( x... )
    8 B7 p$ d& M' Q, e* B# h1 B' @7 U
  50. #define DMA_FN_IN
    , {* I" b4 X& `, e
  51. #define DMA_FN_OUT; k  y+ k) ?0 M- F& @% p5 F0 F
  52. #endif0 f2 `' t3 ]* t2 D9 s7 r* ~
  53. ! u% `$ p9 p$ b2 i% k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( w: s# h  O9 p' A& G! h$ w
  55. #define STATIC_SHIFT                3
    4 b# G4 ]3 M6 {- l  e( z8 l
  56. #define TCINTEN_SHIFT               200 f9 C8 }  @  B0 I" j4 t* S
  57. #define ITCINTEN_SHIFT              21
    + A$ c* R7 J% [6 B0 x
  58. #define TCCHEN_SHIFT                22  R$ `) l- x9 }  u& ]
  59. #define ITCCHEN_SHIFT               23
    1 G3 k. V6 `/ U2 R5 [
  60. ; P2 c3 U2 [, Z$ G6 N6 p+ u3 ~3 b
  61. static volatile int irqraised1 = 0;
    4 o  R; }7 I: h* a, l+ F
  62. static volatile int irqraised2 = 0;
    2 w9 B) O( s; F6 W; M

  63. 4 B' h" R# [. z+ Y) y/ ^# G" i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 E2 |4 [0 _4 K8 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 l$ ?* c" P) _$ |2 s- S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, M3 x% q8 H# \' i
  67. 3 j5 |6 e5 q) `- ~! m- d! Q" F
  68. dma_addr_t dmaphyssrc1 = 0;
    1 `6 S2 x. j" `. `4 L2 ?* Y3 }, Z4 x
  69. dma_addr_t dmaphyssrc2 = 0;
    & p. W% A5 o- T  a1 N- i
  70. dma_addr_t dmaphysdest1 = 0;
    2 F" ^' `0 [$ e( k8 H9 q
  71. dma_addr_t dmaphysdest2 = 0;( w. M. ?0 Z0 Z, H0 q2 h
  72. , J: o7 p( u- D9 z
  73. char *dmabufsrc1 = NULL;
    # O3 J. t7 U5 Y) I3 H
  74. char *dmabufsrc2 = NULL;, n2 J# x& N! j
  75. char *dmabufdest1 = NULL;; H# j0 T0 Q) \/ p; Y
  76. char *dmabufdest2 = NULL;
    4 P: ~: j/ S- k% e7 @1 X
  77. 8 E# z$ y0 |2 p: X  ~0 H
  78. static int acnt = 512;5 e: `3 E+ i( t9 w$ s
  79. static int bcnt = 8;' z2 n3 C7 c& c( e! R
  80. static int ccnt = 8;" ?- G& e$ S$ P, A) G5 x+ t

  81. % J! K, {1 O+ A* S& S
  82. module_param(acnt, int, S_IRUGO);5 r; x  a9 g+ v1 N: B$ {4 b0 ?
  83. module_param(bcnt, int, S_IRUGO);
    ( @( e7 p% ^( B0 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 c. S, [' H9 }7 P4 {

5 U- k$ n+ {5 h/ ]: o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 n# S- E) {' w- l7 W$ Q  r6 ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; x7 f" D5 D7 N  u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 U$ h1 i( _' e- G
& r. w& ~4 h8 a, e3 X/ k: B
/ Q5 t: E. U- V1 u+ R+ n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 03:07 , Processed in 0.046845 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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