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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  Q2 M5 n6 j% B0 X8 p
  1. [code]EDMA sample test application( l% Q8 i9 P, B* c, U5 W7 e) v5 i
  2. /*, ~2 S" G( [0 X, w
  3. * edma_test.c3 A- [( o9 {! e' Y/ L0 H# ?9 y
  4. *4 i7 m, o7 ~* ~+ Q3 L7 w0 F
  5. * brief  EDMA3 Test Application7 @, P1 n0 f6 Z" r) U
  6. *1 v% t: f4 T7 u1 l+ V5 U8 v" d
  7. *   This file contains EDMA3 Test code.
    ' |7 m; y$ ^" d) t" v
  8. *
    : `5 Q3 t$ q- U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 B- H" E" ^7 w: i$ u" q6 F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " @8 A& r- V4 ?
  11. *         TO CHANGE.3 N) j9 P7 `8 @! h; Q& N3 c
  12. *, C$ R+ o. f9 i3 s8 I8 D0 {' N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" ~( ~7 U/ v) o2 x  d1 z' c
  14. *1 g4 [4 m6 m8 D9 l" J3 X
  15. * This program is free software; you can redistribute it and/or" _& u* L, a0 W% U6 L
  16. * modify it under the terms of the GNU General Public License as
    $ _0 W  }& x6 V) n# \- ]; v
  17. * published by the Free Software Foundation version 2.
    9 E' j; W( c* q3 W: k
  18. *
    9 ]4 J) r0 n+ d6 O3 J% [2 s' G5 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; R- u/ \! Y& n: y
  20. * kind, whether express or implied; without even the implied warranty
    4 j0 J/ @* Q. l: X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! W& d" f  q4 L; o. r' q; ]
  22. * GNU General Public License for more details., R, x# I  x) L3 K! N' H3 |
  23. */
    # F0 Q8 R: }. m, R* _! H7 W

  24. ! H& i* H- K  W: a+ F# l3 z
  25. #include <linux/module.h>4 r" a; t8 Y! b# M
  26. #include <linux/init.h>: ~* y+ C& ^) b% _/ V: C
  27. #include <linux/errno.h>/ N+ s7 ~1 D$ `/ T2 E
  28. #include <linux/types.h>6 E1 g3 h5 [( a7 ?2 z( ~
  29. #include <linux/interrupt.h>
    + }4 }* g1 \, y3 z
  30. #include <asm/io.h>
    . x: Q' b, }0 {: T! Q# _( x
  31. #include <linux/moduleparam.h>; C) z- `" `" f' x4 B
  32. #include <linux/sysctl.h>
    * r2 q9 |$ h( S- ^' Q$ h
  33. #include <linux/mm.h>8 K: M/ V: _6 h+ y& ]0 l( f5 ~# x
  34. #include <linux/dma-mapping.h>. K# q- r/ \4 S; n8 r$ r
  35. , G  E0 k$ ]0 }+ Z3 j! u
  36. #include <mach/memory.h>
      X! p0 k) l& o: K. \( ?
  37. #include <mach/hardware.h>0 w6 L. {6 I0 e% K/ I, \
  38. #include <mach/irqs.h>
    % [1 D, [) W; \( g2 T
  39. #include <asm/hardware/edma.h>
    - [0 z# W* K6 p; G, z% j$ `
  40. $ a5 G' J# _" g! W1 I1 O; s1 _
  41. #undef EDMA3_DEBUG
    , e, c( K, Q3 h6 s. A; F( i
  42. /*#define EDMA3_DEBUG*/  k8 H; R0 J/ p- i
  43. 8 v( [/ v/ V. y
  44. #ifdef EDMA3_DEBUG
    % n4 Q& D( v; q4 ], G  w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : d  M6 O& }$ s- I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). r* J9 B, i9 k, P6 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , t# M9 y! [' N% R& P: b2 r) `
  48. #else
    . j- n. T% @: T! j8 y
  49. #define DMA_PRINTK( x... )  z/ J2 y+ n. E) X* q
  50. #define DMA_FN_IN0 y$ C* {4 P  j3 x0 m0 t4 U# r4 M
  51. #define DMA_FN_OUT
    , `; M! ?8 W& b- p' ^! P
  52. #endif; n9 H& M0 M) d& R; K

  53. 5 r' d) p$ c# w$ ?7 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* u" T: E1 |; J7 @& Q$ r$ N
  55. #define STATIC_SHIFT                3
    4 q9 W" Q. k/ Q# s3 Q5 a& J% y
  56. #define TCINTEN_SHIFT               20
    7 H0 [* X/ y% c! k, L* {
  57. #define ITCINTEN_SHIFT              21+ H% J+ E( W1 V3 b  z! l" s' `
  58. #define TCCHEN_SHIFT                22! n2 e7 H: y6 M6 y3 b
  59. #define ITCCHEN_SHIFT               23
    " U( _9 a8 N( [: F3 d3 K2 q
  60. / ]" G$ m3 ]: ?% ]+ i# h
  61. static volatile int irqraised1 = 0;- h5 H/ C/ g2 `- Q7 h
  62. static volatile int irqraised2 = 0;
    ) w7 t+ o' ^" T$ y
  63. $ T5 g7 b7 a$ L/ @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 X( y5 M3 l: x1 Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " y: C8 |, t+ ~# F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . b( @) A4 v7 a7 g2 v; u! M  }- ^! J
  67. ' j6 s2 B' o" L
  68. dma_addr_t dmaphyssrc1 = 0;
    2 `6 j9 r+ T$ f1 ]: g% l
  69. dma_addr_t dmaphyssrc2 = 0;) ^! S6 B4 X) O5 p0 `) v
  70. dma_addr_t dmaphysdest1 = 0;  d7 R# }4 }) \- t
  71. dma_addr_t dmaphysdest2 = 0;
    # Y% p4 s# r8 ^# I) j# k& Y7 J

  72. % `) c( q6 M  m
  73. char *dmabufsrc1 = NULL;
    . g5 \5 o1 X/ o3 E. B  `4 J
  74. char *dmabufsrc2 = NULL;
      O, ]: G5 p& D# Q+ v6 K; s
  75. char *dmabufdest1 = NULL;
    2 |, R* H, ]& U+ B
  76. char *dmabufdest2 = NULL;! Q: |# e  T: U' @) _  P3 t7 T1 B

  77. 8 a3 c8 u# b" N8 k: F8 c1 ]1 T* ~
  78. static int acnt = 512;# A, t4 G( T+ o' L' @+ o
  79. static int bcnt = 8;. ?2 P' \. f, o8 I
  80. static int ccnt = 8;
    & ~3 {7 R9 A$ T
  81. ( P4 x4 o& l- V* q/ {: I
  82. module_param(acnt, int, S_IRUGO);
    , J2 `# v. ^! ?
  83. module_param(bcnt, int, S_IRUGO);
    " }! N) a  h9 e- w$ u. |2 Q' I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 `' v; J% E$ o# Q5 H) X/ Z" Y/ D3 {  @0 M4 _8 V2 O; y" e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ h$ s9 F- L+ [* }0 L& {- Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! Q5 I& J3 y/ H) i! l, U. W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 i$ `9 C- D& r1 e% S" L) m* [$ g
% H+ y$ e0 w6 }2 S+ M( ]1 ]3 Z, y# [, b  T" m+ h$ k" U6 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-9 03:17 , Processed in 0.039575 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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