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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 H/ Y& g2 e/ r# ?% G; U/ Y
  1. [code]EDMA sample test application
    1 `" E# w& n2 o# _( n" y7 S
  2. /*
    , a! i  R* r  W1 A* g
  3. * edma_test.c' ]& E, A5 `+ W7 _
  4. *) S! V; F' z( s7 [8 E1 L; G; ]
  5. * brief  EDMA3 Test Application
    5 X6 a2 d! i9 Q/ H/ o8 ?) }& Q
  6. *0 i5 m$ ^4 ^% S. f7 t' Z
  7. *   This file contains EDMA3 Test code.# ?5 ]' u2 ~% M' A# `" P
  8. *
    # y* `4 Y' A( \4 X! {5 ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ ]' _/ O4 _8 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 S" n8 }; Q( k% v1 b  v
  11. *         TO CHANGE.. q6 p+ o, D# _  K$ q2 _% ^& t5 N
  12. *
    ) A6 T/ p& L2 }% s6 C2 y# `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / c7 o2 b+ ~! v' D6 Z- g
  14. *
    3 z. K- R0 Z! I/ J
  15. * This program is free software; you can redistribute it and/or
    8 F! M' R) R  y1 N  g" u
  16. * modify it under the terms of the GNU General Public License as" @- Q3 i( U# c' h9 c9 N. z
  17. * published by the Free Software Foundation version 2.
    2 k, k$ H7 v3 g# v- z6 G' I/ l
  18. *8 W+ P( M; `0 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + i& P$ |+ k3 d- X! z. ^% s6 i" L$ e: J
  20. * kind, whether express or implied; without even the implied warranty/ Z9 ^4 z! W, f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + q  E* T( y# \$ p2 J2 M( z
  22. * GNU General Public License for more details." w" ]- ^  v4 z% E6 N
  23. */
    9 W! X4 B6 ?4 [% Z8 z0 J3 }+ G

  24. 5 E* t5 b7 b3 V: e9 B# G
  25. #include <linux/module.h>
    * V8 M  R$ V- j+ q' d2 K3 L6 t
  26. #include <linux/init.h>5 @7 ~/ I6 L$ ]& x, _* }  [! k" I
  27. #include <linux/errno.h>7 q/ ~5 n" B8 t* Q! o! T. @8 R+ P
  28. #include <linux/types.h>5 g) i5 X7 W. K! N8 ?
  29. #include <linux/interrupt.h>
    ) B9 @# Z& z' j. V
  30. #include <asm/io.h>. e3 B. m% g" ~) D; r% e
  31. #include <linux/moduleparam.h>
    4 H1 X: k" D$ ?. Z) S7 J7 o3 q9 o- |
  32. #include <linux/sysctl.h>
    2 G7 k) k* ?& C& l% \1 P
  33. #include <linux/mm.h>
    " p- f; u/ z; g5 S- t3 K3 Z
  34. #include <linux/dma-mapping.h>
    6 M" m" P5 F  {+ k- [# S+ N; m2 c# v

  35. 7 o6 J( ~* y7 A) G% e4 Z' X1 C
  36. #include <mach/memory.h>
    $ G3 K! @  D! e5 }$ |# e
  37. #include <mach/hardware.h>
    5 w$ {' s9 {) u
  38. #include <mach/irqs.h>
    ; b! V% U3 U8 A8 |* ?; m
  39. #include <asm/hardware/edma.h>. t& Y( C3 A5 g& D

  40. * c9 A0 r, n4 J9 p' C2 ^+ b) e5 L
  41. #undef EDMA3_DEBUG
    4 _* p% l' X6 \- |7 F: k
  42. /*#define EDMA3_DEBUG*/
    2 E& x$ d4 s3 E, E- o8 \6 {

  43. 3 s8 v4 A6 x" ?0 `
  44. #ifdef EDMA3_DEBUG
    ; l- T- v) [5 G0 N6 x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : e2 \4 H2 e; Q$ F& m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 r1 c/ y  s# J4 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 [1 Q( A' h0 m% r
  48. #else% @( n" J/ Z! S1 z) y5 x8 u6 a) ~
  49. #define DMA_PRINTK( x... )& o  h6 S0 }' J
  50. #define DMA_FN_IN
    3 W& c" X4 h5 |% k  G; Z
  51. #define DMA_FN_OUT
    3 K5 O; n( \) n3 V% t5 T9 B7 W" k* l
  52. #endif6 [) a$ Q' Z, u+ |# L

  53. + g9 k2 Q, p; n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ N( k  A* d# @$ m
  55. #define STATIC_SHIFT                32 n: f0 u( H1 B% R3 M
  56. #define TCINTEN_SHIFT               20
    6 g- R- {% Y3 t
  57. #define ITCINTEN_SHIFT              21
    7 q. J. I6 p3 B) n
  58. #define TCCHEN_SHIFT                22
    5 }, B; l. {% }& @- T+ O* J+ b8 U
  59. #define ITCCHEN_SHIFT               23" O: ]5 G; v3 V" q

  60. 9 V3 V5 @- D8 B
  61. static volatile int irqraised1 = 0;% R: I: {* D; x7 O) a+ J8 v, Q
  62. static volatile int irqraised2 = 0;8 H! k2 Y* D3 @# J$ D. E" X

  63. 2 G* f; }" n& n0 ?- Z7 E+ G8 Z$ z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 `5 G/ K6 |) Q2 r. Z  E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' C5 \/ h* L' a4 j! u1 b! i5 x0 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ?+ C5 S+ F  k* ?/ {- r8 i
  67. 2 J% k6 `  w9 ^" O
  68. dma_addr_t dmaphyssrc1 = 0;' t" P6 t4 w6 t: m$ M- T) @
  69. dma_addr_t dmaphyssrc2 = 0;* \0 @. M- B) y, Q
  70. dma_addr_t dmaphysdest1 = 0;
    5 F1 N% V4 c6 D# H) N7 o+ N/ x
  71. dma_addr_t dmaphysdest2 = 0;
    - B1 b8 w7 d$ \' ~
  72. 7 O: x& v& _4 m7 F* t7 a3 ^
  73. char *dmabufsrc1 = NULL;5 `; d  z* _" q6 Y+ Y
  74. char *dmabufsrc2 = NULL;7 ~& a% `- s5 f  `& Y: |
  75. char *dmabufdest1 = NULL;( r3 g* [' W6 V# q
  76. char *dmabufdest2 = NULL;4 a6 n# Q! T) j/ T

  77. ; d0 g" ?; C; ~: a% t
  78. static int acnt = 512;
    ( v6 k( c( t$ |6 m3 p% J5 ~: N
  79. static int bcnt = 8;( Z  A0 [- q2 r" B3 |$ O
  80. static int ccnt = 8;
    0 r2 L% g* r7 G; _  ~# S- Z
  81. + y- M) _% b$ O* w
  82. module_param(acnt, int, S_IRUGO);* u& [- t3 W& B  x8 W
  83. module_param(bcnt, int, S_IRUGO);
    : l' _4 }$ W; u3 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 m3 A! Z& ]6 Z: d# r2 @% x% Y8 H: H9 P! p. ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 j, I" @' L, p  Q! earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 t- Y$ {" q; ~% ?! `/ U6 ?2 x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 b0 @- x5 o- m8 \- O2 c  |: N1 X5 Q8 `
& s. T# k6 d6 j5 `2 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 22:05 , Processed in 0.051284 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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