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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' t" y% E* Z; T5 Z/ Q0 d" \
  1. [code]EDMA sample test application- w# [9 i* O1 ]4 q" W$ ?
  2. /*4 l' `  c! y$ }
  3. * edma_test.c$ k2 ^! E3 e. L. [% B
  4. *$ m9 E8 E8 l+ _; Q4 K
  5. * brief  EDMA3 Test Application/ K* O) D! ?: j* N5 j& M8 d- v, X2 u
  6. *, T% \0 i$ g4 A0 x9 A
  7. *   This file contains EDMA3 Test code.
    ) ~( k7 X7 j0 v' s
  8. *  v5 h0 z  a5 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& R+ g) }- N4 G) |/ V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 P' U* ?: i! s; G' s
  11. *         TO CHANGE.% M# c# A' {& G& B; }( g0 I
  12. *
    1 a0 t" u8 ~/ X0 g: d# I) t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " ~+ o7 x; R! R9 }
  14. *
      T4 x7 R+ E5 y2 {
  15. * This program is free software; you can redistribute it and/or4 f9 N2 j% N$ x  |, ~; s/ r
  16. * modify it under the terms of the GNU General Public License as
    ' J# {) _) ?8 ?/ B) Y7 f
  17. * published by the Free Software Foundation version 2.$ m5 g5 S2 G  ~8 _
  18. *
    6 g6 J& P$ h7 Y# [8 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 O7 q0 g" a" {
  20. * kind, whether express or implied; without even the implied warranty# D! j1 X6 B5 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # [, f" f$ Z5 d+ T) b
  22. * GNU General Public License for more details.9 v$ T2 F& @" r1 t
  23. */& ]* R8 a1 I7 U, K3 q0 S  C2 j8 h4 ]
  24. 5 W7 E5 d+ |5 I
  25. #include <linux/module.h>
    ; f; N0 R+ c6 ]% `8 k0 ~
  26. #include <linux/init.h>9 m7 c% c# Z! N1 o7 [
  27. #include <linux/errno.h>
    1 @& l% y; N' A* w  P
  28. #include <linux/types.h>. z1 l* C% p& _" }; m
  29. #include <linux/interrupt.h>
    , k) v4 w0 S, q# a* w3 [
  30. #include <asm/io.h>2 V4 B$ u0 a0 F/ v. n
  31. #include <linux/moduleparam.h>: f, z" R9 J# i& g$ H  \. N
  32. #include <linux/sysctl.h>
    8 H# X5 n3 I5 ]& U% M' C2 n
  33. #include <linux/mm.h>
    2 D5 P: Y7 n# {
  34. #include <linux/dma-mapping.h>
    , _# T2 ~: P; j. ~

  35. & a' m8 _: Z; z5 X+ g  ?4 ^
  36. #include <mach/memory.h>
    % g  i. O' W6 b( l' Q
  37. #include <mach/hardware.h>
    % o$ c+ F9 S, J* n6 u9 f" `. L
  38. #include <mach/irqs.h>
    % u7 T, t3 P3 E: J8 w; a: S+ V
  39. #include <asm/hardware/edma.h>
    9 u2 s& e/ C" X/ q  Y

  40. ( ]8 i! N- ~3 _# o; Z! `; v
  41. #undef EDMA3_DEBUG9 O  j' v+ x7 K) i2 C2 N8 d+ Z" \
  42. /*#define EDMA3_DEBUG*/. V* `! _$ I1 \/ S- z

  43. 0 x: i: P) j7 g8 [( x/ n1 x% ^
  44. #ifdef EDMA3_DEBUG* g  J% x# _/ z; U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 [0 k! N$ J; E, z3 o5 F! s8 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 a* \( G: m% P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 w' T4 w8 X( G0 _/ U* J
  48. #else
    " G, E/ v/ z# w5 A+ A
  49. #define DMA_PRINTK( x... )
    ) {7 l5 q$ q* A' `/ B6 w
  50. #define DMA_FN_IN4 }3 d6 z  g2 b7 H* f
  51. #define DMA_FN_OUT
    3 {6 X  u* G% Q  N1 K' J4 l$ o; u
  52. #endif! E# ~. o6 F4 R
  53. * h% o2 z$ Z1 f; ^2 x% K5 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 H# X' h9 l, y- v5 n
  55. #define STATIC_SHIFT                3
    3 O2 L' H. A. Q* x+ j8 F; h+ ?
  56. #define TCINTEN_SHIFT               20
    " [1 R/ n' Y" l6 u: @0 y" X4 w
  57. #define ITCINTEN_SHIFT              21+ t4 V# v7 [9 ~- w/ D0 u$ ]
  58. #define TCCHEN_SHIFT                22
    0 ?1 J2 P( G1 i/ t
  59. #define ITCCHEN_SHIFT               23$ n) ~" Q; v. m. p- O/ G$ F0 Z

  60. 8 C3 E( b8 l* h: z& Y- L8 S
  61. static volatile int irqraised1 = 0;# w1 @6 Y" k8 P$ O  l. o
  62. static volatile int irqraised2 = 0;
    $ o' m, }* \/ i/ S" @  m

  63. & M, _8 C: m& ^8 ?$ B! L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ~& h' u7 ?8 F7 M; u' x$ T, l& m: l1 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 \8 l2 j- V5 a; H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 K$ S9 T+ s# H$ W
  67.   z, B; _4 b) \4 t" j5 f& m
  68. dma_addr_t dmaphyssrc1 = 0;6 Y  @6 M2 |1 ~4 I3 G6 p1 g
  69. dma_addr_t dmaphyssrc2 = 0;
    * X, ]! \* U- m, j( a
  70. dma_addr_t dmaphysdest1 = 0;7 G3 k2 \( _' s2 \
  71. dma_addr_t dmaphysdest2 = 0;" S' g9 h. a' Q# \  [
  72. ; f5 ^2 V4 R% Y' z4 [5 _* v. w
  73. char *dmabufsrc1 = NULL;
    9 W% ~+ z  h3 A' z
  74. char *dmabufsrc2 = NULL;: T3 Q9 d# z+ a% B" O7 P! X
  75. char *dmabufdest1 = NULL;/ H9 I7 h& i9 w. ]: C3 J- }( w# X0 Y
  76. char *dmabufdest2 = NULL;
    + Y- k; b; @1 J, n0 c2 f

  77. 1 D; @* X" f4 w( f7 k" ^) @& a* u* b* |
  78. static int acnt = 512;- C8 B$ I# H  L% J% A, ]
  79. static int bcnt = 8;) u/ O) w! C- V  C0 N6 s% n' |
  80. static int ccnt = 8;9 d+ c& x& o7 G. t/ d. |% {- E1 J3 t
  81. 9 R5 b' F) l! t- v* C% N
  82. module_param(acnt, int, S_IRUGO);) `% U& R' A, x; s: j& m
  83. module_param(bcnt, int, S_IRUGO);
    4 B0 \. w6 ^1 D: G1 s: p( J6 R( |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 Y) D, @$ x3 E; w) D2 J. X; [2 J& m% j/ O7 D* h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 {8 U* s' s' W- s  g9 z' Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 a$ q6 C2 ]1 J% w  Y, R: C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 h, a. v# [$ m* L9 ]" E! u; H( f$ m( Y  t4 a+ W% s, E

: v  s# r/ y. F( U: u  _1 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 09:00 , Processed in 0.037794 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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