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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 z* h! g0 x9 N  j: }! c5 t
  1. [code]EDMA sample test application& _0 h# B/ F1 ?) M+ e
  2. /*' I8 m* ]  r. z0 V
  3. * edma_test.c
    - X- b/ ?# h" l; k
  4. *
    3 p' M: ?( }1 Z
  5. * brief  EDMA3 Test Application
    ! i+ E& @! _& ~
  6. *9 ~( ]2 D7 U% _7 g# ]7 j* `
  7. *   This file contains EDMA3 Test code.
    $ R3 Q! L* B% `2 f7 R) O# {
  8. *
    . a" t4 K3 Y4 y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      x0 x, J, I1 c- T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! ~6 V) c4 Y$ m4 |) j( s  y7 v
  11. *         TO CHANGE.( @* ?( c; @) o* h, U1 k
  12. *
    & `9 x7 C. u* f# Z6 {- l' {$ j! S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& F, |; M$ K% i' j2 B( m
  14. *
    5 Z( a5 ~4 C* A& S* `
  15. * This program is free software; you can redistribute it and/or
    9 r: \6 |' A3 C/ y$ j
  16. * modify it under the terms of the GNU General Public License as
    , T+ F# @- z6 e4 _0 \; s+ [
  17. * published by the Free Software Foundation version 2.) `0 W& Q6 D; P+ J8 S  M7 i4 ?
  18. *
    & u# i0 ~/ w# g2 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 T# ~1 ~% ~) X3 w0 Z3 m, o
  20. * kind, whether express or implied; without even the implied warranty. A1 [) b% C8 Z2 W* B! T1 |$ |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ O! ^% t' X+ g- y* C
  22. * GNU General Public License for more details.0 {8 U% j, k! y* @
  23. */" q* f7 P( v( s" f

  24. * t1 x  Q3 m( `9 {6 Z
  25. #include <linux/module.h>/ T- N0 E; g3 P
  26. #include <linux/init.h>
    4 X3 Q7 x& t3 q7 C5 V
  27. #include <linux/errno.h>- b1 ~) Z" a  e! @
  28. #include <linux/types.h>9 i3 \5 c. g$ Q" d- m/ @
  29. #include <linux/interrupt.h>
    $ @2 z4 O% I. ?/ X" U" E- F# f
  30. #include <asm/io.h>
    ! b) g" E: Q9 O" o
  31. #include <linux/moduleparam.h>" Z: U$ w. Y! P! C6 k+ E
  32. #include <linux/sysctl.h>/ P  y+ C0 x7 f
  33. #include <linux/mm.h>
    ' R! g' e" u/ T% k
  34. #include <linux/dma-mapping.h>
    $ a6 ^2 t! s, M9 q9 J
  35. 6 m) m4 _; I& v  P
  36. #include <mach/memory.h>
    . L, p+ |- w. W) D6 J0 f
  37. #include <mach/hardware.h>* [& q/ Z# E4 r( }( l" z) R
  38. #include <mach/irqs.h>9 V' o" v, F0 ~1 C
  39. #include <asm/hardware/edma.h>
    9 o% w9 g# U+ O" X
  40. ! m: i2 i; ~7 M2 W2 i
  41. #undef EDMA3_DEBUG
    ; O' [; N0 M$ i+ y3 l% _7 w4 u- E
  42. /*#define EDMA3_DEBUG*/, t, t5 l) R9 f5 L

  43. 0 x) W  T2 N7 O! B$ o' w; k
  44. #ifdef EDMA3_DEBUG2 W; ^' ~4 z0 n5 y( B1 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# Z3 h" [/ p1 ?! b$ u' ~; n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : w. d" b: q6 `3 X1 X( l/ x5 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 S7 ~# b* _' e) R
  48. #else$ ^3 y' j  K# \( k
  49. #define DMA_PRINTK( x... )
    - a6 K* p' K$ C' Z6 @8 X1 j! g: E
  50. #define DMA_FN_IN
    & E+ t! E" Y8 x' q# X6 u$ X- y+ [
  51. #define DMA_FN_OUT+ t& r4 J% E# c( b! c! H4 z8 s
  52. #endif7 X' L/ s; x$ M( D$ v3 e3 B; x

  53. ' t; [" c5 M9 W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      b3 w" X! l1 d! p5 b
  55. #define STATIC_SHIFT                3* g2 B- \/ c% Q8 u+ z+ S
  56. #define TCINTEN_SHIFT               202 l. V: Z. x4 f9 _: v+ d6 U
  57. #define ITCINTEN_SHIFT              21. Q8 C" r0 U+ b
  58. #define TCCHEN_SHIFT                22
    4 \2 {+ f) Z( I, h. m  W. e
  59. #define ITCCHEN_SHIFT               23
    0 f  ~% l, }- m9 r" e8 Z0 l, o

  60. 3 B8 @1 O6 z, `5 A
  61. static volatile int irqraised1 = 0;
    ) K; s9 R, U4 V5 b" K
  62. static volatile int irqraised2 = 0;
    9 n( D2 P& ^% w8 X

  63. 8 o/ [" |1 O% h3 k" K& D) J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 Z' A9 M* j' e4 l: d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + L. D' {' I0 ]0 u, q+ j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 B$ t9 I9 E+ `7 k7 e+ A

  67. 2 E! m/ x1 C9 q/ t5 P+ c
  68. dma_addr_t dmaphyssrc1 = 0;1 @) `, i5 K% X
  69. dma_addr_t dmaphyssrc2 = 0;# o) {) `. p/ i$ Z+ m
  70. dma_addr_t dmaphysdest1 = 0;
    $ z) W4 S* C9 g6 |0 @" A# w# q
  71. dma_addr_t dmaphysdest2 = 0;
    5 q' g* j6 J/ o8 n

  72. * T  E  V9 b) z$ c5 d  ?
  73. char *dmabufsrc1 = NULL;
      V8 l9 a8 E' A, Z8 Z# Y! \
  74. char *dmabufsrc2 = NULL;
    2 \) s$ n: C( A, o+ [* `
  75. char *dmabufdest1 = NULL;
    8 [$ t$ m7 P3 t9 g) L
  76. char *dmabufdest2 = NULL;( ?) _, J8 g0 s; f% l

  77. " E7 n  A: {# b9 x9 U6 B8 Z
  78. static int acnt = 512;* K) j7 E  }$ n% V3 U- l* A
  79. static int bcnt = 8;# a5 J$ o! {. ]+ e
  80. static int ccnt = 8;
    : [7 F9 ]2 b" I

  81.   b$ Q% _( M% F! S( ^- ]8 M
  82. module_param(acnt, int, S_IRUGO);4 X9 u! g. [/ p6 R3 X- w  |# U  M
  83. module_param(bcnt, int, S_IRUGO);" T- K4 \3 D) x, g0 g1 t% k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 E9 u2 t* r- M9 @/ `' A" o

  c5 V3 W- k( ^$ P% ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 a2 t+ b8 `6 M. `& o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 E" K6 N9 ?5 f; D. R: j2 G/ u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 T# N  ^* s: w/ d
" R! @1 i# N5 d$ X5 w2 A" k

% I9 ?2 o4 X) a6 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 09:29 , Processed in 0.038764 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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