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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ p8 T' g% n7 l' Y7 j$ s: K# A1 `* B* i0 ]
  1. [code]EDMA sample test application% o2 i) s% ~2 `7 M2 G* |
  2. /*
    6 i) j" t; K, _
  3. * edma_test.c+ k' v% L) W) q1 D/ c
  4. */ A" ^) [1 i" @  H# j3 K% {. w8 X
  5. * brief  EDMA3 Test Application
    9 b9 h% M" d" v7 g
  6. *
    5 p: p" `  U9 z- W: N1 X" B
  7. *   This file contains EDMA3 Test code.4 W# b% j3 l# c" j" p
  8. *
    * y2 m( v1 T! k: o# @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + U) l& I3 N- I5 C# Z( g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 Z- Y# O  g. E2 \* U2 Z% ~; ^. D
  11. *         TO CHANGE.! g' |. Y; b+ d2 x7 {# |
  12. *3 F8 D; |% u" K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' I4 }$ U' E% S$ Z1 o
  14. *
    + D  E( Y1 ^9 `* @
  15. * This program is free software; you can redistribute it and/or% D7 |% N; B) N
  16. * modify it under the terms of the GNU General Public License as- g/ t. r5 Z; B/ e& w5 o  v
  17. * published by the Free Software Foundation version 2.9 U$ q, C+ Y& x( q( ^! r
  18. *6 }6 l8 _2 b! g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! Y$ T; z' K. k' X9 h# G, F  h% B) j* q
  20. * kind, whether express or implied; without even the implied warranty, w! D5 |. E7 }. B7 V) I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 ?. [; l& V% A: v8 q/ D6 k
  22. * GNU General Public License for more details.
    ! b7 n; e; `% H  G- F
  23. */1 H4 L) Y; t) G2 H; H3 c
  24. 1 p' S3 P( q* {! r# [4 h% A( s
  25. #include <linux/module.h>
    * U2 x, A* N9 J* V6 E( _4 k# ?
  26. #include <linux/init.h>
    2 O8 @" l2 p+ a0 H
  27. #include <linux/errno.h>
    / ^7 Z9 ?2 [7 ?( p) f4 [& P
  28. #include <linux/types.h>6 M; `4 z$ F' M# O. g% c
  29. #include <linux/interrupt.h>) K' s  b* V! z# {. g
  30. #include <asm/io.h>! e" H6 V, T, _! @  m# r: F
  31. #include <linux/moduleparam.h>  n7 |1 |, C/ d% m( a+ J
  32. #include <linux/sysctl.h>0 i# o+ |/ E  J0 G4 d
  33. #include <linux/mm.h>' P5 F9 N* _, p8 i2 g
  34. #include <linux/dma-mapping.h>
    4 A# x$ ~. a! {7 I3 p' [
  35. 3 s, v7 }7 _; u  @$ Z/ I
  36. #include <mach/memory.h>
    . F6 h' F: F/ Z6 h- O$ ~: l
  37. #include <mach/hardware.h>7 `& h8 f4 [& J0 I: b
  38. #include <mach/irqs.h>
    & @7 O  y; u! k! E/ p) p
  39. #include <asm/hardware/edma.h>
    0 T2 K3 r3 g0 d' n) C2 @( i& u8 K

  40. 7 j$ c6 d4 g' u4 t% i
  41. #undef EDMA3_DEBUG2 ?) }# }  C7 ]9 ]# G" r
  42. /*#define EDMA3_DEBUG*/2 y9 L. o1 a% w7 w

  43. " Q( \& ~) U( |% a: H
  44. #ifdef EDMA3_DEBUG
    ( R2 \5 }( E7 [, i- q; K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + _- a$ ]: }# e: M7 v1 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). Q, H; U& |5 {- ^+ ~" ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + N1 h' D9 A$ M0 Q5 {* j' a
  48. #else- \+ d1 h- @+ @+ l! ?- b/ y6 F
  49. #define DMA_PRINTK( x... )
    ' Q& p8 S; Q) r4 X
  50. #define DMA_FN_IN
      C6 g7 S0 ^+ `, L% O
  51. #define DMA_FN_OUT
    ' s* [( Y" A0 b0 ^; O# H1 K
  52. #endif( i# r6 ^5 D7 _# L% {2 `' g1 k( @
  53. 9 C3 F9 _- f, U6 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 h+ K1 I& l$ W$ B
  55. #define STATIC_SHIFT                30 y9 F; w7 f1 ^; n5 _) G, y
  56. #define TCINTEN_SHIFT               20" ^! l9 r# [, w! U0 j
  57. #define ITCINTEN_SHIFT              21
    , r/ ?/ H, l' V+ P" u: m
  58. #define TCCHEN_SHIFT                22
    ( F7 E* {! U( k4 ]
  59. #define ITCCHEN_SHIFT               234 e! t9 n* F6 U
  60. 1 g( ]! f. e" x( u
  61. static volatile int irqraised1 = 0;, k, G6 H+ ~4 _; }% V6 q
  62. static volatile int irqraised2 = 0;' O, Z! U9 e  F7 A% i& H
  63. ! p2 G! W4 p% Z2 G0 U1 @1 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # a  B( u2 `; G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- E- E, R# o5 ~' B/ M7 b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / y0 I8 N, g  G1 c$ H3 a2 U
  67. ; `3 n6 I% {% O5 Q3 h
  68. dma_addr_t dmaphyssrc1 = 0;& J8 B' X2 w; u$ F
  69. dma_addr_t dmaphyssrc2 = 0;
    $ m8 m% K" r% ]1 A7 k; q0 r+ p# o
  70. dma_addr_t dmaphysdest1 = 0;
    ! b5 ^0 Q9 E6 M1 I: n! p& G
  71. dma_addr_t dmaphysdest2 = 0;
    ( ~3 F% B4 E1 J! z$ }3 v

  72.   n3 D. a( g  p3 ^
  73. char *dmabufsrc1 = NULL;
    # K! i) P3 U: i6 g" j1 [8 @
  74. char *dmabufsrc2 = NULL;
    $ d- b; v" e! Y& Q) y. h
  75. char *dmabufdest1 = NULL;: W) |  F3 D! {( |4 ]! a" m
  76. char *dmabufdest2 = NULL;9 }# W, e% @/ z1 [' O  t+ w- ~( `
  77. & `7 T1 b, Y( ^) d
  78. static int acnt = 512;+ y$ W) i6 `0 I- V
  79. static int bcnt = 8;
    3 I6 j8 Q% t9 s
  80. static int ccnt = 8;
    - o( ^1 z- s! ]$ w
  81. ( `, M$ t; _3 w* c& q' P6 h9 E$ \+ b
  82. module_param(acnt, int, S_IRUGO);
    ) K8 D7 a/ [4 [
  83. module_param(bcnt, int, S_IRUGO);. s7 h( v7 Y8 x% _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ K& ^  }( ]' b" b$ P
6 J$ H7 T9 g9 `' q- t) q& g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% g8 u8 I# B# p; j2 P2 m+ ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" i8 K' l7 V% _8 [+ q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 Q+ f+ i( }1 ~0 X

' q0 [: ?% u0 T8 x- t) J4 F' [( J9 s. E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 02:23 , Processed in 0.040390 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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