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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# x, J/ ^1 a) b! D% Q
  1. [code]EDMA sample test application
    1 `0 I2 S. I2 \& L4 B2 ^! M
  2. /*9 `) b6 ]3 P* W0 E2 P
  3. * edma_test.c
    . e0 S$ L# Z6 z9 H2 ]
  4. *
    # B# ~1 R* C8 W8 a* g1 D  L9 `. i
  5. * brief  EDMA3 Test Application4 D) x  [9 P/ L3 J7 v- B3 j
  6. *$ J  w9 W) M' P5 M7 v
  7. *   This file contains EDMA3 Test code.
    - W" j0 b2 C: w2 o0 U' D
  8. *4 S+ v  W0 N5 ~* _/ R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( r+ G/ V; }" A% V, l; y0 d/ H0 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : Z0 q- x3 k! Z/ t# S, |! W' ?
  11. *         TO CHANGE.
    : d- R% ~4 P& }
  12. *
    1 i; c) x0 Z* ~( W5 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& e( A5 U5 n% R+ B! G7 M, C- y
  14. *' e8 `1 e4 g* `. p) z; G
  15. * This program is free software; you can redistribute it and/or. r2 `. _/ m1 S$ ]$ a1 Z
  16. * modify it under the terms of the GNU General Public License as1 E0 ]& ]; w) l* f* h
  17. * published by the Free Software Foundation version 2.
    ' }) u0 ^: S; m+ a: m0 w9 U- \
  18. *8 Y; @: g) |. ~& x  M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 N9 [" D; c4 m2 I+ A( H2 U5 R- y
  20. * kind, whether express or implied; without even the implied warranty( Z. \0 m1 N3 u9 ~$ x6 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! [0 W+ Y' y1 _5 f5 b2 B8 f2 C
  22. * GNU General Public License for more details.+ n# [0 t+ _1 f1 F0 `3 w2 P
  23. */
    # M# X2 l( c3 Q0 N0 `3 l0 w

  24. 9 ^# l+ E, k& }& q4 y, e4 G. Q6 g
  25. #include <linux/module.h>/ {: H; }, G+ _) M! Y& b% w) U' x
  26. #include <linux/init.h>( C  L/ g7 Y  r' r4 N+ {1 U' |
  27. #include <linux/errno.h>
    % k) U9 d1 Y8 Q' y- a" v
  28. #include <linux/types.h>
    : Y% A  T2 M; F8 r
  29. #include <linux/interrupt.h>
    " H5 k: ], G+ F9 w8 x% a
  30. #include <asm/io.h>: E9 P- L& t6 d* W
  31. #include <linux/moduleparam.h>: K5 a7 [: o% N
  32. #include <linux/sysctl.h>1 C% B$ R2 H* t/ S/ \0 ~
  33. #include <linux/mm.h>$ G- V' J' t6 d
  34. #include <linux/dma-mapping.h>
    ' [+ c3 K; O6 M9 N! _

  35. ' Q; j5 x% M' K1 R- q" f2 T
  36. #include <mach/memory.h>5 q& Q) g) L5 a
  37. #include <mach/hardware.h>
    6 Y; A' P7 R8 `2 P! p
  38. #include <mach/irqs.h># k7 h% N6 N) s- ~
  39. #include <asm/hardware/edma.h>
      S+ p) {: M& N* Z! T: b, m- p; ?! [

  40. , x* U6 A% T7 Z5 U7 p, K' u# ~
  41. #undef EDMA3_DEBUG" f$ R7 P% p: V% B' Z$ O
  42. /*#define EDMA3_DEBUG*/
    & Z# w- ~5 ~& s3 E) Q- d; R

  43. $ Y' v( x0 W$ j
  44. #ifdef EDMA3_DEBUG5 J8 `; O- k/ C4 N, C# n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . U% r% H8 E( c# `2 q) P0 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! {5 o- U! X" B5 k2 c4 ^% d. o  R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 _6 w. p9 E( W% C
  48. #else
    ! C: x! q+ q$ u
  49. #define DMA_PRINTK( x... )) Q+ A2 L/ H+ O# \
  50. #define DMA_FN_IN: t+ @7 G6 x( F# }( v+ h) i
  51. #define DMA_FN_OUT7 p8 Q; z: j% E! Y2 |( r
  52. #endif" l6 W* c2 [1 \9 w# w
  53. : s7 W9 x- x/ Z+ ?) |8 ?; r! H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* s' f- H9 r) E' X4 [0 X- L
  55. #define STATIC_SHIFT                33 k) B9 p" ]5 l6 s
  56. #define TCINTEN_SHIFT               20
    ; d( ?$ j: k; E" U2 {
  57. #define ITCINTEN_SHIFT              21
    ' l, t) b* g& g. x
  58. #define TCCHEN_SHIFT                22
    7 f0 M5 ^- B' M
  59. #define ITCCHEN_SHIFT               230 h) q3 o/ [% G) J

  60. + F) |$ n& ^& k$ {. @  x7 _
  61. static volatile int irqraised1 = 0;: I5 V( A' v& @/ w! ^
  62. static volatile int irqraised2 = 0;
    4 k: C( |* {9 P' y
  63. 7 Q5 |' y( s! \) D4 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 C! F: g* ^, V8 U' }7 P# ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : ~9 e. s5 V5 [4 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ ~! t) ~; P. F" u6 R2 p" _8 `) \

  67. 1 |) n0 n% Z. {8 ~% E3 j4 b
  68. dma_addr_t dmaphyssrc1 = 0;  Z! C' H* C' Y
  69. dma_addr_t dmaphyssrc2 = 0;
    ! |! a" ^$ r( Q; s- o* R
  70. dma_addr_t dmaphysdest1 = 0;& A+ Q) }; M( P( Q2 F
  71. dma_addr_t dmaphysdest2 = 0;
    8 A7 T' E0 c. N3 x5 Y- y) b

  72. " R4 d8 Q# h  A* |
  73. char *dmabufsrc1 = NULL;9 _! z! H: ^2 w  D
  74. char *dmabufsrc2 = NULL;
    . v* j" w  R. q$ G; J
  75. char *dmabufdest1 = NULL;! G0 D- z$ c+ A* n; j
  76. char *dmabufdest2 = NULL;
    ( r  l1 J5 B; l4 e# _3 h: V* y2 M

  77. % p$ u- o; U! j
  78. static int acnt = 512;9 j4 `6 h, k8 T
  79. static int bcnt = 8;
    2 Q6 d0 ~* }: b* `! E+ U: b
  80. static int ccnt = 8;) C; b" z4 d4 K0 e% H) ]: g" Y

  81. 6 T, U# P) I. q0 O# K" b
  82. module_param(acnt, int, S_IRUGO);0 c8 l) `0 G' j1 p
  83. module_param(bcnt, int, S_IRUGO);
    1 a. h# D/ r2 K. T# \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 ~0 S# W" p1 W5 ^: l# g

) J4 x( C" i* P: A) D/ z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 G2 A, l* E1 xarm-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! |: O6 ~0 g) I9 U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& _' Q2 S. Q( O2 }) c1 ~1 P! R" G" ?" d

  a5 Q/ F: E8 ?! J) ]$ M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 20:00 , Processed in 0.038107 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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