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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 w  t9 T: L6 r# \
  1. [code]EDMA sample test application( E/ E3 T* G' [# Y( n' }0 d7 e0 C: _. u
  2. /*
    ! P! g4 ]6 Z9 g
  3. * edma_test.c/ j" D- C, C* H# E
  4. *
    2 w$ T% y9 [- Y. P9 L: W# K9 c
  5. * brief  EDMA3 Test Application* r4 [1 L0 o: {; O
  6. *
    7 C5 n# e' o* n. o
  7. *   This file contains EDMA3 Test code.1 @! m, x! d6 t: K# d! c
  8. *
    8 n  W- k3 l) i- L) ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; p" Q0 r, O" r! f5 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 f2 n+ }  ^3 w- Z) Y1 S# Y. q
  11. *         TO CHANGE.
    8 ^) G6 F- G6 D
  12. */ {2 b5 Q# x0 W. s' m4 U* m( T; O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) l; k( \7 j& c% j' j2 S" {, s1 x
  14. *' ~0 M( F9 N9 Q9 r1 c. W
  15. * This program is free software; you can redistribute it and/or
      f5 \4 s) y6 |* h
  16. * modify it under the terms of the GNU General Public License as
    2 o& y. e) C) g3 Q
  17. * published by the Free Software Foundation version 2.
    ) a) y. l3 |3 K% @0 Z$ U' X
  18. *
    . a7 E! b3 @3 V3 l) z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , Z2 B' y; W/ k
  20. * kind, whether express or implied; without even the implied warranty
    + _- z5 {3 H4 E5 ~/ j! s7 [/ z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & Y6 y+ p, x: X, [2 a
  22. * GNU General Public License for more details." C# l9 D# I4 b: A
  23. */
    3 p3 @& ^# }; _( c1 ?
  24. 1 H# j9 |! c8 x5 u2 F. t& D/ W' ~
  25. #include <linux/module.h>2 X2 I* K! |# }" `
  26. #include <linux/init.h>
    * e" U- j9 x) d; u8 T6 F# E
  27. #include <linux/errno.h>6 l+ i0 C. u" z3 G/ e
  28. #include <linux/types.h>6 m3 c7 t; H/ G( N0 `3 M
  29. #include <linux/interrupt.h>- b$ p; C0 r! j1 ]
  30. #include <asm/io.h>
    - M- u5 D+ a0 E0 R
  31. #include <linux/moduleparam.h>0 O& n0 P/ C5 l# a; f. s7 n
  32. #include <linux/sysctl.h>
    : |; z- Z! J4 r- t  s" I- x
  33. #include <linux/mm.h>1 g! \" O$ w# ^
  34. #include <linux/dma-mapping.h>
    6 R1 W- K. v! @6 d8 }

  35. . `7 R: z/ L4 o; [. o+ T
  36. #include <mach/memory.h>) |; p& @; ]. \- t" k- @
  37. #include <mach/hardware.h>3 M7 G5 h) U2 _3 H5 T
  38. #include <mach/irqs.h>7 X. P5 K8 e' U  w2 r
  39. #include <asm/hardware/edma.h>
    3 U* e1 k. e$ |
  40. . L# ~( X9 m8 ~: S. p' k: T
  41. #undef EDMA3_DEBUG
    ) T2 `- E  i% @0 q
  42. /*#define EDMA3_DEBUG*/
    ' R! g! P% D: h" y/ ]* V1 H3 P' r

  43. : Y6 ?% f* X. {; ~$ L
  44. #ifdef EDMA3_DEBUG
    - a, [" Y8 j5 K. Z/ p4 }2 C/ l4 C5 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): o  O" B% i3 V$ D5 R2 h5 L% Z/ ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ i- F# q' w/ M2 G6 e3 Z/ o9 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 y) D& z+ X  b
  48. #else
    0 c. g  B$ k. M* F" u: _
  49. #define DMA_PRINTK( x... )
      m6 _  L- r$ B) b; W0 F( Z
  50. #define DMA_FN_IN
    ! ~9 `) S" Z0 q8 r% v% @. c7 P
  51. #define DMA_FN_OUT6 J) p5 d" n6 l$ p1 X0 ?/ o
  52. #endif
    6 f- r: i! l( [& h- x

  53. 4 L; ]3 c1 O( G1 T4 v6 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- _: w; }8 I5 t  j
  55. #define STATIC_SHIFT                3) V" R7 u# h/ u, _5 ?/ b: C; \$ h
  56. #define TCINTEN_SHIFT               20
    ; t9 h3 C8 B* w) v
  57. #define ITCINTEN_SHIFT              21
    ( P" y5 N( k* H! V$ \/ n4 l
  58. #define TCCHEN_SHIFT                22$ T, A5 V5 S, l2 b9 s" W" E! t
  59. #define ITCCHEN_SHIFT               23' D7 e* v8 t, V

  60. * x& n9 m% M& E) u- r
  61. static volatile int irqraised1 = 0;
    ) Z/ S, o6 {: k
  62. static volatile int irqraised2 = 0;
    4 [( x8 _4 `# j( }- R/ `

  63. ) y. j; G  ]  z0 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 [: ^% h' \+ w! W" X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 b: u2 `, A1 D" c) h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 {) ]- p6 Z! y8 O! ?

  67. " y$ p) R" n$ |, H5 z7 B6 @* y
  68. dma_addr_t dmaphyssrc1 = 0;
    & v" I/ Y& \/ p
  69. dma_addr_t dmaphyssrc2 = 0;! X, N8 {' S7 _) \) Z
  70. dma_addr_t dmaphysdest1 = 0;, k! \9 r( p' B" N+ y' w
  71. dma_addr_t dmaphysdest2 = 0;
    8 k  e5 o) C0 |; s7 [
  72. 8 K7 r2 ~9 \, B" R
  73. char *dmabufsrc1 = NULL;
    ) a4 A( V$ E1 e4 r- d% ~7 S! l; N
  74. char *dmabufsrc2 = NULL;8 Z" o+ J- M' X% @# k1 J
  75. char *dmabufdest1 = NULL;
    ' W9 l. {  R- P7 u  ?2 ?0 _0 p( Q
  76. char *dmabufdest2 = NULL;
    9 Q2 G- j  E' |4 B
  77. ; y, a: K* d+ R
  78. static int acnt = 512;
    9 L$ q% b& T# S! I! u
  79. static int bcnt = 8;
    9 w6 G& o: U' M' F, j7 y8 g- N
  80. static int ccnt = 8;
    $ S4 W: L# y1 J% @) M1 }

  81. - }- A& O+ B- z& {( ~% w- `
  82. module_param(acnt, int, S_IRUGO);
    8 o; @1 p- C. v. ?
  83. module_param(bcnt, int, S_IRUGO);3 d% N8 s, f  p9 n! N; @, n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 U; P: D$ v5 s2 X
. Z/ [+ R4 g9 x3 S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 @2 }* G+ \$ J) c/ r* f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ L& o5 F3 Q2 l/ c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ t1 j+ S) _  E( C  T4 \% B" h; p: h4 z0 y: t
- D. A) |9 b" N2 `. ]- O* D& W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-3 16:12 , Processed in 0.038135 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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