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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. A2 u# N% X  n% v4 U
  1. [code]EDMA sample test application: O, t" X' A9 D. n0 @) r
  2. /*
      L. @2 n! S. S& u, @
  3. * edma_test.c! _; `8 n/ X/ S) J, c. V% A
  4. *
    5 E" N5 m8 |5 w9 Z4 j1 H
  5. * brief  EDMA3 Test Application$ `4 W6 U1 i8 L. d
  6. *0 P5 Z: D2 W1 o* z8 C. G
  7. *   This file contains EDMA3 Test code.
    + `: `0 B% D/ W/ q, D8 t
  8. *  S9 \* K4 D6 r! h* U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' q: |1 L1 |" t' }% s* m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: q/ X7 m2 l; |
  11. *         TO CHANGE.* }- J' \( `; x0 @
  12. *& H0 \" l! M  t" g  w9 \; G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 c4 E9 W1 y1 |9 l  M
  14. *
    ; N4 U4 M; j7 G
  15. * This program is free software; you can redistribute it and/or7 Q" o1 s- x# V& r$ {- `/ i
  16. * modify it under the terms of the GNU General Public License as
    + J. R+ M" [; I6 r2 @" i2 ~  U
  17. * published by the Free Software Foundation version 2.% ~. `& I, X  n' ]
  18. *, ~/ U+ J( Y$ d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* B4 T0 Q7 q' U4 Z; s5 m8 M4 n$ |
  20. * kind, whether express or implied; without even the implied warranty& j! y- T$ B2 S6 ]* z: x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" L( f7 G$ I7 w" P
  22. * GNU General Public License for more details.
    0 g: G2 u0 Z% T2 h- Z
  23. */9 J8 I% ~( m+ y* m; G( _( Z% Q
  24. 9 U! n; ?0 v; ~& L% W0 ?
  25. #include <linux/module.h>9 ~3 J+ L. n- y+ L  V
  26. #include <linux/init.h>) o/ J$ ^7 ]: l+ n
  27. #include <linux/errno.h>! v/ l" E  _! a' T! n# g: [% P7 H# ^8 R
  28. #include <linux/types.h>
    6 ], H- Q/ n* `: q/ \
  29. #include <linux/interrupt.h>; H9 T) X5 v6 {3 ~7 S0 E) ]
  30. #include <asm/io.h>7 _, P' J' J  Q; X' R3 ]
  31. #include <linux/moduleparam.h>
    & H6 v- w! X3 p; r% t8 v
  32. #include <linux/sysctl.h>/ m% Z0 A* F( t5 H; U* S
  33. #include <linux/mm.h>6 ^4 @9 X9 T2 |5 K
  34. #include <linux/dma-mapping.h>& a/ [5 h) F( j5 R7 P

  35. ) c3 o6 r, \' W- v( w
  36. #include <mach/memory.h>
    8 j6 U, r  r  }6 Q
  37. #include <mach/hardware.h>
    - B' U7 w- A) m' o0 x
  38. #include <mach/irqs.h>
    # }5 E4 ~, A8 w6 j; o  D
  39. #include <asm/hardware/edma.h>" N2 N% @; S6 w/ A: N

  40. " k1 t0 ~7 {# ?8 ^
  41. #undef EDMA3_DEBUG
    $ E8 ^2 c- P6 A* Z; F9 V8 Z% ~
  42. /*#define EDMA3_DEBUG*/
    3 a4 O; b1 l3 V  z* n
  43. & ]1 K% J# K5 t! w* a- W. n% q
  44. #ifdef EDMA3_DEBUG
    , a" J+ S& K$ s2 g" Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ F5 R( B+ S- N# W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / O' k( x5 m+ x, f9 V1 u* o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 K2 R# n  i( H0 W
  48. #else2 ~/ ~+ J! S' j9 P/ A
  49. #define DMA_PRINTK( x... )
    ( |) |# i5 {( E1 o' j
  50. #define DMA_FN_IN: ~8 F: I+ `/ u) v; j! ~2 S
  51. #define DMA_FN_OUT$ T) h/ W) I/ T" B# D
  52. #endif, z6 h( r) g& i5 s
  53. $ ^2 M( P. j8 D3 |4 \8 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 I. m! n) N: a# f" T/ F7 ^
  55. #define STATIC_SHIFT                35 M5 c2 }6 i1 L4 V; Z; M
  56. #define TCINTEN_SHIFT               20
    / N9 Q  A0 y  m* H' ~
  57. #define ITCINTEN_SHIFT              21
    9 q% }1 [2 W: D+ n& f# ^
  58. #define TCCHEN_SHIFT                22+ a: q* o! s( X! Y/ @/ K
  59. #define ITCCHEN_SHIFT               23  E  [  s9 }& K, O, w# {8 C
  60. ! Q/ n; o" {/ H; `- }, _" K3 I
  61. static volatile int irqraised1 = 0;
    . \  T8 ~6 t- V+ z) m) }4 ]
  62. static volatile int irqraised2 = 0;
    , o6 o8 ~( @$ L7 p" `6 T( K
  63. , N6 q/ b6 z+ J- ~! B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - B& ]' c+ L& T7 t+ ^; ^" t& t) I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * V) V4 b2 v6 D6 r# B* d4 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ r) {" d& J' S$ s

  67. . E4 _4 Y, \6 L% T, [
  68. dma_addr_t dmaphyssrc1 = 0;
    5 u7 X" w5 [8 E2 X7 p7 j
  69. dma_addr_t dmaphyssrc2 = 0;  w" c6 O! m- z: g# @
  70. dma_addr_t dmaphysdest1 = 0;
    9 R! z- ]6 b5 L, Q* W
  71. dma_addr_t dmaphysdest2 = 0;' E/ g+ E2 e+ r6 a
  72. ; J$ p' z6 w9 c! ^, h8 Y% U
  73. char *dmabufsrc1 = NULL;+ e2 Q" d" i5 J8 ?4 L% `
  74. char *dmabufsrc2 = NULL;
    , d7 S; \$ l" U0 u9 u
  75. char *dmabufdest1 = NULL;- h2 h/ c' D5 m
  76. char *dmabufdest2 = NULL;& E$ [+ h' u) T7 B' {, ?6 T

  77. / S- n9 K" a* w2 `3 D+ B6 u
  78. static int acnt = 512;  L7 ~/ j" x+ m: R! Q
  79. static int bcnt = 8;
    5 h7 C1 I2 r' w) g' w* s' v/ m
  80. static int ccnt = 8;) A6 K/ z, |( O& d9 w; I

  81. 4 F* S# z7 y9 b8 r) i; `1 a
  82. module_param(acnt, int, S_IRUGO);/ Q- J9 e1 w% n' |
  83. module_param(bcnt, int, S_IRUGO);
    - u  D8 H5 k- N/ F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; t+ ?( N& K$ s
0 z) m1 c5 G7 B  @1 w% `' K4 b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 {$ ~- z, K# K( o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ N2 l' j+ F& W$ q5 U8 a+ R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" |2 p/ g3 N, r$ ~4 D7 a4 @, j  [+ A" C4 }+ m

+ D8 E* j4 H" D9 Q. Y) F2 X# P; v1 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-11 10:17 , Processed in 0.040373 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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