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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 \7 f$ c8 [  d$ N
  1. [code]EDMA sample test application7 K$ L; ?8 ~6 Q! Y$ _+ S
  2. /*
    % A% r3 T/ @6 h' I* y
  3. * edma_test.c/ o6 O/ [1 d( e+ f) N
  4. *
    ; [9 R# G- h8 ?
  5. * brief  EDMA3 Test Application
    8 [4 e  G; v3 `; c4 t& z9 }
  6. *7 _+ F7 `2 o# Y. p% {% |. E
  7. *   This file contains EDMA3 Test code.3 V8 x( D  ?8 L  [" K9 L
  8. *
    , \8 M6 K% ]$ \* `: w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 w4 ]( X4 Z5 m- \9 Z5 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" ^7 q9 w) F3 C
  11. *         TO CHANGE.
    / c" p# C! n; Y
  12. *- V# U" o5 P8 w$ H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & t: A7 L, W* s- z; Y7 ?9 s1 s
  14. *
    5 m! p) t$ n7 B: m1 ^, m
  15. * This program is free software; you can redistribute it and/or* X6 z3 Z, v$ x0 s- V' g
  16. * modify it under the terms of the GNU General Public License as
    ' V1 N5 P% G3 P2 Y
  17. * published by the Free Software Foundation version 2.
    7 d7 |% l" W; A+ t
  18. *
      `+ e! Q: i* ~7 z  V6 D! G) {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 R. P+ d2 I  w, F" F: M. D
  20. * kind, whether express or implied; without even the implied warranty. z, n" S3 ]+ D9 m7 D3 a0 N5 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 j* Q# F$ X% K' O  M
  22. * GNU General Public License for more details.+ j9 ]( o7 F5 d% j% M' V
  23. */+ _  \+ T/ }! W* S" T4 N

  24. & V& L  U. W5 f& j8 p/ [! N* W: p/ g. [4 B
  25. #include <linux/module.h>
    % \. s9 g! M7 a6 _, U# O
  26. #include <linux/init.h>
    5 S; J2 E$ y% X" f9 F1 A' U
  27. #include <linux/errno.h>9 f- ~6 h, G2 u4 \
  28. #include <linux/types.h>
    ( i1 ^9 |9 ], y) f* Q
  29. #include <linux/interrupt.h>
    & B3 C+ |9 N1 P) m. o0 v7 I
  30. #include <asm/io.h>
    ' H: i# D4 R' r, ~! H6 G
  31. #include <linux/moduleparam.h>
    3 j, G. w2 a3 p8 i
  32. #include <linux/sysctl.h>' W" U1 M# L9 R) s( \' C7 ~
  33. #include <linux/mm.h>
    5 @1 g; h, W- Q/ i  k" D
  34. #include <linux/dma-mapping.h>
    6 x7 d2 l/ Z" I  ]" c4 Y: B

  35. , y8 B, F3 ?; s9 R( w6 ?: v( _
  36. #include <mach/memory.h>
    ) y1 t$ J& d  m6 y% \( z
  37. #include <mach/hardware.h>
    % b1 \% \: a- ~5 [; h7 G
  38. #include <mach/irqs.h>4 I2 B& K: c1 X. D* f
  39. #include <asm/hardware/edma.h>( q  A/ D7 u. T8 I! z8 Z& u$ E
  40. ! d: l* u, S4 a
  41. #undef EDMA3_DEBUG1 `& Y9 b7 T8 P( z! {* x. g
  42. /*#define EDMA3_DEBUG*/
    ! q' h3 M: u) T6 ~" |
  43. 8 n) _3 K: j7 D. O& W( Q8 k
  44. #ifdef EDMA3_DEBUG
    + I1 K8 R: U' G. D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- x6 l  L3 I! `% A1 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 q, E+ O: k( f* @. P9 T: L# X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 N1 {0 p. C! u1 D6 c: j6 p
  48. #else
    ) b! G+ O/ V5 q& Q: Q. x
  49. #define DMA_PRINTK( x... )
    ; y- U6 `9 j) E: x9 Q
  50. #define DMA_FN_IN
    6 o6 k* Q; c4 B; A5 c
  51. #define DMA_FN_OUT
    3 y4 V5 c& H' N  q2 t, T, Y
  52. #endif
    9 F" F  h7 V8 a$ {- t, L
  53. 7 }  N: M- F1 {# i" t! k. T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % m: D+ w# z. m/ D7 r& j' W; y
  55. #define STATIC_SHIFT                3: h  ]! C, ~0 R" G
  56. #define TCINTEN_SHIFT               20* G4 c: t2 `# X# m
  57. #define ITCINTEN_SHIFT              21+ l0 C2 G; @. d6 G# R
  58. #define TCCHEN_SHIFT                22
    , K; T% K0 r$ P  d
  59. #define ITCCHEN_SHIFT               233 H# q" {7 ?* }% ?1 e
  60.   c+ Y4 q1 b. \. i
  61. static volatile int irqraised1 = 0;
    . U' A  c: c/ d; a) o& \6 N0 ]; e
  62. static volatile int irqraised2 = 0;# w+ b; s2 a+ k, Y4 K5 J" S6 b

  63. 2 H$ Z' B4 q+ p& t5 Q4 p; e( E& I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Y2 N( ~1 t, Z+ G( s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 \  w$ Q1 I  ?- R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 O" X" [& j0 {/ u, u1 _

  67. % ^) l. q) H8 v( I1 k+ m
  68. dma_addr_t dmaphyssrc1 = 0;$ o4 j8 A5 X  ~( [
  69. dma_addr_t dmaphyssrc2 = 0;8 U9 j  b, O2 ~2 ^0 K
  70. dma_addr_t dmaphysdest1 = 0;
    ; u- Z3 R9 W) K  A% F4 t- f; F0 f
  71. dma_addr_t dmaphysdest2 = 0;
    * ^: g2 Q3 d  R4 }8 ^3 ~

  72. % }4 a3 S1 ?! o- t; h: W6 b
  73. char *dmabufsrc1 = NULL;
    / w' b6 W, ?$ D6 D* I+ T
  74. char *dmabufsrc2 = NULL;& T: ~( a. x7 s* e4 x0 H+ L
  75. char *dmabufdest1 = NULL;
      d# I; u1 D' I4 N0 ^
  76. char *dmabufdest2 = NULL;2 I' J& l8 u1 I# S0 E
  77. 6 o- A; |& U* R/ w
  78. static int acnt = 512;
    4 A- g, @: C- {& l
  79. static int bcnt = 8;! @! Z: `  Y) C* A
  80. static int ccnt = 8;7 O/ {6 _9 Y5 t  k" W% K- X
  81. 9 i4 G6 A* P- ^# G# e4 K$ D) A
  82. module_param(acnt, int, S_IRUGO);
    ! c+ b; f8 x0 }/ i; ^- B! c! A
  83. module_param(bcnt, int, S_IRUGO);
    + c" ^% l3 K) s+ ~% v  U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 S' H  H, R  N: ?! v: u) g& F6 S/ c: b1 q: v& i' s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 W7 q( `( x, H, r, S: Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 v7 n6 f7 F/ {5 B) A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" t7 [, y( F7 Y3 r# ^+ s' ^: _  ~" y0 w; O& s' P7 I

7 i" Z6 X  S& q# U" c2 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 23:10 , Processed in 0.037627 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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