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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ b) d7 w/ ~2 q: M
  1. [code]EDMA sample test application
    ( [1 S4 i. E* L, F) j; s
  2. /*
      I* R1 Y9 T% H/ _& ]; }
  3. * edma_test.c; X; b* N5 B, k2 h4 K( B, m
  4. *
    ; C# \3 }" x' M( G7 H% \
  5. * brief  EDMA3 Test Application
    * K3 D0 H$ s' ]1 V4 r
  6. *5 h; e* y  k# Q& J/ ~9 R0 v
  7. *   This file contains EDMA3 Test code.
    8 D1 b& b7 ?+ \# l. R
  8. *
    ) [5 ]( q# \; c5 [( Z4 o- p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 b' `% o# o9 |8 B6 Q/ h$ R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ ^/ x8 f6 k8 N7 b) _' c
  11. *         TO CHANGE.
    ! N! m7 ^: j7 E, \
  12. *
    6 h1 i8 {" i4 o9 D& v, S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + L' G3 \1 |7 ?- G/ \
  14. *3 m$ y- d# S3 s* ^; d
  15. * This program is free software; you can redistribute it and/or
    3 X1 j8 D+ B) M" q4 E
  16. * modify it under the terms of the GNU General Public License as
    " q3 u% ]8 g$ ~8 s5 m, A4 x
  17. * published by the Free Software Foundation version 2.
    4 R* d; R. _' y5 o0 k
  18. *
    ( ~& n+ |' [. |8 k, n" m3 ]9 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! Y) q* p( I/ Y4 I& D2 r( o
  20. * kind, whether express or implied; without even the implied warranty
    7 W# n6 N2 K8 M1 n) V. p7 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 `7 b- h# k3 ]* z+ _
  22. * GNU General Public License for more details.
    . n; G/ I/ [4 \4 |- G$ @. v
  23. */
    - L* Q, @8 _& C1 o) N. F: x# g
  24. 4 J5 h* U' N1 q0 Y
  25. #include <linux/module.h>
    / H( \( t' C+ s- M& ]1 D
  26. #include <linux/init.h>
    0 V4 v# a7 ]* z1 `/ `, [
  27. #include <linux/errno.h>5 q9 @. G7 j( s) Y; F" ?
  28. #include <linux/types.h>. `( f7 A* k$ z( o  c/ e
  29. #include <linux/interrupt.h>+ S# v* D+ O: W( i8 ?0 k
  30. #include <asm/io.h>
    ; q8 {' k7 w- y3 B9 Q5 E. B' s
  31. #include <linux/moduleparam.h>
    1 U( @6 G/ y. q
  32. #include <linux/sysctl.h>; G: M( Y7 O0 R$ A2 B9 o) `
  33. #include <linux/mm.h>, w* k- c. e3 ^7 p# E0 T
  34. #include <linux/dma-mapping.h>5 a. ?0 T' I$ e- [% z
  35. . z6 g. {2 B5 I$ D
  36. #include <mach/memory.h>' M' R& O% }+ S. b
  37. #include <mach/hardware.h>
    5 a5 |. G# S! f) m/ P$ M0 q
  38. #include <mach/irqs.h>0 ~6 \* K1 |2 t  v
  39. #include <asm/hardware/edma.h>3 u* _  b' k6 R* W( h! i+ C
  40. % v5 g5 b7 a' O2 Q
  41. #undef EDMA3_DEBUG
      g0 Y- a; {1 g4 q& n; {) S
  42. /*#define EDMA3_DEBUG*/+ W7 P6 Z1 {1 F; P

  43. ; c2 M$ z$ P8 _1 i$ `8 L& {" v
  44. #ifdef EDMA3_DEBUG, \8 H' D/ `- w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & K- i$ J2 W8 F6 h- K0 j3 G8 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % W* k; \1 H! K& f6 g% N; @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ V: P0 b8 ~- f3 _
  48. #else
    ; O! z4 D2 W" i+ g+ I
  49. #define DMA_PRINTK( x... ): E% k1 P/ v8 W& M, R8 T4 c  \
  50. #define DMA_FN_IN; \1 K1 h; |9 A' K/ e2 m
  51. #define DMA_FN_OUT0 d. @- V! [! p" r; ^0 p4 @( G
  52. #endif
    ; Z. }. e9 K2 `! ?9 o& _

  53. ! @# ~) Y) b0 s. B; ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) c5 x" {4 A/ N2 H$ |
  55. #define STATIC_SHIFT                3  p" y/ A4 b$ q5 v6 \+ m
  56. #define TCINTEN_SHIFT               20
    # ~0 N  D0 Y/ b4 `6 c( H: f5 m
  57. #define ITCINTEN_SHIFT              212 v7 T3 S$ l; T0 Z
  58. #define TCCHEN_SHIFT                223 ~; \- e! ]5 \$ p' l9 H
  59. #define ITCCHEN_SHIFT               23
    7 i' |* S, u  k7 e7 [3 ?
  60. 0 t5 P2 v6 `1 F
  61. static volatile int irqraised1 = 0;
    : X2 s/ }2 O) S  l/ Q. v; V
  62. static volatile int irqraised2 = 0;
    2 ?3 T( L7 g1 ~$ {8 M

  63. 9 w: Q/ A8 f& F  }  d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * x, b* m7 w; p' N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . A3 [0 ?* @0 n" B6 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 F* l& I! W2 ]0 H$ _6 C
  67. / Y( O4 g' o. z- Q- z; C3 n
  68. dma_addr_t dmaphyssrc1 = 0;
    . ~8 f0 s0 {  o' ?; n/ ?+ N
  69. dma_addr_t dmaphyssrc2 = 0;4 s. n9 e7 A5 ]: A
  70. dma_addr_t dmaphysdest1 = 0;; S7 M& ]8 u  V/ p
  71. dma_addr_t dmaphysdest2 = 0;
    9 U) g- U3 Y* F- ~0 T0 J& @2 K- M

  72. 4 S$ L3 H" P7 k0 ^/ H
  73. char *dmabufsrc1 = NULL;
    # s9 n  I" a3 o
  74. char *dmabufsrc2 = NULL;
    % S2 x0 C5 R5 T; E  p. Y2 M4 n- p3 B
  75. char *dmabufdest1 = NULL;
    ; Q  c& C% V6 F9 T
  76. char *dmabufdest2 = NULL;9 e5 \7 L' y7 `' N- B/ d9 p

  77. . q! S" ^) V$ G* e
  78. static int acnt = 512;2 M) I2 H& v( J
  79. static int bcnt = 8;9 ^* _# w- l) |$ {7 A5 t
  80. static int ccnt = 8;( L, P* B- R# e) s

  81. ; I' L5 X" {7 E, ^9 X
  82. module_param(acnt, int, S_IRUGO);
    # H% S0 _  T3 D
  83. module_param(bcnt, int, S_IRUGO);
    & N+ I7 Z, G; x' u7 K3 a8 A9 }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ M. P; g: ?6 u. j

6 f1 ?! V& F) N3 l# J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( t5 w+ w7 r( D4 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ y( j; \( B/ V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, t7 _! ], I6 y/ @8 ^" F+ L; o2 U' X/ m9 `

+ c- D2 _$ `+ t" i$ `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 05:46 , Processed in 0.038973 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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