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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , h7 z$ P  K) h- F: u) H8 n# W
  1. [code]EDMA sample test application
    $ m/ f( {" K. A/ Q0 k9 n
  2. /*/ U3 x2 B+ P- A
  3. * edma_test.c+ A+ o: n% I+ ~* c! g
  4. *3 W' w  {+ k1 Q; i- L! M
  5. * brief  EDMA3 Test Application
    $ i0 E! z" V; f5 s0 S" F) R+ f& s
  6. *5 D8 l- C+ ~1 [8 g; }% q& ?
  7. *   This file contains EDMA3 Test code.5 y5 E6 U5 f( O0 I; m
  8. *
    0 j5 E0 F& e; _$ q$ ]) [' C4 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ {7 V; `& y) W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 H! A( M' n  ?( _& f! f; ~
  11. *         TO CHANGE.
    1 q# r2 ?  W0 H5 Z5 C/ ?% ~
  12. *
      y. F* Y; h% K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ Q0 [! ?% `, ]. z  C
  14. *
    ( D: Z4 m0 J  @$ U- B2 `1 ^' x
  15. * This program is free software; you can redistribute it and/or" g( c# w+ O  r( F1 ~8 V
  16. * modify it under the terms of the GNU General Public License as$ |% [* U8 f, [" W- i
  17. * published by the Free Software Foundation version 2.8 T- o( t5 t! G2 }8 q
  18. */ n. a" k& p# A0 L  }( k  V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ Y  r+ w6 L4 O& [4 H, y& x
  20. * kind, whether express or implied; without even the implied warranty7 t% M+ f: |; G4 v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      B% A" ~$ B8 i/ X+ z1 C
  22. * GNU General Public License for more details.! {/ I3 j6 o3 x
  23. */
    0 c0 v, F1 g' o2 h" `

  24. 0 r# i" y" \* z# `2 l, T. X- H
  25. #include <linux/module.h>9 `) \0 n7 H* r9 S8 ^9 D. ?
  26. #include <linux/init.h>% P# u5 A3 x/ [6 p, }: Q
  27. #include <linux/errno.h>1 D8 @; E) X- Y' J7 h
  28. #include <linux/types.h>% q3 H8 g/ b. X1 ]7 Q$ ~: e; M
  29. #include <linux/interrupt.h>9 o4 E: S8 `  h, o9 L
  30. #include <asm/io.h>  O6 O) W5 h8 K" [1 f: ?% s; ^4 y- b
  31. #include <linux/moduleparam.h>+ s8 n# P3 Z* O
  32. #include <linux/sysctl.h>
    9 h' L: P( j+ z; ?' o- |* v
  33. #include <linux/mm.h># [' c( i) A6 P6 I2 d
  34. #include <linux/dma-mapping.h>
    2 g* c: a5 z, d1 }8 p& J
  35. + U# @' t& U/ s. K+ ]
  36. #include <mach/memory.h>
    ! c1 k/ b) W& P# z" Z' M
  37. #include <mach/hardware.h>" W$ V9 x7 z9 o
  38. #include <mach/irqs.h>
    - ]( c; v& u" P# n8 J: m" I
  39. #include <asm/hardware/edma.h>4 f; I  Y( s# c, A: w2 z

  40. 6 ~2 v* o$ @9 w8 K0 n+ `
  41. #undef EDMA3_DEBUG( K* Q2 N9 |% f, x  V, A+ i
  42. /*#define EDMA3_DEBUG*/
    5 a' ?( B. I: e9 S# C" e
  43. 5 g6 L3 N* K, T; W( w# @( p
  44. #ifdef EDMA3_DEBUG0 @: e& [0 }' c2 I$ u3 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ M. O. n/ O) ^" M7 |6 R. z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 @& a2 z0 J5 R; b8 t: }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 `! V4 U# b) ]2 q
  48. #else
    0 u3 Z& i; \- N9 |) W* Y9 T* ]
  49. #define DMA_PRINTK( x... )
    ! j7 T9 N, p2 _* w" Y
  50. #define DMA_FN_IN% L/ l+ p/ k! q! d" R* B' U
  51. #define DMA_FN_OUT
    4 m" e+ i- J6 j! k0 I, I4 @
  52. #endif8 n# ~8 D9 g* A& M; R
  53. . r& z7 y7 r+ P6 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 [, t6 u5 L+ i1 V+ j6 b
  55. #define STATIC_SHIFT                3* I+ |# Q) T7 m9 P% B$ \
  56. #define TCINTEN_SHIFT               20
    7 `" H! G/ t" h# K2 N* T5 c
  57. #define ITCINTEN_SHIFT              219 ^) t- X( Z: H  t( Z
  58. #define TCCHEN_SHIFT                22' c+ K1 K5 J6 `& Z: g- D. L- X# F
  59. #define ITCCHEN_SHIFT               233 O; J( n7 Q: B3 A1 J
  60. ' N# y( n% q! b0 O7 U
  61. static volatile int irqraised1 = 0;
    9 L8 }; Y+ t# ?1 w  R6 @" R# C2 i
  62. static volatile int irqraised2 = 0;$ t) j3 _0 S7 C* e: c

  63. : y0 q: k0 X3 G7 N% j) J& ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ b5 }+ z5 w# U9 C" ?3 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, L" T* C# Q9 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - B/ F. y5 L& o. M7 Z" d5 ~

  67. : ^6 h; \/ d2 ]  X8 d% I) D$ I3 Y
  68. dma_addr_t dmaphyssrc1 = 0;
    5 ^: ^4 ~- \) i' U5 }6 o+ G. m9 O
  69. dma_addr_t dmaphyssrc2 = 0;
    ) H( l! y' o' ^: B
  70. dma_addr_t dmaphysdest1 = 0;
    - K% Q+ e7 I+ \+ P
  71. dma_addr_t dmaphysdest2 = 0;- i& U# W& I; y

  72. " S; f9 ?* |8 \
  73. char *dmabufsrc1 = NULL;
    / o* u# ]3 w4 a- `
  74. char *dmabufsrc2 = NULL;
    & T$ d5 Y4 E4 {- W* `/ H
  75. char *dmabufdest1 = NULL;
    9 d, O% C4 M7 F7 I
  76. char *dmabufdest2 = NULL;
    : Q9 h* A3 R# \2 a& c0 q1 m! V- L
  77. 3 ~2 |0 R2 d, v
  78. static int acnt = 512;+ t2 u* I6 v' U/ A
  79. static int bcnt = 8;
    * g+ E) ^! ^! N8 ~! y
  80. static int ccnt = 8;
    0 ~" C2 V- M$ P2 y# I( s0 j% i
  81. 1 o8 J6 ~6 J& b( J1 ^
  82. module_param(acnt, int, S_IRUGO);
    * d9 P) z/ [0 @% }
  83. module_param(bcnt, int, S_IRUGO);
    - o( g" O. S( N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 R2 t$ j, Q5 n& X- }
0 ^: Y& }+ V1 e: B; A9 \' ^$ W3 B& d/ D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ D; |- ]  S3 O; U8 v2 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( i& p4 R  [: j; V8 d* R! W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 g. M- _. o5 e3 d9 b9 ]) G

& g& ]# X5 G2 w. |  E* T4 W/ V# a5 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-18 18:09 , Processed in 0.036771 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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