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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . Q0 }  W8 j  ~1 j) j3 I+ R
  1. [code]EDMA sample test application
    . |0 j: d0 s! v/ M. Y
  2. /*
    ( h) z! [  z* m' N/ A
  3. * edma_test.c- W2 o' Z7 f) u( }: g) ?  d% V
  4. *: ^+ k/ ~& K/ D  n" q
  5. * brief  EDMA3 Test Application8 `; q6 G' C, H# g; q, W
  6. */ h% f- t) n% |1 `- r1 h4 B
  7. *   This file contains EDMA3 Test code.
    1 r, i4 X2 [6 P7 [& t  ^# `0 P
  8. *. N$ P' L, G6 F, B& n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 k" l2 E/ F  C2 V" B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' f' O+ X; l% a; a) t- M# ^
  11. *         TO CHANGE.
    # `1 D' N& w' Z" ~; J
  12. *; _5 V9 a% G% }+ L, U  v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - s: x. V2 K: c" |6 v) P, U
  14. *
    2 h- k" l' {2 j: C$ U7 W. ^
  15. * This program is free software; you can redistribute it and/or
    ) \& A1 l+ [! v
  16. * modify it under the terms of the GNU General Public License as
      w+ S) k2 n4 U1 ]& W3 a* M2 M
  17. * published by the Free Software Foundation version 2.3 v1 r: V# S% w. W7 l8 r
  18. *
    ' c2 ~3 {8 c9 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! Q7 j0 }9 y! C# _8 {
  20. * kind, whether express or implied; without even the implied warranty
    " T( _; p. ~2 {/ `0 _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) @1 ], F3 ~3 ^: u8 M
  22. * GNU General Public License for more details.
    - w9 ^# N6 T5 c( V+ |5 q
  23. */
    0 X. [! T, B( Z& p8 e9 u8 `

  24. . ~5 j( w1 C2 q
  25. #include <linux/module.h>! i& a' S8 S: S* F
  26. #include <linux/init.h>
    * D" R6 y/ ^, {3 \6 h1 J
  27. #include <linux/errno.h>
    6 \- [/ |1 ?* W7 c( G- H8 C
  28. #include <linux/types.h>0 p% G/ a2 c8 y; O) @. s
  29. #include <linux/interrupt.h>
    ! Q: ~/ P* \$ q9 V
  30. #include <asm/io.h>
    5 R+ F8 O$ w2 ]
  31. #include <linux/moduleparam.h>
    " H/ m9 r9 d9 q: k' q
  32. #include <linux/sysctl.h>7 [7 J7 ~2 d! W& N6 Q& }  L
  33. #include <linux/mm.h>
    # R3 V6 N" x# {4 {+ M+ e
  34. #include <linux/dma-mapping.h>
    9 b6 W, d6 H; l/ j2 w: x
  35. $ S0 p1 ~" D/ E
  36. #include <mach/memory.h>
    ) G' w4 U4 w) w! V; A7 o
  37. #include <mach/hardware.h>
    : O$ ~% X; o# v8 h, m
  38. #include <mach/irqs.h>
    # ~1 }; |- ~6 P% [
  39. #include <asm/hardware/edma.h>
    . g4 C7 |- C9 x* E

  40. 2 S" C' x( u# [9 t1 V. p' z
  41. #undef EDMA3_DEBUG
    - z( s2 h  a8 z+ u1 Y7 j. y
  42. /*#define EDMA3_DEBUG*/
    # h2 q) \# o! M: c6 w
  43. # O& V5 {7 U6 `4 N
  44. #ifdef EDMA3_DEBUG* A" M+ a, J$ T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # Q! e' g1 L% u9 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( n$ k& m! H* d4 i' O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . m% N8 K% z$ P; ^7 Z+ U/ f" x$ C8 x& \
  48. #else. @6 r6 r. l) P/ n) U% _; s; c
  49. #define DMA_PRINTK( x... )
    " Q6 Q$ }7 D  ?- c& L" U5 e- i
  50. #define DMA_FN_IN
    / O9 Y( k' x( L! Z* C( T, R' }
  51. #define DMA_FN_OUT
    : S) w$ v9 Y. T3 \# |
  52. #endif# K' F! p+ r# V- j: P) p. X

  53. - y' a( f; w0 Q& [% @5 f6 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ k& @9 b5 f8 I/ \6 w$ B
  55. #define STATIC_SHIFT                3. a+ U' Y, w% _# {' n6 H1 U
  56. #define TCINTEN_SHIFT               20& r" t7 @" b# K
  57. #define ITCINTEN_SHIFT              21
    + V4 o" D9 ]. n1 V
  58. #define TCCHEN_SHIFT                22" Q$ c3 C* z& ]
  59. #define ITCCHEN_SHIFT               237 p$ Q8 [7 f2 u3 b

  60. : h+ X+ @& `" q$ J* l# {0 M5 L
  61. static volatile int irqraised1 = 0;
    ; c, B& B* i7 {
  62. static volatile int irqraised2 = 0;
    7 L% u" y: T& z7 w9 d+ C; G* x
  63. / n4 a2 I9 \- l( z# c) e7 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & c2 A" G0 {0 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 C. i( v1 N8 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 d* H# g- _, v
  67. 2 L! E! F; L& e6 |
  68. dma_addr_t dmaphyssrc1 = 0;
    ; V  e# H- n% Z6 f& r, ]( V
  69. dma_addr_t dmaphyssrc2 = 0;
    ; `* x1 V2 G9 Q) l4 j) T/ p" \
  70. dma_addr_t dmaphysdest1 = 0;
    2 Z# L7 r& d3 f0 q; V$ d3 a, J
  71. dma_addr_t dmaphysdest2 = 0;
    9 N6 {3 n" `: r8 e! ~( @

  72. 9 C/ _  P# ?: _7 F& r$ \
  73. char *dmabufsrc1 = NULL;7 @4 \- I, T1 d! f
  74. char *dmabufsrc2 = NULL;0 m) f5 R7 a' T1 j
  75. char *dmabufdest1 = NULL;
    8 C3 Z( @* p1 o2 A8 C( i2 y6 V9 w% j
  76. char *dmabufdest2 = NULL;/ a+ e$ r$ P$ a5 ]- [; ^; q

  77. ; }  ~# ~- F4 I/ r
  78. static int acnt = 512;2 {2 c/ J5 l; V8 U8 w
  79. static int bcnt = 8;) u7 y  F" ?- Q/ z9 ]# q: H
  80. static int ccnt = 8;% L, B% g; K2 O! |: b6 `

  81. 4 C/ y2 H- k3 m6 o4 @7 p5 l1 _
  82. module_param(acnt, int, S_IRUGO);( B4 B5 @( l" k; K4 U0 ]& F' O
  83. module_param(bcnt, int, S_IRUGO);
    7 x% ?+ w* P2 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' c* p3 z' O: v3 M
& D- F: S  d/ Z  c2 R! }- H- w! g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 _8 f# q  u) _, _2 }/ ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, U) }% A; Y# e& A- S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 h. r& F* a7 ~; S3 }# m( `: \  t: G

2 N' h$ g  D' t8 a; c7 j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 19:14 , Processed in 0.036851 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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