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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + N' T5 t1 i/ r
  1. [code]EDMA sample test application
    ( ^5 _+ T+ S! |& t3 p
  2. /*
    ' `  B: ~. y4 O' I/ \
  3. * edma_test.c* X, c' _/ n2 I% O" l. }" }7 p1 Z
  4. *" y. A, O- O  Z
  5. * brief  EDMA3 Test Application
    ( @4 @3 w/ F7 m! R7 f+ V& F9 O- N' Q
  6. *6 j) [4 g) z$ {+ \2 {4 v  ^" K6 B
  7. *   This file contains EDMA3 Test code.
    4 Y! B, ?4 k3 j! ^% K6 u( P9 A% j
  8. *9 q7 |1 i# Q0 e6 E' }. }( ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 W6 \$ x0 N& J% ^( [; S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 k9 `9 i9 b! A9 R2 q5 V
  11. *         TO CHANGE.0 `4 m+ ]5 z" \  R4 {, p
  12. *9 q+ u9 a% V7 A( A3 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 W  o* v7 j3 b$ W5 J4 h9 w
  14. *
    0 l2 b& C( e4 b& w" d5 {* e
  15. * This program is free software; you can redistribute it and/or/ s; R/ b1 g0 O% x' @2 }+ n
  16. * modify it under the terms of the GNU General Public License as
    6 w+ W; H8 x; J+ q7 p! _
  17. * published by the Free Software Foundation version 2.
    % Y6 L# t$ W0 T# A
  18. *
    ! ^7 G+ e% c* D7 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 h3 t/ d" q& ~6 n
  20. * kind, whether express or implied; without even the implied warranty) L5 K( m/ H9 \3 S- `2 j' P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " h5 M+ i  }! Q# \9 w2 F( p# _3 b
  22. * GNU General Public License for more details.
    ) g' U# \0 {: J
  23. */# e- @+ w8 q' T2 G

  24. # }8 p4 c5 e( R" ~$ o+ n
  25. #include <linux/module.h>% ]: o/ Y0 p( @
  26. #include <linux/init.h>
    ' J& e$ e7 S* p& U9 D
  27. #include <linux/errno.h>/ \) J6 l; b+ f+ W
  28. #include <linux/types.h>
    - |" P& l% h+ z0 O* u# a$ \5 y
  29. #include <linux/interrupt.h>2 r* I( u8 e$ d2 H* i
  30. #include <asm/io.h>3 n) F& N9 a+ J* b2 p% `. \2 S: X2 ?
  31. #include <linux/moduleparam.h>
    0 w& M8 e+ n) l# j# e8 Z
  32. #include <linux/sysctl.h>5 q. {! @9 Z3 ]4 J7 M& |
  33. #include <linux/mm.h>
    # ?% \  H7 t0 _7 z) ?6 G
  34. #include <linux/dma-mapping.h>) T( X# o( A' m- n; m, L

  35. ; y2 f5 X+ o' _% a
  36. #include <mach/memory.h>
    1 v9 z+ K1 S7 `% L1 t# i3 _5 r$ F
  37. #include <mach/hardware.h>
    % g5 r% C* Y0 m0 v9 g" O# {  u* G$ n
  38. #include <mach/irqs.h>) Y( }- X, u4 S2 u9 c' M" C9 _
  39. #include <asm/hardware/edma.h>' w+ O0 e$ B$ Z4 S# j3 Z

  40. ( c/ w* M; N7 l1 H
  41. #undef EDMA3_DEBUG7 r4 q9 R3 W7 L; P$ m! d
  42. /*#define EDMA3_DEBUG*/6 H; X# f1 v( j, _
  43. " X" m0 j" j" M( F2 a0 A0 u
  44. #ifdef EDMA3_DEBUG
    : B1 _- T0 W) P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . }) R8 j& A! }1 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 B+ H/ ?8 e& A  d+ O7 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- i4 o& x* J8 t! }- P8 ~; g' p
  48. #else
    - b3 C8 G! p! w9 E
  49. #define DMA_PRINTK( x... )
    . b& d7 I1 x7 t
  50. #define DMA_FN_IN( x9 O. Q! h4 c9 L
  51. #define DMA_FN_OUT
    , t1 g/ f$ z+ X; ]% I  S
  52. #endif* m  m! Y- q$ C+ a

  53. . f5 U2 h$ C0 f# s# Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + x- n5 q$ K& @9 a4 C' A$ S
  55. #define STATIC_SHIFT                3& ?5 ?2 S$ A3 r" L* M& A, T" E* C
  56. #define TCINTEN_SHIFT               20! e2 f- g7 ^& I) k2 d
  57. #define ITCINTEN_SHIFT              21# Z+ E) ~( k! c1 r4 i8 }; N
  58. #define TCCHEN_SHIFT                22
    8 z# D1 N% z3 V# b0 Z! b
  59. #define ITCCHEN_SHIFT               23
    / o$ S& t+ s$ p
  60. ( ]! p' x4 ~4 q( T
  61. static volatile int irqraised1 = 0;
    & H5 F! p6 p" g% J0 \  v/ y
  62. static volatile int irqraised2 = 0;
    * c, E7 B  D% c
  63. - ]; S* l; |  y9 \) W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( B/ k/ _, g, U; ?9 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 u- _3 v1 C2 S& m. D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 y( Z; ]/ [% _) D) x: [0 J
  67. " F& I4 Y! c! Z
  68. dma_addr_t dmaphyssrc1 = 0;/ z8 k) E# T$ \; K  `# y
  69. dma_addr_t dmaphyssrc2 = 0;* b) |0 w" b0 z- d# L- Y
  70. dma_addr_t dmaphysdest1 = 0;
    ' l+ n  A, _4 D3 T
  71. dma_addr_t dmaphysdest2 = 0;
    & Z5 V' q; w$ a; O- {$ Y

  72. $ _$ J0 V* D0 d2 n) f  t
  73. char *dmabufsrc1 = NULL;% T- k5 y- q4 H- P$ Y
  74. char *dmabufsrc2 = NULL;
    4 N9 k4 j" ~& U, Y
  75. char *dmabufdest1 = NULL;
    2 E5 ?" l9 m% i2 t5 f
  76. char *dmabufdest2 = NULL;
    * i2 F4 M! A& w$ w* q

  77. 8 f: W7 S, y; }
  78. static int acnt = 512;- [" [& j/ b4 \3 @& ?. e: b
  79. static int bcnt = 8;
    - b, Y' }8 Q% W, w! [0 g
  80. static int ccnt = 8;/ A! |/ J- Z7 J# S( i  [2 t( r7 _
  81. 0 S, B# l1 Q8 w  J* f+ t1 }
  82. module_param(acnt, int, S_IRUGO);5 f$ ?0 S& U2 C) r# ^! g
  83. module_param(bcnt, int, S_IRUGO);
    1 l7 m& \/ ]% C, B! M3 M8 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 u! \- K) e# S: U" ~6 |
4 C% w9 Q/ c7 i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- A7 _: W; \1 V4 t; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% j6 F, W, \3 j# [, Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& E! L' Q* ?0 C
: W$ G' b9 w) R, l  e
& e4 C6 c. g$ \- M$ N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 22:04 , Processed in 0.038421 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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