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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & d! D( v6 O  Y( t) O2 Z9 N
  1. [code]EDMA sample test application
      n* @# q4 q2 _/ t
  2. /*4 k) |- }* e, K" l! ~9 h+ [
  3. * edma_test.c
    + X/ M+ \5 T8 p  u& U0 [- L
  4. *
    ' x9 S) L0 X' y1 I2 _6 S' q8 f
  5. * brief  EDMA3 Test Application3 P- L1 C# ]4 N- U
  6. *, y; ~/ h, {8 H) H, u3 p/ [& _
  7. *   This file contains EDMA3 Test code.
    8 H. q/ o& E4 _' o, Q$ J  ^
  8. *
    9 B' U9 T4 I9 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - Q7 A( [5 F/ P( `; j  `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ ?! {9 S( I" |2 \
  11. *         TO CHANGE.1 c' U( \, E. u2 e* Q6 l  @6 i
  12. *
    9 @4 j/ ^; {+ ]3 f& l0 J# Y8 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % Q5 @9 L2 X, O* z9 z8 i
  14. *# u8 B# {: u6 O2 p
  15. * This program is free software; you can redistribute it and/or
    * n9 j& f/ `4 Z0 e! ^$ }! {; _# b' L
  16. * modify it under the terms of the GNU General Public License as" W5 w' @; O* S4 q- b( |
  17. * published by the Free Software Foundation version 2.: t' I& Z0 `7 D# ~8 \( U
  18. *
    1 ~3 p# ~$ h6 k; u. g' o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 I4 D" \* K! ]# }8 s. f
  20. * kind, whether express or implied; without even the implied warranty
    & s; Q' O  T% Z+ e% p) E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % K+ I4 n9 K  e- V
  22. * GNU General Public License for more details.
    9 I; u6 k$ j. C" \/ m3 j
  23. */
    ( o. b5 J0 a( H3 ?

  24. 9 \' h/ C# F* g6 {# U
  25. #include <linux/module.h>; b6 p- x4 k/ G5 }
  26. #include <linux/init.h>8 F5 ^: x* P7 j2 `
  27. #include <linux/errno.h>
    ) i- k) g+ N/ q1 o6 x8 W3 m8 R
  28. #include <linux/types.h>
    2 F6 n' p3 p/ u: J$ D% }
  29. #include <linux/interrupt.h>
    9 w7 F* v- q5 y: S4 r. G/ x
  30. #include <asm/io.h>
    7 |2 ~+ D) d& y
  31. #include <linux/moduleparam.h>
    ; j: v; o0 K) C) G1 P6 I3 o
  32. #include <linux/sysctl.h>9 M: P: s( F5 N
  33. #include <linux/mm.h>
    + V3 L/ C2 y7 u) p+ T( ~% R
  34. #include <linux/dma-mapping.h>
    / t  d* A) m. Y
  35. 8 U4 m7 Y7 c1 q( r8 s# c
  36. #include <mach/memory.h>
    ( s7 O3 x5 Z) q+ r4 }, v
  37. #include <mach/hardware.h>  G4 p) G. Q/ Y; D, T
  38. #include <mach/irqs.h>
    5 Y  Y. F9 y! s+ M) Y
  39. #include <asm/hardware/edma.h>7 Z" v5 k; }' ^3 [
  40. 6 P+ }. q4 ?& j. G) G
  41. #undef EDMA3_DEBUG
    1 \8 P* O" \3 ?" b* k
  42. /*#define EDMA3_DEBUG*/
    ) \; Y' D3 y% x4 ?' _

  43. ) E: y) h9 r: D! f
  44. #ifdef EDMA3_DEBUG
    ) M! g) ~8 u; E. i% J3 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 |5 G  q- ^; Q4 f# U, a7 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - A* M7 ]/ t0 {' k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( l7 v5 }0 C1 K# ^$ \0 m
  48. #else6 I; A, r1 {2 {5 U/ Y
  49. #define DMA_PRINTK( x... )
    " P2 r! n8 P4 z; ^% L! \0 B
  50. #define DMA_FN_IN1 E, K0 ~# ]2 w9 Y
  51. #define DMA_FN_OUT
    7 M" B: y- t2 U- Q, `6 t
  52. #endif
    , e9 b9 W. R! |, U, d! @- }: E
  53. ; Q" R- n3 B& t' q0 m  `3 [7 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% T2 S' V: n# z+ a6 ?, n( a+ N
  55. #define STATIC_SHIFT                3
    $ k3 ~6 o. u$ R5 q% b" U
  56. #define TCINTEN_SHIFT               20
    6 F5 i( U. ^+ r$ G, b- P
  57. #define ITCINTEN_SHIFT              21
    4 @1 E7 g9 @! P( |( ~$ B7 S
  58. #define TCCHEN_SHIFT                22
    $ R+ J$ L* U( d- A' Q& `. D" T
  59. #define ITCCHEN_SHIFT               23: h% J  p& X/ F5 K
  60. 9 z1 W% r$ Y/ v' O) i
  61. static volatile int irqraised1 = 0;
    : d) c  F" c/ T- ^# [
  62. static volatile int irqraised2 = 0;  |* r9 |; _8 ~

  63. ! q2 h0 C; e& V, h+ J9 }% B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 L/ E9 g. {' x! x, z# K$ k" C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 c! e3 _9 o( `1 p- C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ?6 b) R& s4 K( g

  67. ; i6 l0 T& J1 o0 Z* q
  68. dma_addr_t dmaphyssrc1 = 0;* g2 Q3 ?% x9 ?8 m) z4 f, u
  69. dma_addr_t dmaphyssrc2 = 0;
    2 \; N8 q* F, W* D; E
  70. dma_addr_t dmaphysdest1 = 0;
    " g6 L' ^$ _8 A/ ~4 z5 O
  71. dma_addr_t dmaphysdest2 = 0;
    " o5 j* }& L0 b4 a; e

  72. ( N+ K$ d0 I3 W
  73. char *dmabufsrc1 = NULL;
    9 L+ |1 x% v0 Y' @
  74. char *dmabufsrc2 = NULL;! u5 j/ ^$ z% z. e1 F+ W
  75. char *dmabufdest1 = NULL;4 {# J( |( ~2 }' N5 d, m, j2 i
  76. char *dmabufdest2 = NULL;
    ! j6 Z9 w/ x. k- B" k2 e
  77. 5 B& k/ z) }- e9 v; y/ V6 R
  78. static int acnt = 512;7 g. b# d$ [$ w' m' s5 x
  79. static int bcnt = 8;
    4 ~1 e0 f- i; P
  80. static int ccnt = 8;
    # I  V* l, W: f, K( [4 X
  81. + j; S3 a7 G4 T/ Z
  82. module_param(acnt, int, S_IRUGO);. e! Y2 P2 G% C6 ~
  83. module_param(bcnt, int, S_IRUGO);
    / o6 @5 [: {& D$ }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 E3 M0 F' M6 e% I: h
) I- o' ?: T0 F6 G5 ?1 A9 Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 t; h9 x3 [% o. h* }( Z( \2 uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 N) {* e& l$ g% m; @: [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; L, |. F' d6 w3 W* y& e; ^, V, b4 R. Z6 i
" c" \9 r0 b- ~* x0 O) @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 11:14 , Processed in 0.036690 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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