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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 f1 {8 ^+ M% ]8 j8 ~  b! L
  1. [code]EDMA sample test application% K$ h. h7 K. e/ w
  2. /*
    , R2 N( Y$ L2 O( R5 I1 ]* D5 g
  3. * edma_test.c
    : ?4 W& P$ v" m
  4. *
    * e4 t/ m$ F1 o5 H
  5. * brief  EDMA3 Test Application5 \0 K* a8 C2 L0 T
  6. *0 H$ l3 o, i) n: L6 a" J( }( }: _
  7. *   This file contains EDMA3 Test code.0 ?  r; V& d5 D
  8. *
    & R, _/ `5 @) L9 ]- O) @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) ^9 T. {6 Q8 v0 Q" O! x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 s8 k% f) F# Y+ N4 U
  11. *         TO CHANGE.3 r" C0 f5 Z' [8 t7 ]8 Z% ^
  12. *; j. V, Q# X) T$ _4 N$ J9 O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 ^% H, B+ Y  d0 z5 o
  14. *
    1 D, h& ~8 Z" I1 u
  15. * This program is free software; you can redistribute it and/or
    ( C" j) ^( b% A' y+ i+ l5 ?' i
  16. * modify it under the terms of the GNU General Public License as
    2 F, ]6 m, i  \5 G; a7 k3 ~
  17. * published by the Free Software Foundation version 2.
    * F/ \6 C7 w( \. V: B' e% I6 P1 H
  18. *
    0 U9 x% v/ f& o# H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! B) C# e6 W2 Z; T" s
  20. * kind, whether express or implied; without even the implied warranty
    * C: f: P7 ~  F( U. ?6 u' T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * \  n  b. P# |9 D, b3 [) y; _8 E5 [
  22. * GNU General Public License for more details.; O" l' q) C7 g2 ~; ~7 D
  23. */3 v3 k( ~5 o3 E5 ~" [
  24. " G4 l, \9 B1 x' f+ Y- A6 h' a; R5 c5 r
  25. #include <linux/module.h>
    & v, T7 [" k+ j- a
  26. #include <linux/init.h>
    , R/ Y1 V9 a* a& I- n) j
  27. #include <linux/errno.h>
    ( x, Y% x0 Z0 p
  28. #include <linux/types.h>) ^; t5 \1 \% V. t+ w
  29. #include <linux/interrupt.h>+ s& W% G( i0 x8 f
  30. #include <asm/io.h>5 Q" B! X9 ]6 Q9 i: G5 A. P! p5 ?
  31. #include <linux/moduleparam.h>
    " ^; c4 x" x) f8 X" L
  32. #include <linux/sysctl.h>
    * B+ \: k; ~* F3 K1 y' a
  33. #include <linux/mm.h>
    , ~1 g$ [: L  }" V$ Z* g4 e
  34. #include <linux/dma-mapping.h>6 ]" h1 X  w& |8 \) F& l7 I9 z
  35. ) g2 e, Q. H# B
  36. #include <mach/memory.h>1 n4 P) @. b; ^, P7 H
  37. #include <mach/hardware.h>4 r4 l6 M0 u8 Z0 A; _
  38. #include <mach/irqs.h>
    7 R. P3 o8 F, N' m% _4 C, y1 c1 L
  39. #include <asm/hardware/edma.h>
    - @* V9 g% K+ f8 d

  40. : z* a7 P1 h& q( [7 N8 P
  41. #undef EDMA3_DEBUG
    3 D3 d7 l1 `4 b) E8 @
  42. /*#define EDMA3_DEBUG*/
    ( K: o& g% r( v* Q1 V6 e

  43. $ t( r9 A$ U' p& O) |! h
  44. #ifdef EDMA3_DEBUG/ b! s) L/ x/ V" m/ {7 A; I* w; j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # |% A9 L$ H, Y' L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): b6 h' K$ v: \- o3 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ x# H8 v; E! h& e, v' P$ [3 n
  48. #else. _# D$ X' i0 a" ~* E' [! r! P
  49. #define DMA_PRINTK( x... ); D1 e7 s- I8 I( V% k# i
  50. #define DMA_FN_IN3 F( ^! I$ t; V5 l; i; d+ l! Z
  51. #define DMA_FN_OUT
    1 r- g8 H3 s. V
  52. #endif
    1 l+ s5 B8 o  a

  53. 1 }6 y0 R4 T0 l# q, p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) v" B2 r( r5 e5 f0 D
  55. #define STATIC_SHIFT                3. H2 D8 I. _' _# S
  56. #define TCINTEN_SHIFT               20
    2 `, K. u$ Q8 n+ ~
  57. #define ITCINTEN_SHIFT              21
    8 n/ L$ i6 w; \8 |# i
  58. #define TCCHEN_SHIFT                22
    % e' Y: W  _; C; P2 S2 Q
  59. #define ITCCHEN_SHIFT               23
    ! F8 N+ j" H+ |7 Q5 \2 K# u$ j
  60. 6 v# ]: |- x- l" f" ]9 u) c( u# z
  61. static volatile int irqraised1 = 0;7 C3 E$ p" N' F+ y$ A/ z& P1 e! l
  62. static volatile int irqraised2 = 0;
    ) V3 ~1 h6 R- W
  63. 5 I  D2 c" L, m# p5 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 e- ]& r: Q0 R+ n  j0 I7 o! V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* ~, ^8 Q# g; [# r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 P* @$ a3 X+ Z8 T& ^
  67. " a' t$ S9 n# c; g0 s1 @
  68. dma_addr_t dmaphyssrc1 = 0;5 U" G& P3 J- w7 U& ?# B3 p
  69. dma_addr_t dmaphyssrc2 = 0;
    0 b2 X& O3 R& s  ~2 c  e
  70. dma_addr_t dmaphysdest1 = 0;
    / q0 y4 {6 x' X. Y
  71. dma_addr_t dmaphysdest2 = 0;
    5 N6 m" Z& H8 ?- G9 P( w
  72. / `5 p2 B4 {) S/ v8 p6 M" o
  73. char *dmabufsrc1 = NULL;# u4 F# @9 P) s" A# ]& ]4 r3 e
  74. char *dmabufsrc2 = NULL;' E6 p1 D9 |: v' _2 v4 p
  75. char *dmabufdest1 = NULL;: g9 t" j# h* y
  76. char *dmabufdest2 = NULL;- X7 Z$ ?  w6 C% t, E6 G

  77.   Z3 u2 i4 M3 N% w
  78. static int acnt = 512;
    4 Y/ w. u) T. \) x0 u" j5 ^
  79. static int bcnt = 8;4 X5 p( L& ], J9 b8 z0 r
  80. static int ccnt = 8;
    / [% J7 Q: r3 d+ M. E# J

  81. 8 u+ ]4 H. i/ J4 \$ g+ ~- l& L
  82. module_param(acnt, int, S_IRUGO);" r( \. j4 Y5 g/ K: `! y3 \3 n
  83. module_param(bcnt, int, S_IRUGO);" v% h4 f$ B1 e$ f  w) O9 O- z& g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 T5 Q% m) C. v3 ]+ {. H$ b
" i6 w; J  F* V6 F- @2 \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 x2 R0 I6 }9 S/ }* Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  @& Y8 K0 ~9 r( U- l) l0 D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 M- ^/ o9 X. C2 A& Y5 M

( a) }, R  ]: U" ~/ Y
: b; {2 r* y$ _+ x/ ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 19:18 , Processed in 0.039077 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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