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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 r. l6 }, c+ f. v. i
  1. [code]EDMA sample test application
      D% K* K8 c! j7 ?
  2. /*: ?/ ~$ r* {; i9 x) A# }5 ~+ E
  3. * edma_test.c
    2 G& {  i  d1 I! I
  4. *: ~$ I' S, b: `3 q( P1 Z/ k
  5. * brief  EDMA3 Test Application
    ( V+ R, a' I6 L
  6. *1 o4 T+ ~" P2 v! `' d" K
  7. *   This file contains EDMA3 Test code.
    0 [  D7 y& G8 ~) \; F% [4 D
  8. *
    & L: ~- N% L4 R8 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : y2 L' n+ v$ L/ \2 B! D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 F  i* D% z2 V/ J, q  X' Q
  11. *         TO CHANGE." v; f: u0 }+ Z' F8 E
  12. *1 Z( S5 ~0 R2 o* r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! e3 P( m+ H% C
  14. *
    ) U4 k/ f8 Y- G! |
  15. * This program is free software; you can redistribute it and/or
    5 D+ i  N5 i/ o5 o
  16. * modify it under the terms of the GNU General Public License as* A* Z4 Z' R' c& D. |4 @3 ~
  17. * published by the Free Software Foundation version 2.
    * u' G% ]5 v* _' q5 }) ]5 q9 v" o
  18. *
    ' g' ^0 X5 ]! a' \; `' u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 P( x2 T9 s/ l3 b& N
  20. * kind, whether express or implied; without even the implied warranty) Y) n9 h, S' s, f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % u8 P! w9 l: x9 x: E/ D
  22. * GNU General Public License for more details.
    : l, _+ o0 N' w: m7 O+ k
  23. */
    9 c3 J) @9 e- M* M& J
  24. 9 p0 T, {7 G; l( h9 m! A
  25. #include <linux/module.h>" Q8 r* e  n+ z7 m
  26. #include <linux/init.h>, e8 k# e$ l. C% j1 J. p) o% v
  27. #include <linux/errno.h>! M9 n4 l& n! ^' Z
  28. #include <linux/types.h>% t' T/ b! u- T+ h3 _4 ~' `
  29. #include <linux/interrupt.h>
    # k$ b, Q' c2 V
  30. #include <asm/io.h>( A. c: k5 Y  G: C' v
  31. #include <linux/moduleparam.h>
    - j7 Z0 X6 ~0 ?- A( [
  32. #include <linux/sysctl.h>
    . t( `  T3 r7 K% P0 X6 V
  33. #include <linux/mm.h>
    / @; ]- L3 ]8 w" ]" {( H' I7 U2 K( T
  34. #include <linux/dma-mapping.h>
    " m* j- g% p3 J) s

  35. ' I: e2 \% N; k3 h3 o
  36. #include <mach/memory.h>
    ' H- t/ e' s9 x
  37. #include <mach/hardware.h>* |0 P) f' D. ?: c
  38. #include <mach/irqs.h>2 B" q" [( p' S7 x( P- l1 E9 q
  39. #include <asm/hardware/edma.h>. A5 O! O, w. ]2 T! N

  40. - e+ o# i, x* ]5 [
  41. #undef EDMA3_DEBUG7 y9 @4 M! v, W' c; A% y
  42. /*#define EDMA3_DEBUG*/7 d$ V$ h0 c, P0 b4 `, u: \

  43. " F2 b) `+ U9 Z# |) @
  44. #ifdef EDMA3_DEBUG# d( N7 S1 q* v0 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) o4 H8 [- T& K5 n+ N8 ~4 P: w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 d2 L! V$ C0 b+ r7 C& A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 t, H/ ~/ B4 b
  48. #else( ^8 V2 J8 [1 u; \7 L. u6 i3 R* V
  49. #define DMA_PRINTK( x... )4 d/ Y6 B( Y0 q3 @
  50. #define DMA_FN_IN
    7 G8 l+ N* T. Z& a
  51. #define DMA_FN_OUT' D. F% m5 T9 k$ _5 R0 I( D5 y
  52. #endif
    ' M# S! G5 Q4 G% D- _' Y/ y
  53. & p7 v0 s5 r* u$ F7 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), K0 J8 K9 R& p8 |5 ?
  55. #define STATIC_SHIFT                3
    ; B. h  B( }  {
  56. #define TCINTEN_SHIFT               20
    ) Y7 ^% E7 f8 l
  57. #define ITCINTEN_SHIFT              21* V3 s7 @* H* J4 G! \( b  S
  58. #define TCCHEN_SHIFT                22
    + ^- D% h+ ]( W+ q* I: C" D
  59. #define ITCCHEN_SHIFT               237 J; o2 c2 D2 e" Q) s

  60. 6 `6 o( A6 k2 d1 k* T9 @
  61. static volatile int irqraised1 = 0;2 f  K0 w) P4 s' F1 M( K! D0 ?; q
  62. static volatile int irqraised2 = 0;
    ; e( r% W8 S% @3 q( a

  63. ! {1 u. D$ v- n/ u! S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - q' t3 h, C5 G% G, I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ^; @6 ?, j: {8 g3 ^  i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 w/ e/ ?% `( i& ?; b
  67. 0 a) o3 i3 Z9 R9 b2 O
  68. dma_addr_t dmaphyssrc1 = 0;
    5 j7 `' C/ H" ~0 ^) ]" V
  69. dma_addr_t dmaphyssrc2 = 0;0 f5 z3 l% Z0 [) ^3 p
  70. dma_addr_t dmaphysdest1 = 0;- V# ?( Y5 m2 z. B7 r" T
  71. dma_addr_t dmaphysdest2 = 0;' v& k9 N7 O8 L

  72. ) X# p: d6 {. T) m+ e0 q
  73. char *dmabufsrc1 = NULL;& A  Z6 N  W7 \/ {' n% d; o/ F
  74. char *dmabufsrc2 = NULL;0 G/ U" o( [& C* w7 ~" E- C( M
  75. char *dmabufdest1 = NULL;9 A8 b, b; P; {! G/ R* [- m
  76. char *dmabufdest2 = NULL;
    2 ~" b& l( M7 l- w5 X' A

  77. . Y; Q' J" M' K' k+ u
  78. static int acnt = 512;
    $ P) j  o$ |0 ]3 H( d
  79. static int bcnt = 8;; H* Q, C8 g( X7 ^7 d; r  k: @
  80. static int ccnt = 8;5 j- F; {3 b; \6 m4 x( h: r
  81. - {4 W! f* E7 }: c' F
  82. module_param(acnt, int, S_IRUGO);- u  W6 F  a! d9 p0 p' g7 M
  83. module_param(bcnt, int, S_IRUGO);
    ) I6 {1 P' {  g! N' e; S% S% a1 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 Z! W- g4 h* o! }" p/ q
  ^* R& y' c( ~% l$ O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 N  r" a- c; V3 G6 @3 Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; F/ I; E9 o$ H7 C+ q% I  J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& Q$ q4 ?6 [! K1 ?6 R9 D0 ], Z: F7 K) K) [- B: q6 D& H+ |

  c8 n2 \* B% O; r1 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 00:26 , Processed in 0.038743 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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