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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 w5 H1 B+ I) @3 M5 @/ ]- ?+ o
  1. [code]EDMA sample test application
    5 n0 J$ G! Y# `% w' M0 z( _. G
  2. /*
    # r0 T% u3 P  X# c7 D/ y
  3. * edma_test.c; v6 e; n* @: W
  4. *7 M- q6 y/ |; C- d
  5. * brief  EDMA3 Test Application( L1 r# L+ f( I7 F8 }
  6. *
    ' b( ^3 q7 P- i* y" f. Q" A
  7. *   This file contains EDMA3 Test code.
    3 v4 x- g( M$ z8 b% k- q, ?
  8. *& H* R" ?+ o+ r0 @' H4 _) {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      ^. D+ a! I! E* n. |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; ~+ b5 f3 n  f  Y: r: g7 W
  11. *         TO CHANGE.
    - W: U6 N0 O0 n% Y' ]# T5 N
  12. *
    : u. a" a' Q1 ^5 q! J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 x* _& v; ^8 i
  14. */ L# I; e+ Z5 v4 k2 _7 F. {
  15. * This program is free software; you can redistribute it and/or* K+ r5 T+ _' a7 x" B, a4 r/ r
  16. * modify it under the terms of the GNU General Public License as
    & F0 y8 d$ K- Z, E( `# \# n
  17. * published by the Free Software Foundation version 2.
    0 z8 A2 F) ^/ Q# {
  18. *
    ' u9 A" z7 B" E# p7 d9 H0 u8 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: M+ ^  |6 [/ H3 t8 f
  20. * kind, whether express or implied; without even the implied warranty; A4 Y3 o& @5 R2 {* f) l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! h2 o9 D' L2 L6 u$ B3 V+ @/ U/ V
  22. * GNU General Public License for more details.
    0 X7 F# E: U5 Q$ e8 u5 e. }8 I
  23. */, K+ ]! n. u2 T. K

  24. ; v2 J, n9 e! d* C0 l. b
  25. #include <linux/module.h># o7 F; h  f0 O8 W* n
  26. #include <linux/init.h>& V) S+ Q6 m4 ]! @% m
  27. #include <linux/errno.h>4 `& B: {8 g' z$ _9 j0 s: t2 b3 E
  28. #include <linux/types.h>2 \* i, |  U: v5 x
  29. #include <linux/interrupt.h>
    * S7 N) `* c+ t0 C5 e* }
  30. #include <asm/io.h>7 F) U$ n! I* d1 p6 \% S
  31. #include <linux/moduleparam.h>* @3 i# n3 Z: b- z  r! u" ^
  32. #include <linux/sysctl.h>0 K4 }2 x3 ?! [, f9 b) q
  33. #include <linux/mm.h>6 W1 p4 t# L) X, L1 w- E
  34. #include <linux/dma-mapping.h>
    . E- E! S9 h1 S0 j) k

  35. % H. a( K* g; h9 k
  36. #include <mach/memory.h>
    ; ?2 V" U$ L" a8 n
  37. #include <mach/hardware.h>7 f/ M5 u6 K: Y
  38. #include <mach/irqs.h>
    " O% @, `  Q; H! D& I, W
  39. #include <asm/hardware/edma.h>
    * g% V7 g) O' v' e
  40. + D: j$ K/ _5 H- y5 q2 [+ u/ r
  41. #undef EDMA3_DEBUG
    2 A# _3 U8 F; }* u5 V+ U/ X
  42. /*#define EDMA3_DEBUG*/
    + H' ~! D, D) g. G2 Y7 s1 ~. ~& l

  43. ' s1 |* z8 {! w4 W; R5 h
  44. #ifdef EDMA3_DEBUG" }# b, {% u' b4 _0 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# j# [5 q' J2 L1 g$ z8 s' x; L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ T' S* ~3 ?" P, r2 J3 B* y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 j9 Q$ L0 `% v  ~
  48. #else
    8 r0 E. r' y$ m  h8 t
  49. #define DMA_PRINTK( x... )
    + v& {8 z; C$ t* R# C
  50. #define DMA_FN_IN' P8 c6 ?, h  F1 n
  51. #define DMA_FN_OUT
    4 j" n  i# C# q0 u3 p
  52. #endif9 g) T1 H1 h. J  Q3 M$ g5 Q! u

  53. ) b1 _5 y% |, T) t* N( f3 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 I" u$ [0 [5 f" G( C- K
  55. #define STATIC_SHIFT                3( i& K+ ~* v: \3 s  M/ u* U
  56. #define TCINTEN_SHIFT               206 n  h. G# j$ N: g) R
  57. #define ITCINTEN_SHIFT              21
    7 h; X/ s6 H5 l% ?
  58. #define TCCHEN_SHIFT                22* |+ @4 s5 M7 m; j/ _& J! o' ~
  59. #define ITCCHEN_SHIFT               23
    2 l' [+ G8 \6 c8 J. A  T

  60. % ?* _" d, v2 H- W/ m! s- `
  61. static volatile int irqraised1 = 0;
    ( L- g9 ~9 F) A2 W! t
  62. static volatile int irqraised2 = 0;, S& B: Y2 l/ e% F- i# A
  63. - b7 c0 w& X; q/ |+ u! A: d/ W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( L; \3 A& P8 e4 H0 x9 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : u5 L( _8 g! ^: Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 t/ I2 i0 L8 J0 S

  67. 0 |# k. O: z7 M- K# P6 \( C
  68. dma_addr_t dmaphyssrc1 = 0;* _$ B. Z3 W; c; B0 I6 e1 ^
  69. dma_addr_t dmaphyssrc2 = 0;
    * u/ J* X4 x' `
  70. dma_addr_t dmaphysdest1 = 0;
      q; h. @. g. l+ y
  71. dma_addr_t dmaphysdest2 = 0;
    + G, m5 ~7 t& {* w
  72. 8 F4 B0 \/ w) Z$ ]
  73. char *dmabufsrc1 = NULL;" A0 ]4 H! U. h5 {' N9 m$ O9 M
  74. char *dmabufsrc2 = NULL;
    : z! q3 u* c! Q8 e; `% m  [$ i
  75. char *dmabufdest1 = NULL;6 ]& G2 I, c# ^% }$ g$ R
  76. char *dmabufdest2 = NULL;8 `1 e: I0 i4 E
  77. ; Y( n, m/ X8 `- a- h" J
  78. static int acnt = 512;: _; A0 H9 f* J) w9 r6 ?8 l, F
  79. static int bcnt = 8;
    8 j. ?- p% @2 u) P) T# {
  80. static int ccnt = 8;
    7 Y! T* [0 C4 u$ G( Z# G- [* q/ V

  81. ! z7 ^7 D2 i' |# k  G$ e. l0 h
  82. module_param(acnt, int, S_IRUGO);
      U% o$ L  W+ g8 Z7 Z
  83. module_param(bcnt, int, S_IRUGO);; O, R! v& B" u+ w2 T% `4 c; P( V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' X- p% ]) G8 V

6 ?9 L. w" w: R* Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ w& Y! l' ]) n- z' m/ E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; r$ f; h: k' a* G& _8 L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 D) z% d( N+ q% O- O% M, H' i& w4 u& ~$ @
, M$ z) j. T+ {5 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 12:22 , Processed in 0.040147 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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