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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " A+ q0 S3 z6 W: D
  1. [code]EDMA sample test application# i2 X1 P0 {2 Y& i
  2. /*
    # _0 h! |# Q! C3 L: t* V- O& a8 M
  3. * edma_test.c
    : L- b, s) G; ?* ~5 M+ C- |
  4. *7 L+ m) k  [% w0 j  ?7 r6 I
  5. * brief  EDMA3 Test Application
    " a5 H  I0 q7 m! J. ~& `# Q
  6. *8 J7 P. o3 R7 t7 Z% a
  7. *   This file contains EDMA3 Test code./ \7 `) M( U; a) p2 ~- v
  8. *( i# a3 Z. Y, F+ z& q* Q) Q9 L9 N8 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 n+ M$ H4 S! ], R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " a2 T/ W6 C' J% E7 F: p
  11. *         TO CHANGE.  L8 [/ R! W" R; v5 d& @
  12. *2 x1 w2 m6 s  d' z3 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , \' G$ [# _3 |5 K1 U5 U
  14. *
    & O/ V! z+ G; }* ^" Z
  15. * This program is free software; you can redistribute it and/or
    $ a% s+ B  h# |2 _5 ~& Z1 z
  16. * modify it under the terms of the GNU General Public License as/ c' r# B- c! P. r- }, Q
  17. * published by the Free Software Foundation version 2.- d1 j0 }$ @, A9 x8 l- R
  18. *
    ( B9 d& f# i. F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % H) {! _. D' n
  20. * kind, whether express or implied; without even the implied warranty
    % z# @% n$ `8 i. I. n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( s! B. m+ k8 Y; I5 m* ^
  22. * GNU General Public License for more details.3 h7 M, s" x* ]8 S8 Q  a0 L
  23. */
    ) C; b7 `' C  T% B: n/ w
  24. 6 L1 ^  |! Q4 q7 H" V! [6 ?
  25. #include <linux/module.h>5 [# ?, @# |3 }
  26. #include <linux/init.h>" v/ [6 R+ B  c/ v/ l! L
  27. #include <linux/errno.h>) E9 a4 P; S* G7 }) a9 S
  28. #include <linux/types.h>
    ! L' ]# U6 w4 ^# r2 ~: l
  29. #include <linux/interrupt.h>
    " g; e. j% t( t/ I
  30. #include <asm/io.h>
    * D: ], Y, |; e) \7 b9 M# a
  31. #include <linux/moduleparam.h>
    7 z" R* g' B% R6 @" Z
  32. #include <linux/sysctl.h>
    3 {+ B0 I- R, S
  33. #include <linux/mm.h>
    % Y6 @; P! t! U1 k& S  p7 s8 _5 A
  34. #include <linux/dma-mapping.h>
    ; T+ A9 `- F( B! v
  35. - i0 q9 C& a8 X! t) @! b
  36. #include <mach/memory.h>: c- W' f2 D! F- _. ?- {
  37. #include <mach/hardware.h>
    " ]+ m0 H  H+ |/ l: G) s
  38. #include <mach/irqs.h>, }5 H3 S3 ~' f2 M, z, q
  39. #include <asm/hardware/edma.h>) D; d$ r. |" t+ l

  40. " r0 F4 _0 g  ]& ]3 I9 f
  41. #undef EDMA3_DEBUG& q* Q1 G% ^0 i( X# P2 N+ G
  42. /*#define EDMA3_DEBUG*/5 Y, `  W$ v- S: o2 y$ B  }

  43. % g3 u- J4 X8 `' \5 S
  44. #ifdef EDMA3_DEBUG3 m9 f! P9 N* f1 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . `/ M3 r( r- R6 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ _/ |9 Q! Z5 E  n. \( B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ^( O2 `4 d: C/ _. o! Q# W5 K, J
  48. #else
    * m( i' x) b2 H* \+ r  I
  49. #define DMA_PRINTK( x... )# ~5 n$ c' a0 @2 J
  50. #define DMA_FN_IN
      b8 h6 a4 C9 S3 j6 l
  51. #define DMA_FN_OUT" ?7 ?- ~2 i* f. H! j
  52. #endif0 y" F! n2 ]" @, X/ s4 O& p
  53. 5 j7 X8 _( a8 h" {8 l7 Y( r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * v- f* M8 E4 C
  55. #define STATIC_SHIFT                3
    0 T- W6 r4 J' h9 A
  56. #define TCINTEN_SHIFT               20
    , N0 O! X: w1 a5 m
  57. #define ITCINTEN_SHIFT              21! h( @! z+ @$ l: R/ c( F
  58. #define TCCHEN_SHIFT                228 C6 |+ p( G0 w$ }
  59. #define ITCCHEN_SHIFT               23+ D! ~1 ^4 N$ g6 R6 B% h& p

  60. ( w$ X6 {* p- l8 s
  61. static volatile int irqraised1 = 0;
    3 K2 `' m& c2 d# c- y& D2 e% j9 t' ]
  62. static volatile int irqraised2 = 0;
    ' p& r* M2 u( y3 q) M. p

  63. 2 o2 g3 K$ k. |, K- }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # `* x: D+ U- a& m" L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 `3 A' a0 N9 y% S  R4 [3 \8 p2 u2 [% r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * }% E/ |* Q0 Y0 O) s' D* i
  67. % u; P9 Q/ e- S. I$ s6 H
  68. dma_addr_t dmaphyssrc1 = 0;0 d' e9 e- ?9 ]! ^1 Z5 I
  69. dma_addr_t dmaphyssrc2 = 0;6 f, F' ~* T& E( C9 X( M
  70. dma_addr_t dmaphysdest1 = 0;  L3 k7 _8 t+ e  C7 j
  71. dma_addr_t dmaphysdest2 = 0;/ W4 a" Y% c! k! \/ x

  72. . }4 `& j2 C  c- t
  73. char *dmabufsrc1 = NULL;- B+ V  {7 X0 k* E8 ?8 q5 y( l
  74. char *dmabufsrc2 = NULL;  y2 q! X9 R9 c! `- R8 }
  75. char *dmabufdest1 = NULL;, u& m5 P& g5 l
  76. char *dmabufdest2 = NULL;9 a1 q, w8 N) _/ m

  77.   W4 w5 ?8 }. \1 `
  78. static int acnt = 512;
    6 V6 ^9 ?1 |; h
  79. static int bcnt = 8;
    4 }7 C- y* S( U' [
  80. static int ccnt = 8;1 G. X- Z; A) b! i. ~  k7 i7 Z
  81. * p1 R3 _& n4 h2 y2 t# ?# |0 W
  82. module_param(acnt, int, S_IRUGO);" b# y% B% i" ]- F
  83. module_param(bcnt, int, S_IRUGO);/ f) I! P& o$ s6 U# H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! ~/ e2 [5 Y  V9 W& ^$ V

4 p, m  y# X, m# {5 W+ m+ }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 m2 O+ L+ c) M; S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, v  S; `0 X/ I" A/ w  v5 M" H( a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( i" t! X" v3 c8 Q
4 `/ L" i& O: y% N$ f

' r3 ~! }0 P/ V4 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 04:22 , Processed in 0.035491 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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