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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' p9 k6 J% @, C; S0 g7 D
  1. [code]EDMA sample test application" o  ~3 B5 `. x+ b0 C' t
  2. /*: B) \5 l' Y6 w& L: x
  3. * edma_test.c
    2 z6 d% j6 a/ s  M7 ]
  4. *' n4 F4 I2 h! B, n. U
  5. * brief  EDMA3 Test Application
    + \6 C& T: a/ P. g
  6. *
    8 \; q& y1 z1 F& _
  7. *   This file contains EDMA3 Test code.
      b, c6 V4 V9 {/ k
  8. *: t# E$ o/ d% z: S' n5 ]+ }) C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( x$ T! e/ e  o* v+ l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( f0 g5 X: L+ a; [. K5 p" }
  11. *         TO CHANGE.
    : ?. l% Q% v  V. _5 p8 {/ [3 V
  12. *
    2 B% J# Q5 z9 p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# l6 X. ?2 d6 I8 I, `; {4 v
  14. *
    ( y( s/ R$ C8 I2 x1 T5 ]- ^! {. ?
  15. * This program is free software; you can redistribute it and/or9 Q% Z6 T! q4 D3 g$ H! T
  16. * modify it under the terms of the GNU General Public License as( p- `, H2 E% \, k: o9 w
  17. * published by the Free Software Foundation version 2.& C7 O( |  {9 ~  D4 l7 g  d
  18. *: r' g$ c% L) ~4 \* a0 h9 b1 g8 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 C/ r1 f5 ^9 @' n; L& h& h
  20. * kind, whether express or implied; without even the implied warranty
    / c* U- d" H, ?$ R9 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" C: t" b4 M3 \' C% E2 F& P
  22. * GNU General Public License for more details.
    6 W: ~  |3 c2 `$ p% l
  23. */
    : p8 \- H9 @% z1 |& Y& ~" S& F% O
  24. " I; d2 r  ^. I2 ?/ g
  25. #include <linux/module.h>3 N3 Y$ l# L" ~  \( }
  26. #include <linux/init.h>, v  c3 q7 T  t# K) R7 H! Y
  27. #include <linux/errno.h>9 a2 f! x. D& E" q1 Y4 \2 B
  28. #include <linux/types.h>
    : z& X- G6 r# Q6 x% {  \! `
  29. #include <linux/interrupt.h>! e% ^0 D0 y, @( i, z( m4 L: l+ u0 p
  30. #include <asm/io.h># z' Z- k' R2 ~& f4 m, y& Y
  31. #include <linux/moduleparam.h>3 G1 K/ z8 L3 [: ?7 V: a: ~+ ~
  32. #include <linux/sysctl.h>5 p0 U3 f( ?7 h  P2 k
  33. #include <linux/mm.h>
    4 _/ v3 w  Q% _4 ?/ Z' `- }
  34. #include <linux/dma-mapping.h>8 R( C) Q3 E$ i; n  N. f. l. d* l

  35. " C5 D3 Y( Z, N; T& i% S& b7 w" q+ M
  36. #include <mach/memory.h>
    4 R  I4 d& t$ [: ^+ H: t
  37. #include <mach/hardware.h>
    + S; D( B$ z- x, F0 r9 _  [# N
  38. #include <mach/irqs.h>
    & N8 p8 m" g& J& u
  39. #include <asm/hardware/edma.h>
    * F4 ]3 _7 f4 I; T
  40. 8 A' `1 l; m$ d2 g. m+ s; U
  41. #undef EDMA3_DEBUG7 }" I$ z9 O: T7 D
  42. /*#define EDMA3_DEBUG*/; t2 o9 h1 N9 i
  43. % t( d2 E* R7 T4 j9 P7 j
  44. #ifdef EDMA3_DEBUG
    0 h: y& }, R. _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 r) U; j) ]5 x, c$ [2 k/ B2 q1 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" }9 f' M0 ^. L% j) k# O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* g6 d! I5 u7 m5 v/ R' T% x
  48. #else3 o/ F5 R3 j9 }% P" c2 C
  49. #define DMA_PRINTK( x... )& R1 z  h" a- v5 a9 `$ G8 l
  50. #define DMA_FN_IN4 h. g9 E0 d+ U3 z, Y, D2 K) K9 z) J
  51. #define DMA_FN_OUT2 }* T' m: V. i2 l: t8 R
  52. #endif1 [7 W% |" M2 A. s4 D/ ]( y

  53. ( B% F* I6 u  ^+ E0 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      k% J: L# Q* j" [- a7 R3 {
  55. #define STATIC_SHIFT                3
    ) h8 J8 b' a3 U9 q
  56. #define TCINTEN_SHIFT               20
      o) h: J7 ~: ]6 j* e" R4 ]- t
  57. #define ITCINTEN_SHIFT              21
    ! c: T) f5 O. p, g: s4 b
  58. #define TCCHEN_SHIFT                222 y7 z7 @3 G2 A4 e& a' Y' ]# B+ P
  59. #define ITCCHEN_SHIFT               23
    " c4 i" R) Y; {: [

  60. 3 L# ?6 x. ], _! X3 f; [
  61. static volatile int irqraised1 = 0;4 n8 L9 M$ V$ a* F) Y# }
  62. static volatile int irqraised2 = 0;
    1 H1 w8 B" {/ S+ T
  63. ' B) n. j+ I. N' y1 b, V  G, I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ j! p+ U. t( B: P$ C0 n$ I* ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 R* C1 c, e+ U7 f  y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 p8 l+ I( Z7 q* q1 `, L% c/ ?

  67. - T9 F/ J- I" i* z
  68. dma_addr_t dmaphyssrc1 = 0;! s3 ^0 y% R& i
  69. dma_addr_t dmaphyssrc2 = 0;
    * X2 \6 ]) k8 S/ \8 P% ]3 P( }$ g# M
  70. dma_addr_t dmaphysdest1 = 0;7 s3 Y: F9 c" K, {. C9 u# Q( I5 }
  71. dma_addr_t dmaphysdest2 = 0;7 J& c% u5 i. P- r; V

  72. - n' I6 F" s% J' P1 B3 c
  73. char *dmabufsrc1 = NULL;
      ^4 X$ A1 z8 K
  74. char *dmabufsrc2 = NULL;
    6 v( l" T& Y+ S+ D- K- M5 b
  75. char *dmabufdest1 = NULL;; _4 t4 Y& U" z. e
  76. char *dmabufdest2 = NULL;/ v: `; c- C/ F9 T$ ?; g
  77. 5 k* n+ a1 b& S; B
  78. static int acnt = 512;
    " O( ^1 K8 o: H; J$ [9 K3 X
  79. static int bcnt = 8;" w& o% }* Q* z
  80. static int ccnt = 8;
    - t& c* C, Y( M7 m6 i
  81. 2 {  w( M% s- \3 P2 O4 ^
  82. module_param(acnt, int, S_IRUGO);
    / M- g: P# h5 C6 G
  83. module_param(bcnt, int, S_IRUGO);0 H2 O+ q- Q! n2 i4 _- R7 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 m$ ^" ^- k2 S4 U$ N* A  o( n' B" ^3 c: J: T1 @  E; @" B/ Q3 \0 y/ h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& }1 G) ?" b  H4 c: p  H4 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 g( a9 P* h' c2 ]: C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: Y! \! w9 d3 v: A: \2 _$ _8 @* x6 f$ d" X
) ?* }5 G; h; w) F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 05:35 , Processed in 0.039456 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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