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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 A. ~& X! O3 K- M! ^+ u8 B
  1. [code]EDMA sample test application; ~' _+ ?, \  v8 x6 F5 c; c+ |
  2. /*
    : H  b. X, n$ R2 L8 `5 q8 q% m/ ~
  3. * edma_test.c
    9 \- |/ l* B# k1 |$ D: [
  4. *
    / a# j* V) Y& P2 S4 l0 S
  5. * brief  EDMA3 Test Application2 m" Y2 q" `  z5 c
  6. *# K( ?! j7 `! f/ N9 _
  7. *   This file contains EDMA3 Test code.
    ( {+ j9 h$ ~. H# g' H6 q  M
  8. *$ K1 O- n% Y& \$ x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . R  [* l$ ~' ]* f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 U% p/ o0 \, v# a" s! Y* L  I8 J
  11. *         TO CHANGE.1 I. _2 ?; l# Y* J& D, g
  12. *
    & @3 _  A& t0 J0 K6 L/ u3 b% Q5 b) V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ g# E2 T6 b+ [( J$ h
  14. *
    $ r1 V+ D  Y+ M8 k) {! @+ D& `8 Q
  15. * This program is free software; you can redistribute it and/or$ x0 p5 I% j; D( U/ }
  16. * modify it under the terms of the GNU General Public License as  K6 H" C% Q2 u% s# A1 n
  17. * published by the Free Software Foundation version 2.
    ( g7 D- v! l1 E1 P  g2 J& R5 X
  18. *
    ' E9 t9 L% E! N: a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ \$ N! {9 z0 @1 O
  20. * kind, whether express or implied; without even the implied warranty
    , j! U) \4 Z6 Z: K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / R, ?: `( a$ f  u
  22. * GNU General Public License for more details.% K' w) S: j, A
  23. */" B1 A2 K$ }7 G' J
  24. ( J4 A2 T$ \" @
  25. #include <linux/module.h>
    / I0 |. B$ _" `  X1 K% O8 y
  26. #include <linux/init.h>' \# E4 _+ @7 K5 u/ I3 O: N
  27. #include <linux/errno.h>( Z, ^* \+ j+ ^* T4 A( Q
  28. #include <linux/types.h>* J7 }9 @! I5 z# _: F5 m
  29. #include <linux/interrupt.h>1 y& s, `6 C* h3 u9 I# a
  30. #include <asm/io.h>
    : x. ^( w0 g7 {5 l) M5 f
  31. #include <linux/moduleparam.h># z6 M6 T- ?7 s8 N
  32. #include <linux/sysctl.h>
    # I4 J: L4 `. O/ j6 @2 Y
  33. #include <linux/mm.h>
    ( a+ C: \  x$ J2 w. q6 R$ [5 n
  34. #include <linux/dma-mapping.h>" G& V7 ^( {: ?$ `( p
  35. + M( [$ w: b, N1 K! ~8 o. M. N
  36. #include <mach/memory.h>
    / F' o# L. V, |* S+ I) i2 K
  37. #include <mach/hardware.h>
    1 g8 q) r+ S' l+ t
  38. #include <mach/irqs.h>
    & S3 {  Z" k7 q8 R
  39. #include <asm/hardware/edma.h>! S; x1 V5 m7 }1 a. P3 b4 Y$ Z

  40. * W; }, n& T& y+ e) P2 H
  41. #undef EDMA3_DEBUG' s2 t* I; B. H
  42. /*#define EDMA3_DEBUG*/
    8 i+ a! i: ]0 V  R2 }9 l" d
  43. 3 _% k; O" D9 d
  44. #ifdef EDMA3_DEBUG, I: V* a' m- n8 W1 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & j0 z9 [$ u) D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); M" ?8 r+ V  Y0 F' k( g9 W0 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 d" {+ \5 T* |$ e  u1 X; y
  48. #else8 a2 P1 _1 {2 o1 ]9 w
  49. #define DMA_PRINTK( x... )* K: a0 T9 g; W
  50. #define DMA_FN_IN: m6 ~' d3 {( x
  51. #define DMA_FN_OUT. a" p$ C) N- t5 @6 x0 U$ h4 i
  52. #endif
    7 d5 X( @$ O( e3 X5 H; \. p( S" @
  53. ( X0 m( M+ \0 o( _/ B- O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 \! P% `3 P3 p4 ^( O
  55. #define STATIC_SHIFT                3. K% k) A3 p, D; g0 Z% ?/ w
  56. #define TCINTEN_SHIFT               20
      ~3 J- D( _" l2 p# e4 G+ C
  57. #define ITCINTEN_SHIFT              21
    , E" h* u  `8 {9 b, `" l
  58. #define TCCHEN_SHIFT                226 Y, P, }. \; `& ?  A& E  ^+ C
  59. #define ITCCHEN_SHIFT               23, @- \* w4 M. a: l7 m; o

  60. - R! H, Z9 [* d, [% Y
  61. static volatile int irqraised1 = 0;/ ^9 p& f- j1 J! l, z' U, U
  62. static volatile int irqraised2 = 0;
    , D/ e* ]- w* Q# C# R. |. e
  63. 7 c/ ]4 o" u" x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) C' H4 J& q  {0 r6 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S0 B& l1 {) n* |) A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' C! a' a0 N* P5 B  p" Q

  67. ' _# k8 I( P, R9 J0 [
  68. dma_addr_t dmaphyssrc1 = 0;
    + ~% K5 n# K. g' z/ i1 T
  69. dma_addr_t dmaphyssrc2 = 0;
    4 H6 i) e/ G7 @* S& r. s. j0 N$ R
  70. dma_addr_t dmaphysdest1 = 0;( ?" g( m8 T, c2 e, m, G
  71. dma_addr_t dmaphysdest2 = 0;
    4 E+ @0 F% E! f$ M! m% }8 g

  72. 4 g, u. E5 C  ~3 j2 F
  73. char *dmabufsrc1 = NULL;
    5 W# a. Z3 p' G3 ^/ d! u; |" W
  74. char *dmabufsrc2 = NULL;
    8 l* ?7 @- R$ {4 m6 x( u/ a
  75. char *dmabufdest1 = NULL;! }& k; u/ |7 ?* r; ^
  76. char *dmabufdest2 = NULL;$ F1 [! \2 N# Q) {7 ^
  77. * M: T5 s5 {; L4 @$ e
  78. static int acnt = 512;$ b5 J9 F6 w' l" V& ]: y
  79. static int bcnt = 8;- }8 W* {& Z5 z+ k& z1 G! N7 u
  80. static int ccnt = 8;
    , r3 B. P8 w& |) i
  81. . H4 u0 y  c% m, F( J3 B
  82. module_param(acnt, int, S_IRUGO);
    % m' w1 Q, T+ m' C- w& d: `& I* n
  83. module_param(bcnt, int, S_IRUGO);
    " i1 E- z* b$ s( ]# W* S8 e# J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 e* N/ |% j' H+ n5 t  \) ~& a# ]# t7 O- y  h: P* F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# g# K( Z% y. ]* v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' L& c* M* k. f/ q# s3 @* z' d  W  Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) D% c: c* J9 O+ |2 Z) ?4 U0 P/ I% M9 b6 i' c1 F
! `2 [' _4 V4 F  U0 v7 ~4 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 13:59 , Processed in 0.040294 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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