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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# M8 d' z2 Z; e; s) I. i
  1. [code]EDMA sample test application% V2 t- l; `. I1 S1 G
  2. /*
    ' ~% h7 t6 L0 }3 F
  3. * edma_test.c
    " ]0 z3 O* w' L
  4. *7 v, r" d7 Q& N) s+ p/ L
  5. * brief  EDMA3 Test Application
    4 m$ u5 x, S$ _1 a/ v( Q0 x: E
  6. *
    " M5 }  O, ^+ q. ^4 I
  7. *   This file contains EDMA3 Test code.
    ; c! U$ V, k9 ^! l4 _+ H* c
  8. *( ~, l9 y# J8 @2 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 i- S) _+ w% U+ g; n4 ^1 O/ n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . S* t, [9 B1 I
  11. *         TO CHANGE.
    . Y& J( n2 O/ Q# }  ]7 C
  12. *, t! X! ?5 J" C  `* P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! _! I6 P, Y+ d. w
  14. *- w% c2 }/ j7 n  b
  15. * This program is free software; you can redistribute it and/or
    " B+ Q" k6 Q( B2 Z
  16. * modify it under the terms of the GNU General Public License as% M6 L& D; S+ l* }% G6 T
  17. * published by the Free Software Foundation version 2.+ S: `( j5 W& a' n' S7 @
  18. ** d! o- T2 p3 I) x$ ~7 y( k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ V' v3 L4 h: I
  20. * kind, whether express or implied; without even the implied warranty
    ' C# ~0 W, x& ^6 r! e% w6 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " S  r0 `$ X; ^. d1 {* ?
  22. * GNU General Public License for more details.
    & A9 R3 s1 ]; @  s* V' H
  23. */( z* \$ q. P& K' N6 D7 g6 @. }

  24. & L6 h  N! }0 J
  25. #include <linux/module.h>
    9 L0 J/ u7 u. e. O: n; B
  26. #include <linux/init.h>
    . F7 a8 Y" {7 L* h5 S
  27. #include <linux/errno.h>
    9 f6 C: \8 Z7 R0 H. |/ N$ b
  28. #include <linux/types.h>
    " t1 L! m" O; z& Q
  29. #include <linux/interrupt.h>) c+ n5 j- ?) I: n
  30. #include <asm/io.h>7 v+ e) o; i6 O
  31. #include <linux/moduleparam.h>2 Y2 I/ E/ ~  Z) I
  32. #include <linux/sysctl.h># ?6 Y: B4 B! j" [; K3 C
  33. #include <linux/mm.h>
    3 F1 g; K# I% b. c1 a/ v6 g: Y
  34. #include <linux/dma-mapping.h>& f6 Z* u# B( p5 x4 }$ v
  35. : e) C  A& h7 M, @
  36. #include <mach/memory.h>5 Z( y4 ?9 q& w( k0 P
  37. #include <mach/hardware.h>+ l* e$ S1 Z3 H# ^" `& W+ p' J
  38. #include <mach/irqs.h>
      s7 B, ?8 a+ _
  39. #include <asm/hardware/edma.h>
    # n. x; [: ~$ U  M
  40. 9 o6 w- V& K; [! H/ a
  41. #undef EDMA3_DEBUG
    3 f) E3 W% @" d
  42. /*#define EDMA3_DEBUG*/1 m4 k9 u0 A$ W
  43. 1 j% x1 t. w) p/ ^; o+ a& g
  44. #ifdef EDMA3_DEBUG
    7 ?/ q: D+ D& |( N: j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 I! C% x3 m% o# U" b; h# S! C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& n/ }+ x/ s3 ]' V/ I) X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - O9 X" a) ~; r; ^: v, L
  48. #else$ g' l7 y0 A+ M3 B- A) t
  49. #define DMA_PRINTK( x... )
    8 K: x  y. J7 B' ]0 P
  50. #define DMA_FN_IN8 R+ @+ T  h* R! n! ?! h
  51. #define DMA_FN_OUT
    * M: _& Q1 `7 {; s. ]
  52. #endif+ ^" ?3 d' z# W6 m7 W( @: Z
  53. + u4 f4 h$ h3 q3 b- Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 v; Z: ?0 s$ x5 K/ c
  55. #define STATIC_SHIFT                3
    ; W  t! v& r* ~! Y& O7 Z
  56. #define TCINTEN_SHIFT               20; M- }5 S6 j3 M
  57. #define ITCINTEN_SHIFT              21
    2 \' h" S/ p' k: r* q+ r
  58. #define TCCHEN_SHIFT                22
      S' x0 L2 g' {  t0 n
  59. #define ITCCHEN_SHIFT               23
    + V; f% d2 u8 `! ?7 k$ u
  60. ) ^' g+ }4 Q' T
  61. static volatile int irqraised1 = 0;6 F3 z9 B9 H+ V
  62. static volatile int irqraised2 = 0;
    * ^- s5 i4 |1 x7 i( J' D$ m

  63. ' k# s' A* _" B/ A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ {% a% L6 w+ B- l2 ^8 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a' v! b% x" ~9 P* q8 q9 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - {. V8 o& Y  A6 \/ w
  67. - A/ \. W8 D" _) B: ~9 z4 R
  68. dma_addr_t dmaphyssrc1 = 0;
    - Q9 o: g0 P6 B4 W9 Q7 d
  69. dma_addr_t dmaphyssrc2 = 0;
    ' r1 b% d: W7 z+ C$ n. h0 @# U0 y
  70. dma_addr_t dmaphysdest1 = 0;
    " u, u  Q, x. l& o8 d
  71. dma_addr_t dmaphysdest2 = 0;
    5 a# J" j( \9 m% ^5 u- T5 O) i  V+ J* t

  72. + R8 ?" H0 C. N* z  Z
  73. char *dmabufsrc1 = NULL;% C2 \1 u1 A7 y# R: V
  74. char *dmabufsrc2 = NULL;
    0 L  ~! ?5 l/ M; m
  75. char *dmabufdest1 = NULL;8 G/ K9 y4 P$ f) Y- R: k& Y
  76. char *dmabufdest2 = NULL;8 M; l1 v9 p, k0 g$ ]

  77. 8 f) Y, w1 H5 V1 l
  78. static int acnt = 512;
    5 S/ |+ x: S% o# Q5 N& C- T
  79. static int bcnt = 8;
    4 `: P: m& J9 H
  80. static int ccnt = 8;3 v6 y( v( n* Q1 X3 s  C

  81. 4 g/ a3 h0 T+ S* Y, g
  82. module_param(acnt, int, S_IRUGO);
    1 I3 d- D: a. b  q* c# w0 P+ k1 C' S
  83. module_param(bcnt, int, S_IRUGO);
    4 G! M# q" y, |4 p% z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 y( Y) ?3 N3 F1 ?

" J3 h% w, ~& @. `# t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 G, S6 j* v* Y* b5 V( U! s' K# ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  Z+ L- X' L6 E, p$ ^: b3 R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  B; t2 V. @, ?4 m8 Q. _

8 d8 ?# ?1 g( _% v. @
. `: a+ `7 B3 n" X4 j7 b5 M& e  S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 01:56 , Processed in 0.039675 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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