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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; G/ o# Z3 D" r# \6 ]: r  s
  1. [code]EDMA sample test application
    , r  Q/ y6 m5 V4 l
  2. /*
    ( d1 M' q  ^9 T. v) p( q( J
  3. * edma_test.c2 c1 v* L: M+ g, s# C
  4. *: _4 g/ f# M' A) ?# z( d
  5. * brief  EDMA3 Test Application- A$ s* }- V" a  u  m0 |
  6. *
    6 L3 D5 F3 Q! y, x) R
  7. *   This file contains EDMA3 Test code.
    5 q. }0 u' j- i  [, y
  8. *
    - x' I, D- r& z" O  x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 _, A9 a5 N/ U& m" h, s4 @+ E! ^7 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 s8 J" |2 ]! Z* O) p/ }
  11. *         TO CHANGE.
    2 M4 v- x2 H+ x' c  Q
  12. *. u0 j: r9 `+ B  x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : _& H- [! v0 c, _  S
  14. *
    3 @- a# b; l$ \- `3 |
  15. * This program is free software; you can redistribute it and/or( x1 W0 \2 Y& g% j
  16. * modify it under the terms of the GNU General Public License as0 W/ o# y9 W- c6 h! z8 q( B
  17. * published by the Free Software Foundation version 2.
    $ U, H( i& e. D% |9 h
  18. *  O( w* S* t, E) `7 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; b3 o3 V8 v  _1 E% a2 n
  20. * kind, whether express or implied; without even the implied warranty) b- \# J6 x/ w. w! ~3 i& r0 B/ L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # U, H8 L6 y8 Y" Z" ?
  22. * GNU General Public License for more details.9 [! f/ [# _* T5 d4 O. a+ e
  23. */
    ! ?- ]1 z: ]& v2 I

  24. 9 j) ?. q, D! K' P% |( G) B
  25. #include <linux/module.h>
    , P5 U( L. I; h& k1 S
  26. #include <linux/init.h>
    # b: ?! Y0 B% r
  27. #include <linux/errno.h>
    6 I) M) H! O: r2 a% F2 x7 p
  28. #include <linux/types.h>! C$ F6 C. h0 r, \: w
  29. #include <linux/interrupt.h>
    4 n6 T/ O7 h$ b( @$ D
  30. #include <asm/io.h>' x9 C  x1 n% f( a+ [! n
  31. #include <linux/moduleparam.h>
    6 w/ G, h$ c8 v- q, C
  32. #include <linux/sysctl.h>
    3 h5 _6 Z' c4 d2 u. A
  33. #include <linux/mm.h>: W" m, Z  F/ [! ^# @
  34. #include <linux/dma-mapping.h>9 R. m$ a9 I! L

  35. - R$ H9 G1 v: `2 t3 n$ y: A+ q
  36. #include <mach/memory.h>
    1 ~9 v" @6 B% ~+ @" w
  37. #include <mach/hardware.h>
      r) D. |; R8 v% q) H/ X* Z) j/ b
  38. #include <mach/irqs.h>& P' C* G% r! c" d! m
  39. #include <asm/hardware/edma.h>" ?" O( m! @9 ~, \

  40. 8 j% h1 [& [# T+ L" i+ @9 z
  41. #undef EDMA3_DEBUG+ [7 K' |8 B, U
  42. /*#define EDMA3_DEBUG*/
    9 a$ p4 H: X! G4 g  Q* \# k: y

  43. 6 S8 e, a9 C& w; U5 s* X
  44. #ifdef EDMA3_DEBUG: @% w' B" U) ?6 m/ U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& ]. X! g1 W8 T0 U5 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; k7 `8 h5 Q7 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 ]5 k  w. B' l5 Q+ A3 e
  48. #else8 y  x. ~- j0 q1 m1 L
  49. #define DMA_PRINTK( x... )
    $ O$ U) ]) N2 Z! Y2 j8 }
  50. #define DMA_FN_IN6 g* o( u8 `1 m/ f' {& w3 f
  51. #define DMA_FN_OUT
    " H# O! q5 z. y- K& N
  52. #endif$ m3 g( f5 \4 T9 ]. |: B6 Q0 T
  53. - {& Y: I- {9 v  `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 V8 a8 E* X- c5 {( p0 d
  55. #define STATIC_SHIFT                3
    ! w& u8 g& L6 B% \4 F
  56. #define TCINTEN_SHIFT               20
    , @1 m7 X2 i: H
  57. #define ITCINTEN_SHIFT              21- B) }' `, A1 z% C0 v" L/ f
  58. #define TCCHEN_SHIFT                228 y. T& w' C& G  @4 M7 ^
  59. #define ITCCHEN_SHIFT               23& ^  F7 j0 R1 O5 i9 e# O; A9 E

  60. # P/ {+ Q" M( d# H  W" A
  61. static volatile int irqraised1 = 0;
    1 o; x" D! v- c0 `3 S- s, `
  62. static volatile int irqraised2 = 0;/ a8 k( s* G# t8 U4 G# _

  63. . w+ l1 t  X) Z  n) ?1 i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * r) X/ q& K; h* P  t4 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : V% b/ U' d+ w) L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 e3 R6 d' {, k7 c; n8 c5 f

  67. 3 M, q! l$ V' ?8 g- [% k% Q
  68. dma_addr_t dmaphyssrc1 = 0;
    7 ~( T; I9 u2 k! {" R
  69. dma_addr_t dmaphyssrc2 = 0;
    8 l7 |0 V0 }* a1 Y& Z
  70. dma_addr_t dmaphysdest1 = 0;& A2 O6 M5 O2 k4 p7 P
  71. dma_addr_t dmaphysdest2 = 0;
    : w( n0 A8 Z7 A( E: E1 L3 j7 x
  72. 2 N; u5 X' j, X- u2 O9 p
  73. char *dmabufsrc1 = NULL;
    3 f5 p( f1 i) Y8 M. ]
  74. char *dmabufsrc2 = NULL;
    4 C8 d5 L5 J; l4 a' U4 p8 n7 o
  75. char *dmabufdest1 = NULL;% N# ~, @+ b% ?& r/ s) E% x5 w6 s$ K( u
  76. char *dmabufdest2 = NULL;
    0 L+ }3 M3 c& `

  77.   \5 z: m7 k0 m3 U
  78. static int acnt = 512;
    " r8 H* X# }# v- j! S9 L% S0 i% @1 K
  79. static int bcnt = 8;
    0 ]1 I$ I0 }3 Z) L! f
  80. static int ccnt = 8;
    ; G" P( `5 N! h+ |) L

  81. ) H9 w' ^0 s* r" y, B' K) w4 U7 _
  82. module_param(acnt, int, S_IRUGO);
    & ^8 X" w) @0 ^' ^9 M4 _
  83. module_param(bcnt, int, S_IRUGO);) }9 Q/ C0 ?$ q4 }& y2 F1 Y9 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 @) `( I/ |" X8 E2 R
* K' e: ~2 Z/ d3 \- j& h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ }) a2 P4 @' g0 ~1 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* L- [& w; M3 O' D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 T" k: W3 \) o
/ s& I" v, `: y+ x  v5 x

$ k! _" }9 }" |0 o, |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 01:21 , Processed in 0.038385 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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