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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' O/ X1 I1 Z6 q+ d
  1. [code]EDMA sample test application
    $ J1 }3 u" p% p: S2 g
  2. /*
    8 o. m/ t: z  o5 O. f0 W
  3. * edma_test.c  a8 {' Z7 s9 e+ Z0 {
  4. *7 R4 k' `8 h7 n5 ]# N
  5. * brief  EDMA3 Test Application
    6 r% G1 J, I$ D" b
  6. *! k) X% ]" }% |( I" q, w/ Y
  7. *   This file contains EDMA3 Test code./ M" E5 W: a/ N0 Y! y' {( M. P. w1 D
  8. *- Y5 L& S! Z, L& S- r) Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - |, |; C$ u; w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ M& o& R+ m/ d! A" P2 |2 F" r' [# ~
  11. *         TO CHANGE.
    ( X& I0 K9 t) M' Q4 v
  12. *
    % |- X' q0 N% y; a6 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ ^/ V) y0 o5 k" B* t
  14. *8 q$ C9 K3 f, {4 A/ E. h  y1 o5 Y
  15. * This program is free software; you can redistribute it and/or- A8 a! h+ @+ _- W
  16. * modify it under the terms of the GNU General Public License as
    1 _& d& F& C; {5 r
  17. * published by the Free Software Foundation version 2.
    # D* ?6 f( N3 m" ^* R: [
  18. *: Y5 U* e9 F! A! d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 Z: m$ K" b% m/ ]- v
  20. * kind, whether express or implied; without even the implied warranty$ G  B. w( q9 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- h9 z7 O, |$ ?5 k& l. U
  22. * GNU General Public License for more details.  ~3 |( u1 M& g/ d' L( j
  23. */
    8 o  o/ a& N0 [# C( [) o, n' C% h

  24. ! d* L1 D" j/ ~' U4 O
  25. #include <linux/module.h>% N- R+ m6 s) |% ?& n4 `( _
  26. #include <linux/init.h>- J' @* k! h; Z( _( T# U6 S
  27. #include <linux/errno.h>
    0 R8 B1 L2 G* p# m4 z/ I  g
  28. #include <linux/types.h>
    * |' `$ P' h: K
  29. #include <linux/interrupt.h>
    1 x; l, L, g% D( C$ t
  30. #include <asm/io.h>/ m/ E5 O$ k9 x- z- o$ A; Z
  31. #include <linux/moduleparam.h>
    - H% H' A; W0 n. L  M
  32. #include <linux/sysctl.h>5 I: k; E0 N8 g% m, F
  33. #include <linux/mm.h>& a+ d. j/ S. F/ L8 N% J4 p
  34. #include <linux/dma-mapping.h>. M8 ^1 ?- \+ |8 p

  35. 5 b* M5 S* h; B$ g" c
  36. #include <mach/memory.h>" J: W; m6 s, O# [
  37. #include <mach/hardware.h>* K3 M5 X7 n; U. M* z. W. y& R1 ]
  38. #include <mach/irqs.h>7 u# V. o) i* r
  39. #include <asm/hardware/edma.h>
    9 ?0 n- t& {! q9 ^3 s0 @6 G
  40. . M7 _' T# }. C3 X
  41. #undef EDMA3_DEBUG
    ( ]3 |' p/ z0 r4 h7 n; e
  42. /*#define EDMA3_DEBUG*/3 o5 r5 s) A& ?- y
  43. ! h  A0 O- x, @& x! w
  44. #ifdef EDMA3_DEBUG
    3 ?. j' @$ Y  ~# t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' J, u# s6 |! i$ P4 a& C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 v1 O5 k/ N3 j/ E0 Z, Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 d; ^* H: c7 r7 c
  48. #else& u$ K: A% G; z. n; l4 M6 [, z2 v5 y
  49. #define DMA_PRINTK( x... )' `* O  K5 I4 L$ P9 X- k
  50. #define DMA_FN_IN0 ]2 o7 n. D/ f; S. H! S/ [. p
  51. #define DMA_FN_OUT7 W- u5 T. K/ z4 K' A* |0 L- j7 U
  52. #endif
    . v4 J. ]' S$ {. o& B# v+ o
  53. 0 \# v! W" ?( Y  B4 @& g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& H+ F, h  B6 I* ?) |
  55. #define STATIC_SHIFT                3
    / u- f/ D/ `) p7 N
  56. #define TCINTEN_SHIFT               201 ~; k- A  u0 P4 Q
  57. #define ITCINTEN_SHIFT              21
    - A& ~  m* ^; l3 q# b# ^: T
  58. #define TCCHEN_SHIFT                22( H) r  w( W- U& Z4 V
  59. #define ITCCHEN_SHIFT               23) i* q* U5 O4 l0 {3 F; i3 R; p

  60. ( X' @$ v6 w4 R! e0 W4 D
  61. static volatile int irqraised1 = 0;
    7 d0 W7 ^4 O8 }
  62. static volatile int irqraised2 = 0;" e9 Z6 G8 e* H& J, n7 T
  63. 3 w3 O) l6 O. v% R1 _/ d% c2 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 l6 N8 y' a9 ~6 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' ^8 G, D& [! w' ~) E$ ~4 \, t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' T, p( a3 l# c. I5 N

  67. 3 J7 @6 U, H8 j  Z3 d- P; x3 X
  68. dma_addr_t dmaphyssrc1 = 0;
    * G8 n  k& V8 _
  69. dma_addr_t dmaphyssrc2 = 0;
    6 ]1 n4 o( L) i' W" t% T
  70. dma_addr_t dmaphysdest1 = 0;4 j1 V+ j* e1 b+ x* S- w
  71. dma_addr_t dmaphysdest2 = 0;
    ; ^5 G' x2 W. x! S  Y' ?( w( h+ J
  72. & D4 U7 L" C2 G  y8 E3 Y
  73. char *dmabufsrc1 = NULL;
    " ?# {! U7 f2 ]1 Q& x+ T
  74. char *dmabufsrc2 = NULL;
    ) U: j! q' S; s( K/ ?! [' d' G2 n
  75. char *dmabufdest1 = NULL;
    + m- {& E, w: V& C" _  d( A
  76. char *dmabufdest2 = NULL;" A" P  l, c% {4 ?, J2 Q
  77. ' G3 T( D! _0 ~. V# b- `2 Q5 E
  78. static int acnt = 512;
    ' Y! T' e- a- v, W: ~
  79. static int bcnt = 8;" Q. J6 h0 b. E2 b6 b- }" a
  80. static int ccnt = 8;  X3 P$ l. r. {2 z4 E: M+ d
  81. 1 e& W7 p* f& p0 M2 L$ K7 N, \7 }
  82. module_param(acnt, int, S_IRUGO);6 T& E( N" V; U( _& R4 S9 G8 f
  83. module_param(bcnt, int, S_IRUGO);2 Z+ ?+ _1 W' a0 _- @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 }9 o6 C5 x6 [  `7 V* A+ o4 {/ \; R0 P% V
( Y. q" ]& h) m) q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" G0 Y. O6 @0 }, E  [! harm-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+ q/ E' S; ?+ o: h2 ^( g$ M: s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  c' S8 e2 V0 d: ]1 h: c- Y+ c

& ]( ]6 y7 Z, i
& \- @. p/ C7 R, o+ q: b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 18:47 , Processed in 0.040090 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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