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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' Y8 T, Q2 S: N! y- Q' u
  1. [code]EDMA sample test application' d9 m  J6 [) S5 ^7 v. \
  2. /*
    0 A' G/ r1 [& A
  3. * edma_test.c
    $ Y7 q6 {) m. x) ~
  4. *8 ?2 T1 G2 A  p  Y
  5. * brief  EDMA3 Test Application
    ! S4 [( h1 O3 S
  6. *
    ! L4 @; |6 `% `
  7. *   This file contains EDMA3 Test code.5 d7 Z' h( W$ m8 }
  8. *8 G, C! [; u% i9 D& Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& [1 e8 s. p2 G! X1 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" M0 i" k/ d* _+ L# k5 R
  11. *         TO CHANGE., Z# {$ y1 J  i0 X
  12. *
    - e7 O4 i- r! W* \; s! |- R/ N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + R: @% g) s# f
  14. *  V8 p4 w! ^$ ^5 n/ Z9 e- C
  15. * This program is free software; you can redistribute it and/or7 u+ b' F( W2 D% s9 F
  16. * modify it under the terms of the GNU General Public License as
    ' w% v/ y9 H& g. |
  17. * published by the Free Software Foundation version 2.
    % \: J# Q, y; d: b, Z& N' ?
  18. *0 m/ m' d; m0 d# i5 m. \! F( m  U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : I4 g7 C" }7 C0 n, @: k1 I* R! `
  20. * kind, whether express or implied; without even the implied warranty2 ~) [0 a/ O) s2 x  D) m& p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! a& j, ~/ ]8 H+ H: x# X0 a& @
  22. * GNU General Public License for more details.
    4 @0 h/ n9 |% O) ~6 f/ k5 [9 V; p; O. A
  23. */
    4 B3 X4 r3 y/ b' v( q5 [
  24. 4 e+ V9 o2 l# H) S8 ?5 A! U) Q9 J
  25. #include <linux/module.h>7 |7 _( K7 u1 k
  26. #include <linux/init.h>
    2 T6 H* V" F) H8 R' v2 j
  27. #include <linux/errno.h>
    1 f4 t& N8 Y8 ?
  28. #include <linux/types.h>
    4 G- n4 }3 ~. n. m* Q
  29. #include <linux/interrupt.h>: N: T" h' ~9 l+ z+ i& [$ E' |
  30. #include <asm/io.h>: E" Q! a8 U4 Q/ f
  31. #include <linux/moduleparam.h>- w  X% E; b! [, C  t6 K' e
  32. #include <linux/sysctl.h>5 n+ f/ Y1 P! U3 B4 V
  33. #include <linux/mm.h>
    4 K" U- [0 L3 t# e% r7 K+ }+ _
  34. #include <linux/dma-mapping.h>0 d* F4 A/ T: b6 b

  35. 0 Y9 B( O( Y% M" t! j: J7 Q2 X
  36. #include <mach/memory.h>
    : u# o( ?) r& R3 i6 ~
  37. #include <mach/hardware.h>5 b3 w2 I& ], h) F+ U, s$ Q' k+ g% G
  38. #include <mach/irqs.h>) U0 }' J' g, s; w
  39. #include <asm/hardware/edma.h>0 K0 U, Y7 t* B% ^1 m1 o

  40. 4 D7 O! P* Y6 }
  41. #undef EDMA3_DEBUG
    1 r' E+ b. n3 g
  42. /*#define EDMA3_DEBUG*/# x, m( z) Y# S; ^; i% H$ J3 w6 j
  43. ) \( W/ `$ @6 X
  44. #ifdef EDMA3_DEBUG6 V' }! B; X, w4 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); O$ U' }+ H+ a/ p3 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 P; t4 j" D; x! E  J' ]# S  \5 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% d# b1 H$ R, R3 a
  48. #else
    5 v  Q4 I0 ?3 `' L/ J* ^) G- V
  49. #define DMA_PRINTK( x... )$ \7 K& x. M: C0 {2 y5 X" x
  50. #define DMA_FN_IN. g. Q' t  E5 F2 h# \7 r
  51. #define DMA_FN_OUT5 Q% K6 c1 V2 p% U* `
  52. #endif$ ?( ?9 w- I8 t4 J" T' G- Z

  53. 8 }$ i5 U% J) _( t  y9 P3 _0 {2 T- p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : l% |4 `+ ~- r1 T
  55. #define STATIC_SHIFT                3
    . V  w2 k& Q4 ^
  56. #define TCINTEN_SHIFT               20: r% @& d7 L, \' e+ F0 n# u
  57. #define ITCINTEN_SHIFT              21
    " [, |  q8 K$ a+ T6 {
  58. #define TCCHEN_SHIFT                22/ R! [/ P: y! e+ Y4 ]3 s
  59. #define ITCCHEN_SHIFT               23
    0 H& l' k: s- F; {: U5 @; \  _

  60. ( Q3 w1 O! S( d/ ?
  61. static volatile int irqraised1 = 0;: x! E! U3 r& l# y8 J. \' ]& Z
  62. static volatile int irqraised2 = 0;
    9 T. ?3 d& J6 r- N& I

  63. ) E, o2 w+ b7 c& Z3 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , ~& j& @) ^' t. r4 t6 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # ^+ r# b' q: y! Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) q8 p' ^3 Y9 K

  67. 1 K% G: a; H+ {- ]! [6 Q
  68. dma_addr_t dmaphyssrc1 = 0;
    & O; T! m1 B+ z. h- y; s- L+ r
  69. dma_addr_t dmaphyssrc2 = 0;
    2 z2 }7 c: T4 B0 T0 I5 i
  70. dma_addr_t dmaphysdest1 = 0;1 |7 |1 ?$ M4 `7 k/ ^
  71. dma_addr_t dmaphysdest2 = 0;
    $ F4 \  g( G3 Y9 ~/ C

  72. & r( N; n# _' S! b3 H1 ^9 V
  73. char *dmabufsrc1 = NULL;
    . e6 v: U4 f8 u  a) a& X
  74. char *dmabufsrc2 = NULL;
    # g: s, p3 H# u  i) d! {
  75. char *dmabufdest1 = NULL;
    2 }- b% @$ r2 Y) a
  76. char *dmabufdest2 = NULL;" ]1 }9 z% f; s) |+ D2 b+ f
  77. # X" ~! D+ u* s9 v" S
  78. static int acnt = 512;
    - H1 k6 s9 f) @3 e4 c3 y0 [  v
  79. static int bcnt = 8;
    $ f9 r. Y" j- z" f8 C$ i
  80. static int ccnt = 8;7 u4 w4 D0 v( e

  81. 0 Y5 S9 W& j3 X! g! R
  82. module_param(acnt, int, S_IRUGO);' P' Q/ h$ {. x! @, |7 Q
  83. module_param(bcnt, int, S_IRUGO);
    ; n9 }3 a1 A- E7 r8 \9 g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ A( [/ v! O7 E( S1 A% d+ _& G1 b( f, ^8 Z3 C: f# G  J. j% \8 S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 W  y1 U% m. l! @  R' N% G% T$ Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, ~4 B' W% g/ c6 I& B: S1 z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ [( Z# j4 |3 j" R2 \! R( b
* P0 y$ h6 `/ [) ?' D( `( e7 R/ ~* ]4 H1 Z2 @. K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-13 09:27 , Processed in 0.043634 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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