OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! v2 P* m# B" Q/ c+ o
  1. [code]EDMA sample test application
    " T6 f' Q" h% w" k
  2. /*- Z  T& y" L! L2 G, y' `
  3. * edma_test.c
    ' R) u' b, A, ]; \  p7 v
  4. *
    $ R) Y3 j" W% x3 K
  5. * brief  EDMA3 Test Application
    % b! n1 b4 @2 y( A& H, e
  6. *1 L, S6 U4 z! Q
  7. *   This file contains EDMA3 Test code.  d( L3 D, D# n" c; L
  8. *
    ( ~* {3 [8 k: r  D' \7 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 k5 p7 \0 E7 _& z" w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! Y) C* O/ y4 r1 ?5 p
  11. *         TO CHANGE.
    8 E0 ?% H3 _7 r$ e. X0 u
  12. *
    % i0 k1 W0 P8 @+ U4 q! r$ d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 G; K& ~% I( a- S$ h9 D
  14. *' {3 g7 P+ o+ _# e8 {# b
  15. * This program is free software; you can redistribute it and/or
    9 n- l7 i7 K' D- g
  16. * modify it under the terms of the GNU General Public License as' E5 q. [) k( `
  17. * published by the Free Software Foundation version 2.! n: B" ?) d3 O, b
  18. *) n* C! \! A) L3 n/ D$ L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- o! P( M# j8 N3 N$ u* a7 x
  20. * kind, whether express or implied; without even the implied warranty
    ( x& K9 ]  V; B/ P; Y* A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % F) C$ l3 d* q9 j
  22. * GNU General Public License for more details.' N  N6 N" p5 S, }* A
  23. */
    ' s7 T( l) M# ?5 Q8 @. W4 e
  24. , U8 m0 X+ Y4 p. ?. Q  S  z
  25. #include <linux/module.h># e5 H8 |2 M+ S' t
  26. #include <linux/init.h>
    + x- J/ [: b- E3 |8 a7 C. m' }
  27. #include <linux/errno.h>
    1 E1 T& G( ^! U! f* e
  28. #include <linux/types.h>% J7 B% S0 v. I/ Z
  29. #include <linux/interrupt.h>. Z# N5 }6 e' w: K- @% @2 K# C7 ^
  30. #include <asm/io.h>
    2 F) Z% Y0 w9 I* d- a8 ?! ^
  31. #include <linux/moduleparam.h>
    2 U% Q* t4 y2 N. S$ k3 D/ ]% w
  32. #include <linux/sysctl.h># [. ~/ X4 |& I2 l+ ?
  33. #include <linux/mm.h>  G  [; M& Q' t: E2 I% @, X
  34. #include <linux/dma-mapping.h>
    : E8 _. `7 Y& n' B8 K% ~

  35. - B3 e$ [& ~- K6 D) u: ]  o
  36. #include <mach/memory.h>- z0 [! H. F  }$ w" o
  37. #include <mach/hardware.h>
    0 n8 [2 {- r, ]* q$ r
  38. #include <mach/irqs.h>
    2 B4 F9 Q1 R" _0 ^' m; L
  39. #include <asm/hardware/edma.h>
    0 T, Z9 Y+ q( D  i0 d5 k( j
  40. ! R4 ~3 I4 n0 U" P. K
  41. #undef EDMA3_DEBUG
    " n- U3 |% K3 e, M5 l' j
  42. /*#define EDMA3_DEBUG*/
    6 N% u: _+ I. P/ k7 ]5 b! I; J6 M. N

  43. : Q' H  P+ T- _5 m8 t! q0 T
  44. #ifdef EDMA3_DEBUG' U1 Z, Y" W* n' R# e2 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 p+ ^9 ]) t! p* _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , w- e/ b% G! A, V6 R/ H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 l* O! o& x2 h
  48. #else( D. H* L3 \6 t, S. K
  49. #define DMA_PRINTK( x... )( V) R1 ~$ \2 l  V
  50. #define DMA_FN_IN
      w& H; \7 |* B4 u
  51. #define DMA_FN_OUT
    % N! h5 x; ~5 r
  52. #endif
    . J6 R* I) L6 R+ p. E& |

  53. 6 j6 h* A: e$ ~' N/ S6 ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( D$ u! b: N" m" f( }' d
  55. #define STATIC_SHIFT                3
    4 U, `" X& _: G. ~! h/ o) @
  56. #define TCINTEN_SHIFT               20
    & V9 R9 |2 |6 x6 F4 y! {( u- B
  57. #define ITCINTEN_SHIFT              21
    ; T# O/ L; I) `, U
  58. #define TCCHEN_SHIFT                222 ]7 i1 I9 N* [
  59. #define ITCCHEN_SHIFT               23
      f  o5 k7 E8 s
  60. , a' {8 R/ i3 P2 I. q: Z1 k
  61. static volatile int irqraised1 = 0;
    7 v# z  o* d  k, x
  62. static volatile int irqraised2 = 0;, Q2 j; N2 m) j7 S' F& Z

  63. 5 a* x, L  I1 ^# a# k. \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + C' d9 A' a) r( g' o% n5 ^7 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , F6 K- {) q. N  e+ E1 {5 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + G  q2 P9 c7 C' X" J- _
  67. - m& c6 V- V, W: }9 h" `/ J
  68. dma_addr_t dmaphyssrc1 = 0;
    1 i0 I- c' e" X# d
  69. dma_addr_t dmaphyssrc2 = 0;
    ! ?& m. f' o5 z! p9 f$ K' @2 _
  70. dma_addr_t dmaphysdest1 = 0;; \$ ]1 l# Q0 U: ~$ J
  71. dma_addr_t dmaphysdest2 = 0;
    & v* E3 k- Z$ e5 R$ `7 t
  72. ! _; O& k0 ^8 J- D
  73. char *dmabufsrc1 = NULL;
    9 J3 {  _$ o, Y; U2 {/ z
  74. char *dmabufsrc2 = NULL;
    6 A5 m) B" d& _
  75. char *dmabufdest1 = NULL;
    5 k5 H' ~& q. B/ x& Q( z
  76. char *dmabufdest2 = NULL;
    ! n8 L3 Z+ C& M) L& U2 C  g

  77. 6 H) R5 Y" q( L; f- B, n$ w2 j
  78. static int acnt = 512;
    + L5 m0 Z7 H+ L
  79. static int bcnt = 8;* p$ d- ~( G/ i9 r4 v
  80. static int ccnt = 8;+ w$ A, [6 @. A' D% f
  81. / \9 T/ |/ i2 K4 ?9 M6 S5 b
  82. module_param(acnt, int, S_IRUGO);  U+ X1 t  H# C, Q, _5 X/ q& t, D
  83. module_param(bcnt, int, S_IRUGO);4 T/ j2 n! W1 e0 x5 I# \, r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: Z/ W$ s) g, @% G& D, \

( t' H/ @" T% `- r  p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: ~% ]) R7 e$ I: r7 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( C( W( @/ _" `# ^8 f, a, v9 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 f( g1 }9 N+ c* S* W4 t8 t4 W' A" h, H  o6 E( n& P, \

. \+ w& ?: m$ m, [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-2-5 05:51 , Processed in 0.039101 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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