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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , L3 ~* ?- Q/ R: N/ T
  1. [code]EDMA sample test application
    " R; b  z5 |0 k- N$ X
  2. /*
    : ]' Y8 l2 n2 Z9 d! t( L. P! o( b
  3. * edma_test.c
    0 L, z0 A, `) O! F+ N1 w6 T
  4. *# v: _+ s; s4 P- H$ x! v
  5. * brief  EDMA3 Test Application) @, J* [6 Y' T' z% d+ q6 _, C4 w- q
  6. *
    , O8 c( O8 o2 Y4 j$ |( V+ }; h
  7. *   This file contains EDMA3 Test code.
    ) ?' ~4 R- S$ j
  8. *! U* x0 p8 g# g" @" g$ \- V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + y6 _6 X3 r  y0 ]/ M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) V. G! i8 M/ U- [, \: p4 m
  11. *         TO CHANGE.
    1 W/ O3 B9 z* Q3 {+ r
  12. *
    ! D( M; R4 u" P! R4 u8 u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ `  N* n3 ]5 t
  14. *
    , J! H  o% U3 p. J
  15. * This program is free software; you can redistribute it and/or
    + y$ d% F. k0 Q2 y/ e3 |
  16. * modify it under the terms of the GNU General Public License as) e2 |9 u& t, r9 \' {
  17. * published by the Free Software Foundation version 2.
    / r. U3 G) M8 x8 Z
  18. *
    5 d3 ^( W) a& ~7 H5 U. G! @) t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ {3 X* l2 Z' Z- t6 l4 `
  20. * kind, whether express or implied; without even the implied warranty6 p$ R1 q/ J# h% m4 j8 z) o( z* [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % w9 r9 y) b4 w. t' ]% v7 f) ?8 ?
  22. * GNU General Public License for more details.
    & z: {* G! {8 v$ u  t) M  q- U8 Z
  23. */
    : }. r% T( O2 x# W) a3 W  O8 a3 g
  24. + b/ K' l! y0 D( ^* T
  25. #include <linux/module.h>
    # }2 K9 p& w  n% @; d8 A* L* G/ W  a
  26. #include <linux/init.h>) d* W# e! I: }. I) R7 D
  27. #include <linux/errno.h>
    & J. m, B7 v! C/ {; @
  28. #include <linux/types.h>* Q- u8 B/ H1 y
  29. #include <linux/interrupt.h>0 z  z- |" \4 i; y" o
  30. #include <asm/io.h>
    4 X. o9 y4 K3 B3 [* z) u
  31. #include <linux/moduleparam.h>% W' Q5 y) d$ M
  32. #include <linux/sysctl.h>
    # m, [: @7 ]$ q4 p; m7 f) z2 W* r) K
  33. #include <linux/mm.h>0 }; w; F* @; A, a; ~
  34. #include <linux/dma-mapping.h>: T% ]- `! u' ^" Z! A

  35. + \4 s; Y' u: Y& E" w' n2 w4 j" P
  36. #include <mach/memory.h>, V2 M- [% Q  L5 G8 Q
  37. #include <mach/hardware.h>
    9 Q# q( P" |# l( M2 k+ p
  38. #include <mach/irqs.h>4 A) d7 J  Y& E
  39. #include <asm/hardware/edma.h>7 Q: U2 g+ g/ u  l  Q" v

  40. ; k, ^4 B- b( b. }
  41. #undef EDMA3_DEBUG
    " \: }$ F0 V( I+ y8 f7 h. _
  42. /*#define EDMA3_DEBUG*/$ r; o8 b' L, k1 i9 H1 g/ w# h- X
  43. 3 c# _" J$ M3 M2 J3 ]2 V
  44. #ifdef EDMA3_DEBUG
    * e' d$ a4 ?: D. M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( M6 D  p& M3 P, B& u0 [" Z" D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; R7 I$ H* T) r: o. Z- k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ j* a' x: s* P4 e% |8 P2 w
  48. #else
    & @# k  L, t' x) K
  49. #define DMA_PRINTK( x... )/ W7 Y1 Z# M5 b0 w! W
  50. #define DMA_FN_IN
    2 H: L% T# t' {9 G- |
  51. #define DMA_FN_OUT
    ) [$ q, Z1 \& @' [, |' |( k
  52. #endif$ U% a3 j1 d9 H) ?% l; U; C% |

  53. 0 \. v& r' w- j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * m  _- o! [) l0 ^8 g
  55. #define STATIC_SHIFT                3* W9 O0 s+ i+ H
  56. #define TCINTEN_SHIFT               20
    " x" e) M. I$ v) x7 M
  57. #define ITCINTEN_SHIFT              21
    1 k6 Y. k& c8 ~
  58. #define TCCHEN_SHIFT                22
    1 j7 D+ i5 l- e6 t9 V) q  r
  59. #define ITCCHEN_SHIFT               23
    3 N$ c' Y+ c  J3 U9 b% V

  60. 8 \& [# D: ]0 x& d8 q
  61. static volatile int irqraised1 = 0;) i' L, c9 `* y% Y& H
  62. static volatile int irqraised2 = 0;# h& o- o, I: i0 w/ [# M1 D1 s* i
  63. ' A, K+ M* N8 [2 p& J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. g$ |% R6 L. W: Q" _7 n9 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' ?+ X& O2 O4 b2 c5 h' _% P8 `1 t3 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. N7 `5 B: Q( H8 Q- n

  67.   d0 S& u: u+ A, N6 I6 ?
  68. dma_addr_t dmaphyssrc1 = 0;( B/ S' g* |) |6 ?  \+ e' q
  69. dma_addr_t dmaphyssrc2 = 0;
    / j  x. r! v/ u+ {
  70. dma_addr_t dmaphysdest1 = 0;
    . W. H# T  B% K& d# B  D7 Z/ }6 X
  71. dma_addr_t dmaphysdest2 = 0;
    ; Z! O5 n7 W1 R6 P  I9 ^2 h

  72. + `4 l( M+ X, Z8 g  f
  73. char *dmabufsrc1 = NULL;3 m& O9 O+ a/ Z5 Z7 f8 t& G- K
  74. char *dmabufsrc2 = NULL;% X$ q9 z" C/ C$ Y
  75. char *dmabufdest1 = NULL;5 {6 ]5 f! N! _) V; ^
  76. char *dmabufdest2 = NULL;0 s: M' M3 a# I' j8 j1 \2 v

  77. ; f. p0 N, Y" A9 v' s. D, ?% ?
  78. static int acnt = 512;: `9 w- {. h5 D" f9 v% Q
  79. static int bcnt = 8;
    5 z" f' m4 _# n4 }, d2 K; q0 R: \4 `" y
  80. static int ccnt = 8;* p2 N& N6 S9 }, I% b
  81. 6 r5 Y! ]5 x! p/ x7 |8 x
  82. module_param(acnt, int, S_IRUGO);
    . k  _5 `! p  I* W1 q# u
  83. module_param(bcnt, int, S_IRUGO);
    7 N( |# I7 @! M" N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  L1 ]0 Q/ w' [* V/ c0 J
# a, `" n' b. }" e: _6 T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- {+ _* n2 K: ]( U0 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; f' i7 t& {+ M) q) I" \2 n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: s" m" \2 q+ Y+ L& i& Y

7 e+ @- S9 j& F9 ?" L9 x3 g# d6 r! L3 k. r. V4 t6 [- G& y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-12 07:47 , Processed in 0.038069 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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