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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 y- a, d) O- w$ w# V  o0 v4 B
  1. [code]EDMA sample test application
    5 j, B' e# t% ]' \4 d% @8 }
  2. /*% l/ D, b+ B. P; [
  3. * edma_test.c
    5 q0 e1 t0 r7 \4 X4 B/ d
  4. *& c, U( _+ }% T  T/ V  j
  5. * brief  EDMA3 Test Application
    1 m8 v" Q" j9 N1 |4 v3 l2 D
  6. *. k8 K7 Y5 U! C: t! T
  7. *   This file contains EDMA3 Test code.# n  j% Z5 c. R4 d; U) Q
  8. *
    ' m! r) f; e, N/ k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 T  i( i) {; f6 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- @; k. ?$ M- \. t! h" V+ b
  11. *         TO CHANGE.: o8 ]2 J1 n' W7 l
  12. *5 H; T( a& T4 z- C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 F1 ~2 w5 H+ z: `5 H
  14. *. |- A* I6 L, p* |7 `
  15. * This program is free software; you can redistribute it and/or
    2 F$ j8 f  Y! l( L- o
  16. * modify it under the terms of the GNU General Public License as- A9 V3 j. X$ o
  17. * published by the Free Software Foundation version 2.2 [0 i* X5 z, g: `- ~
  18. *
    8 t6 P4 d$ r) @, ~: Y# {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 e- W* n; K& F8 ~9 x
  20. * kind, whether express or implied; without even the implied warranty* o3 g; }! y; H% m9 Q7 M& ~$ M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! O1 ?4 J; z9 p/ w1 S
  22. * GNU General Public License for more details.
    " g5 `% _2 O. m
  23. */! b9 K0 _& ?7 L( S/ m

  24. ' Z) O: d5 V; N. v
  25. #include <linux/module.h>* J$ \6 G: q! k. e
  26. #include <linux/init.h>7 A# M' |4 B! H# U1 N. u
  27. #include <linux/errno.h>% c) r. p4 A6 @" ?5 u" e6 s
  28. #include <linux/types.h>7 ?- U- F) o3 j( I/ j) h% h
  29. #include <linux/interrupt.h>/ W6 r' l/ ]) k1 k8 T$ j: c
  30. #include <asm/io.h>) Y4 {  b0 Z& |* O
  31. #include <linux/moduleparam.h>. k8 T: y( G, ^4 k" F
  32. #include <linux/sysctl.h>
      J$ y# X( `7 n/ z6 E+ v$ n
  33. #include <linux/mm.h>+ v* L) M- U+ T0 r$ P
  34. #include <linux/dma-mapping.h>, Q' i$ }: N" |  _' J$ F( _* H8 M

  35. $ Q- c. O" _0 o0 \
  36. #include <mach/memory.h>
    , w( L8 P. s3 l% t% h  E! o
  37. #include <mach/hardware.h>* o( t! f4 t- l" P) l5 O4 r0 p
  38. #include <mach/irqs.h>
    5 E1 m) l# l; k  n0 g# F
  39. #include <asm/hardware/edma.h>/ u! r, D# x5 b' k- u

  40. % g1 k) n! H. E% G6 N
  41. #undef EDMA3_DEBUG
    8 e0 E8 X- T% H# H+ V8 d
  42. /*#define EDMA3_DEBUG*/
    . d, g+ S# o8 t. h4 i+ y' _9 Z. H

  43. ! R1 B: ^& P( {0 K* Y
  44. #ifdef EDMA3_DEBUG5 ^+ `0 q7 G4 U( g- N% C9 E$ `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 M- E" \+ f( _+ z8 G  i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 l7 U, v6 E1 R7 u- x9 [1 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# ~7 S  l9 F! i4 N+ @
  48. #else
    5 l. t( [& `2 s5 @5 n( J
  49. #define DMA_PRINTK( x... )
    + B# ?- c0 C; |
  50. #define DMA_FN_IN6 z6 T9 F5 d1 ~- P- d/ \  f
  51. #define DMA_FN_OUT/ U7 X! U( {' b0 N# g
  52. #endif
    & }- H$ Z" n. g
  53. ; ^: Z- _* j; N( q5 [- L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 M* Q: ?% {( @5 @; P5 J- q9 Q1 j
  55. #define STATIC_SHIFT                3
    4 R' h3 e4 [# m) P3 M1 f
  56. #define TCINTEN_SHIFT               20' ]6 G+ k* Y$ s6 l* J8 T( d
  57. #define ITCINTEN_SHIFT              21
    4 Z- N: [  Y  f8 l6 _6 [* M
  58. #define TCCHEN_SHIFT                22
    2 x/ S: O/ S& x% \
  59. #define ITCCHEN_SHIFT               23
    9 ~- {) c# I$ T, [$ M5 {
  60. ' Q6 p# q8 C3 }0 g5 ?  A
  61. static volatile int irqraised1 = 0;# t" S0 E! T4 X
  62. static volatile int irqraised2 = 0;. a8 `" w" Q/ E" G" @( T

  63. ; H, i$ {* |3 U* G9 C+ F: q# C$ z9 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) I; C% j  p2 z! |- l; f  `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 N$ ]9 }7 w( f, e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Q) M( e) {+ J$ O1 ?4 x/ t

  67. $ U. f% A* U2 C. m
  68. dma_addr_t dmaphyssrc1 = 0;- s  N# ~$ ^8 U3 I& `
  69. dma_addr_t dmaphyssrc2 = 0;" N( j1 n( Y( t
  70. dma_addr_t dmaphysdest1 = 0;) S! g8 a6 z, N) m
  71. dma_addr_t dmaphysdest2 = 0;
    # }! m3 U: b0 |' C* O
  72. # U) m* s6 ]! l6 j
  73. char *dmabufsrc1 = NULL;6 J. G( y0 I; p# D$ m
  74. char *dmabufsrc2 = NULL;
    " h) F7 G+ O. v. w% H  `) J
  75. char *dmabufdest1 = NULL;
    % e9 ], U4 N2 A, M
  76. char *dmabufdest2 = NULL;
    . g5 k& j1 ^. G* u7 t  q4 f
  77. . X& t, u( o6 G( C! {
  78. static int acnt = 512;' ^* r) z; W- Q. I( i5 B
  79. static int bcnt = 8;. S4 v, t' }: S  }, z
  80. static int ccnt = 8;/ d& X  a' I8 X

  81. 4 A$ S7 R: Y6 {( Z1 C: t: Z) m. u
  82. module_param(acnt, int, S_IRUGO);" b# f# \( z9 S7 s  |- [4 f/ a
  83. module_param(bcnt, int, S_IRUGO);/ M  M' g0 ]- x6 T' Q- Q, _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 q; z( O' i3 ^$ C' y) l
- _, R( S- z' c# C1 M, G6 g: T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 ^9 e+ ^( e$ o) f9 A" Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& T' z4 n4 T0 P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% V; d: O, l: K8 [& ^1 m$ Q
/ P4 C/ B1 j3 w. e$ x& ]$ ~

- S) S4 o2 |% V; R5 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 06:51 , Processed in 0.038589 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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