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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. F7 {+ K! E1 s  n
  1. [code]EDMA sample test application, f. }: X' b7 V: @! D' E* q
  2. /*
    ; g( `6 e4 v6 y7 F0 _1 P
  3. * edma_test.c/ P6 h+ l! \) N, Q3 t5 C( b$ h  J
  4. *
    ( S" r. Y* T# e
  5. * brief  EDMA3 Test Application9 }* _+ h' C5 r
  6. *
    6 L% a/ w' ^9 [* z: e( F, u
  7. *   This file contains EDMA3 Test code.& j1 U; l! \4 ?- G0 K- b1 }* `
  8. ** G: n- Z6 c: V9 b* {! w3 ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * f- W. d: d7 e/ M0 z7 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. c" s+ W; D# q$ O2 q3 h
  11. *         TO CHANGE.
    % H: v5 N5 `9 u% @4 x- z8 P9 i2 D' ~* i
  12. *. Z2 p2 t* M' {0 G/ ~( O6 N" g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! W8 p; w1 Y+ E6 q/ G% _7 A
  14. *
    ( ]! n2 U/ P" A$ M  Y! G
  15. * This program is free software; you can redistribute it and/or9 l' ]  j- t$ s, m" B( P" X2 k$ @
  16. * modify it under the terms of the GNU General Public License as
    $ P: Y2 ~5 m5 {$ ?6 D0 y: L
  17. * published by the Free Software Foundation version 2.5 m$ j" Q$ H) R8 a& v/ B
  18. *
    # W; z+ r' n& \5 J6 K/ D' [) v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * ?! q  x" G/ x3 z& l
  20. * kind, whether express or implied; without even the implied warranty
      ?) {* L: t5 J3 d3 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 F6 B$ I8 s: {! }' s! Z: `+ [' q, p0 D; V
  22. * GNU General Public License for more details.
    6 D: a# S: x. v7 ?$ _5 Z& V0 _' E
  23. */
    # g5 |7 p3 A3 m: v6 N" [
  24. 6 c' s( H% A1 w# `/ {8 B
  25. #include <linux/module.h>- Y; x% j) g# l. a9 k
  26. #include <linux/init.h>1 Z  U. C: j) D; L8 ~  s
  27. #include <linux/errno.h>& J2 c+ Y: s8 {+ G- b( Q# s$ c
  28. #include <linux/types.h>
    / K' y; u( [( @& v8 J# d5 Y$ Z8 O2 ^
  29. #include <linux/interrupt.h>
    7 i$ l: k. h8 Y/ t/ F
  30. #include <asm/io.h>) ~7 g; D$ t% R
  31. #include <linux/moduleparam.h>4 ?2 H0 }8 }  A
  32. #include <linux/sysctl.h>- C, ?/ h0 v. s: W. P$ j
  33. #include <linux/mm.h>! ^; s( R/ n' `+ D8 Q& X* K
  34. #include <linux/dma-mapping.h>: L' V: v7 l, J1 P

  35. 0 \; L' C9 z1 R+ {. P, g% |3 {
  36. #include <mach/memory.h>
    8 ]+ Z- I1 \6 J2 r5 X
  37. #include <mach/hardware.h>: C6 B4 O+ m1 `( j4 ^) |$ @! V4 P
  38. #include <mach/irqs.h>
    ; _" Z9 c+ y5 ?2 w3 |
  39. #include <asm/hardware/edma.h>
    ( f, k' f# |6 ]7 x6 B, p5 V3 h

  40. 0 M) g6 E# Z! d2 I- z* f4 V
  41. #undef EDMA3_DEBUG* O* O; Y1 _7 t  i4 Q
  42. /*#define EDMA3_DEBUG*/
    - Y6 b! v' u7 O9 ?3 j- }2 W

  43. / X) C- E* I7 K; }* h
  44. #ifdef EDMA3_DEBUG
    6 @6 S% Q# H/ V  U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& `: }1 N2 K; ?. ?0 J) B% c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 s* R4 r) A) L/ y- X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : O# ~& E( j$ I  \
  48. #else
    + l. g! `& v. O
  49. #define DMA_PRINTK( x... )1 j' [9 R: o9 w8 y
  50. #define DMA_FN_IN
      Y  _, G2 E, {
  51. #define DMA_FN_OUT% N; @2 [* s: e
  52. #endif
    6 o/ F$ w# K- N3 W6 o

  53. ; n( P+ ?/ P3 L, J9 X5 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # [8 Y8 ]+ @) ]5 y, ]4 K& m
  55. #define STATIC_SHIFT                3
    1 R- {8 e/ E4 K! A: l
  56. #define TCINTEN_SHIFT               20
    + d1 M* s) m0 u
  57. #define ITCINTEN_SHIFT              213 r% z: T1 ?, R8 X- Z9 q
  58. #define TCCHEN_SHIFT                22
    ) a2 m9 h4 Q0 @% _# _3 N
  59. #define ITCCHEN_SHIFT               233 ?. w3 K% e0 k( L% m

  60. 3 C7 @& q1 J; [! d% C$ y; h* P
  61. static volatile int irqraised1 = 0;6 `$ w- M1 r6 q
  62. static volatile int irqraised2 = 0;) Q: f6 p& u8 h. ?
  63. 9 h  b$ W( I4 F! z* J& z% o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 k( \& ?0 M) _$ b7 b1 P$ J% \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; U! l+ \% t+ n& A/ W7 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, A) g5 c0 p: G. N

  67. 2 a6 A' {& ~" Q: I& x
  68. dma_addr_t dmaphyssrc1 = 0;
    4 l9 c/ K5 R5 I) e/ N7 l$ v
  69. dma_addr_t dmaphyssrc2 = 0;! G4 c( E) r* p/ `* v
  70. dma_addr_t dmaphysdest1 = 0;
      S* v6 f9 x' L& E0 V  |& H0 O5 n4 g
  71. dma_addr_t dmaphysdest2 = 0;" }! O3 \2 ], x% P2 w0 n
  72. & Q; D/ \$ v! n
  73. char *dmabufsrc1 = NULL;
    / p& S5 s! `  I2 n8 X
  74. char *dmabufsrc2 = NULL;1 {4 x# J. K4 V5 q$ [! I
  75. char *dmabufdest1 = NULL;' W& n0 @" Z+ U  o# _( N" _9 ^
  76. char *dmabufdest2 = NULL;
    ; e0 [$ l% [* o: F

  77. 0 e" u5 M; N7 D. d2 O3 q
  78. static int acnt = 512;
    . y& A5 l0 a6 _6 m3 W
  79. static int bcnt = 8;
    0 \) w6 J( k1 k6 R
  80. static int ccnt = 8;) K8 ?. g+ \8 l3 d0 C

  81.   X, O. a: Z" d9 R. c4 ]0 V& f6 ?
  82. module_param(acnt, int, S_IRUGO);
    * `# y4 m7 l' e$ _! @3 D
  83. module_param(bcnt, int, S_IRUGO);" ~# P4 f; M7 p& {; U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 G! ^4 w% K* \% z+ Y6 F. [3 j& U, g3 G4 |& {! j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 |& Q8 d$ H! T* Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- X, C7 y3 A; f" F7 C) `7 Y, M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- F! N9 e2 G+ e- h

2 Y1 {, M1 _4 i% Y" \6 e/ q  a- o9 X. _' S- e& L( v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-29 03:15 , Processed in 0.038851 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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