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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) |( h& ?( B# B
  1. [code]EDMA sample test application+ G1 e, \1 e" s0 S5 _' ^
  2. /*
    2 L2 X- K0 L# k% L5 n5 U( j
  3. * edma_test.c
    7 h: S6 X* M- T; |: ~
  4. *
    ; c% ?  p. v! |! i5 U' T
  5. * brief  EDMA3 Test Application
    " H$ c9 k6 n: k
  6. *1 t$ y8 L7 w& n4 m) p! b0 x. [
  7. *   This file contains EDMA3 Test code./ S' t- X: r5 t  V8 P
  8. *5 X6 ^6 D8 h7 b( i# e! v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ U% Q$ {9 P" W5 f, L9 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) N5 L' |6 B% }3 d% d8 p8 ?
  11. *         TO CHANGE.
      E9 g3 r5 `; _
  12. ** \. |# t4 M7 h; {+ O/ @* E0 x2 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! i& c- X9 Z. |: |3 B
  14. *
    & m1 n$ B" i- N( b. c/ b( s
  15. * This program is free software; you can redistribute it and/or4 x' E. ?# A# G5 @% k, d
  16. * modify it under the terms of the GNU General Public License as5 s) D5 h- l" N4 ?/ k, O
  17. * published by the Free Software Foundation version 2.
    8 E* B+ f- B. D( u. F# j
  18. *
    2 z/ N! q$ M' ]9 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- F1 K% }; k% X6 l& b# B" S! }
  20. * kind, whether express or implied; without even the implied warranty
    : x+ Y3 i) P- i! s$ Z, h* U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * d  i, [6 R4 }# T5 h/ c7 j
  22. * GNU General Public License for more details.9 ~# ^) [" i( U2 G
  23. */
    8 K1 S! r" Q0 [  \

  24. ! m5 y5 H3 S3 r: v8 i* U/ |! b) D
  25. #include <linux/module.h>% p  w5 R9 Z  A% U* N2 v6 K
  26. #include <linux/init.h>: [+ j% w1 H* s  [9 p+ \, H" z
  27. #include <linux/errno.h>" q  r. v- x* }8 _/ B, p( |4 Q
  28. #include <linux/types.h>  m) c3 ]1 T9 W9 L2 l- Y
  29. #include <linux/interrupt.h>( E2 I  `( [2 Y2 }
  30. #include <asm/io.h>/ R; _4 X, b; x# F7 `, Q" U
  31. #include <linux/moduleparam.h>
    9 p6 C$ K$ ]( J/ S* e- [
  32. #include <linux/sysctl.h>0 `( c; x. N& @* z# g" f1 D
  33. #include <linux/mm.h>
    ) Z2 I7 b/ n/ X" [7 P. v
  34. #include <linux/dma-mapping.h>6 i. X6 u' n# Y7 n( @; I

  35. 0 R! I' H9 O' M: v& [$ W
  36. #include <mach/memory.h>
    4 l1 l2 r. U: k5 ^! m
  37. #include <mach/hardware.h>; n7 p' l( D. K
  38. #include <mach/irqs.h>
    3 V3 Q, B' @9 |5 N! t
  39. #include <asm/hardware/edma.h>
    " I  d9 S& D" G

  40. ) ?& I- g1 f1 P9 i) v1 y0 \
  41. #undef EDMA3_DEBUG! V' ~; }- z; L1 i( Z
  42. /*#define EDMA3_DEBUG*/
    ! X9 i- Z( X6 z4 ]8 A; A2 W
  43. 1 g9 x# U0 H7 M) x$ S5 `
  44. #ifdef EDMA3_DEBUG
    ; ]- s: k" Q6 Q; G( [2 {# f0 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ l0 t* B* m$ q% r$ d" p* d- p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  U1 |8 E9 C4 L" L7 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ g: _! \5 c2 E: x" o  L" F' F: m
  48. #else( O! h6 X, s" T5 S/ q! ^
  49. #define DMA_PRINTK( x... )
    ; C" w. y1 J6 M
  50. #define DMA_FN_IN- w; J$ d2 k' ?! u. c/ K: r
  51. #define DMA_FN_OUT
    $ G/ h1 ~, |8 b8 m3 l! h
  52. #endif  n' c# V0 j. O- S# y4 _( z
  53. . D4 N+ n5 N* k  s/ w" h3 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( l  y, Z- M& k0 ~0 @
  55. #define STATIC_SHIFT                3
    , V3 ^8 S+ t/ f
  56. #define TCINTEN_SHIFT               20
    ; C( P8 \( w$ A3 g
  57. #define ITCINTEN_SHIFT              21! e& n4 J1 u& V/ b9 N1 `5 I& }5 f
  58. #define TCCHEN_SHIFT                22
    ' a' V. Z' W) ~( a/ j$ U
  59. #define ITCCHEN_SHIFT               23( B8 k" b3 a3 H; K2 u. Y  f

  60. + C5 f- x' W  G7 m
  61. static volatile int irqraised1 = 0;8 U0 c7 b2 C% ^# h
  62. static volatile int irqraised2 = 0;3 @* g& K) h1 L. u, X5 H
  63. ' }9 l' M  f: e, R! I( ?+ b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * P+ S& z* @$ V/ F4 W) c* K; l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & y% u8 f& |9 {- D/ K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 g6 H, Y) _0 g# w0 E
  67. 2 ^4 d) j2 n  ?' U* [. u
  68. dma_addr_t dmaphyssrc1 = 0;: c5 u3 j! G. l
  69. dma_addr_t dmaphyssrc2 = 0;
    9 i0 C, F/ R. Q7 \- U5 r1 I9 J
  70. dma_addr_t dmaphysdest1 = 0;
    - w1 T3 P  ?( g4 D$ f* p6 ?. V
  71. dma_addr_t dmaphysdest2 = 0;
    5 X- w6 T1 W( d8 B- [4 n  V
  72. 3 `; c/ `* i& d' ?' n6 |! i4 P
  73. char *dmabufsrc1 = NULL;* {. ?. ]% G, G) v" A: f7 N$ O
  74. char *dmabufsrc2 = NULL;
    3 I; d" ]. R8 c6 j# {6 B) S
  75. char *dmabufdest1 = NULL;. k! j3 Y. @' j8 l2 _
  76. char *dmabufdest2 = NULL;$ e" a+ e: D- G+ g
  77. ) E' V- A$ \) J" w! j; h: p, P2 f
  78. static int acnt = 512;# G8 e' x7 N/ j3 y  w
  79. static int bcnt = 8;: i4 L  H' R3 b
  80. static int ccnt = 8;
    5 Y+ q! v3 u; Z3 W( h' k
  81. $ [; ~4 G& E+ A+ f- B# A
  82. module_param(acnt, int, S_IRUGO);2 R# T( O2 L  X5 N& j8 e6 h
  83. module_param(bcnt, int, S_IRUGO);* v5 u! `7 V3 p  T: Y1 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* x. t: }# \7 h0 B( {& N

( S- C1 U' \. D7 N* m2 g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( `' L% y; p$ ?/ [
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 ]- E0 i/ Q% u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, ]! `5 D, L4 w* s4 N
; ~, Q; ^& u# L; e% Z

! |  V& j! j0 {0 B( M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 23:41 , Processed in 0.038616 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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