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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : C* _; Q: E# V# Z$ G. l
  1. [code]EDMA sample test application
    , |  e" Q6 l) y* _' h4 G. Z; X
  2. /*/ W2 k" S! N% q; P# [$ D
  3. * edma_test.c7 X6 X; B2 _7 Z" I
  4. *! C7 H+ b) D. u# I
  5. * brief  EDMA3 Test Application
    2 U5 Z/ t& l( h& N& k. s0 W
  6. *0 e5 Y! f3 S7 {7 d5 @) l
  7. *   This file contains EDMA3 Test code.9 e' {9 ~6 N1 T" h: Y* [
  8. *
    - B7 d8 a# o1 X; B) H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# |+ [. z) W( h9 i. x/ G7 T6 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # r. i; r9 |) n% A6 C5 {; S
  11. *         TO CHANGE.
    & e& e5 u6 Q( a* E9 \
  12. *
    1 N" g" {- `5 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) e( I( h1 t+ G4 ?9 ?3 K3 U: {
  14. *
    ' t8 P4 c- n/ }  h# i
  15. * This program is free software; you can redistribute it and/or
    - C2 F' D' i4 l- t' S( N* z; N- |
  16. * modify it under the terms of the GNU General Public License as. T6 M. l# X; k0 t
  17. * published by the Free Software Foundation version 2.
    : K: \1 z2 z. v9 p' a6 X
  18. *& U; Y8 @: c6 z9 j6 d/ f& J" y8 l0 Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' J" J. E! O3 ^( V
  20. * kind, whether express or implied; without even the implied warranty
    + U+ b, ~; C) v4 |- ]3 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' X4 H; @8 \5 [/ l' B/ R
  22. * GNU General Public License for more details.- Y- y. J1 @+ }' l; j2 b
  23. */
    6 m# W% k) V$ ?' t+ R; J- f: Y6 [# b

  24. % J& n4 S/ z5 l2 C7 r3 }0 g/ t
  25. #include <linux/module.h>
    1 G: R: u/ a7 W$ t2 j% k$ A+ ^1 D
  26. #include <linux/init.h>" R2 D9 h* m9 G' E- n' D4 t  y$ W0 Y
  27. #include <linux/errno.h>8 d$ S9 P; S, `& v
  28. #include <linux/types.h>
    / X( p. @( l! G4 v
  29. #include <linux/interrupt.h>
    $ E- ?. C3 ?' |4 z+ v2 Q; l
  30. #include <asm/io.h>
    7 E. W: y+ [! ?- w+ ~4 _: I
  31. #include <linux/moduleparam.h>
    5 a* F  u. L# k# n; C8 }2 C
  32. #include <linux/sysctl.h>
    0 V$ L8 \$ E, ?2 w
  33. #include <linux/mm.h>
    4 h! d0 v( ~* X# B) B/ ~8 G
  34. #include <linux/dma-mapping.h>
    & i: e+ {2 C! R' \( J

  35. , u( I. p3 D0 W$ j: U) i
  36. #include <mach/memory.h>
    ( A6 d) G4 R, \0 a* @
  37. #include <mach/hardware.h>
    4 `) V/ d3 G1 b7 B
  38. #include <mach/irqs.h>
    + Q" a5 x8 I) w2 D" D1 \; @8 Z
  39. #include <asm/hardware/edma.h>
    " ^1 @4 w% i, J) g0 n

  40. . T# B% T+ }1 Y: k# Y
  41. #undef EDMA3_DEBUG. Q4 H6 s: M$ h# u9 d) o
  42. /*#define EDMA3_DEBUG*/% W# P8 \1 B* I" {* }2 J
  43. 3 b; \0 {6 n2 S8 C
  44. #ifdef EDMA3_DEBUG6 T1 M5 B- k# m2 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- w: y+ M+ Y& f1 Q/ W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ n- ^% W" \2 Y  i; @; ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 n, u. I) C" F( m
  48. #else
    ) i$ _( ~* z' X
  49. #define DMA_PRINTK( x... )
    ( G* i; u6 r3 }1 I
  50. #define DMA_FN_IN
    - b( }) U0 m* Q. _4 }+ p3 ~3 j
  51. #define DMA_FN_OUT5 x1 M# I- C( H* c) K
  52. #endif
    0 N/ |5 J3 v  {) ^

  53. ) ^. g% g3 A" v3 K- d- y# J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ S6 i5 R' k( ?# d/ G) a
  55. #define STATIC_SHIFT                3, q9 |7 f1 a( |# v: Q% B
  56. #define TCINTEN_SHIFT               205 a9 _" H$ x/ K( ~& D
  57. #define ITCINTEN_SHIFT              21# J' J) q/ m0 h
  58. #define TCCHEN_SHIFT                22# d( B% L3 Q/ [* L2 S* c6 H6 V
  59. #define ITCCHEN_SHIFT               23
    8 B* n% Y0 @  o2 n" o. O; F8 ~8 j; i
  60. 5 e' B/ e0 d! G
  61. static volatile int irqraised1 = 0;
    . H2 w6 u" l* I6 V
  62. static volatile int irqraised2 = 0;) y/ w6 l& y0 b6 K5 ?

  63. , j6 W; d! J+ d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  M* V% ]6 b: I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 t7 a: O  @' c( @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ]8 ^) g. p* R3 \  E9 ~% T4 M
  67. 7 J& J( _1 ]# d3 Y0 _/ j, W
  68. dma_addr_t dmaphyssrc1 = 0;% s/ y$ j0 [8 B- K
  69. dma_addr_t dmaphyssrc2 = 0;
    0 ^- ]3 z- G- P: r6 z& s
  70. dma_addr_t dmaphysdest1 = 0;
    , l' {$ E# |& c& o
  71. dma_addr_t dmaphysdest2 = 0;
    2 u) @. {1 u9 @9 l& B, h7 t1 i
  72. - s8 m, c; j* ]% ^, T! r
  73. char *dmabufsrc1 = NULL;
    * |7 [( s# M6 @* o0 o# q
  74. char *dmabufsrc2 = NULL;
    0 q: j6 G4 e* g; h
  75. char *dmabufdest1 = NULL;
    ; I! Q' F% f0 j: N9 t) p+ A
  76. char *dmabufdest2 = NULL;2 V) _, I6 S/ p1 P2 E
  77. ) ]8 s% V* a4 Y9 y
  78. static int acnt = 512;
    " @9 @5 j5 x3 Z6 l  D
  79. static int bcnt = 8;
    ; F+ Z" T4 k# i* F+ Q
  80. static int ccnt = 8;  I- m8 F' e5 V6 {
  81. & E* A: j7 z3 E' q% t
  82. module_param(acnt, int, S_IRUGO);
    9 E. ?& u: H- R4 s) ]
  83. module_param(bcnt, int, S_IRUGO);  y$ _- r8 M' m! I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( T! q, X! i! p6 A- K0 B! @
: B8 O. F+ n$ r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. X$ E& s; ]# c5 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# W5 n3 v+ N8 N0 h7 }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 O# G" T. |, I0 E% y6 K) ^9 x+ Q3 b: g) m6 q
- Z2 r9 S' V( L, U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 20:46 , Processed in 0.040331 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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